Install WordPress on Debian 9 Server with Apache and MariaDB

Install WordPress on Debian 9 Server with Apache and MariaDB

If you’ve got a fresh Debian 9 server and you just want WordPress running without drama, this guide is for you.

Before: you’ve got a blank server, maybe Apache/PHP/MariaDB installed, but nothing useful to show to the client or your boss.

After: you’ll have WordPress installed under /wordpress, working in the browser, and ready to be hooked to a domain name later.

I’ll walk through the install steps in a practical way so you don’t have to keep guessing what goes where.

1. What You Need Before Installing WordPress

This guide assumes you already have the basic web stack ready on Debian 9 Server:

  • Apache web server
  • PHP
  • MariaDB (with a database and user ready for WordPress)

If any of those are missing, stop here and install them first. WordPress is just PHP code and needs a web server and database to live on.

Very short checklist before continuing:

  • Apache is installed and running
  • PHP is installed and enabled in Apache
  • MariaDB is installed and running
  • You’ve already created a database and user for WordPress in MariaDB

If one of those is missing, fix it first, then come back here.

2. Download and Extract WordPress to the Web Folder

WordPress runs from a regular directory under Apache’s document root. On Debian 9, the default document root is:

  • /var/www/html

We’re going to place WordPress there, in a folder called wordpress.

Basic steps:

  1. Download WordPress
  2. Grab the official WordPress package (wordpress.tar.gz).
  3. Save it somewhere on the server, typically in your home directory or directly in /var/www/html.
  4. Extract WordPress to /var/www/html
  5. Move the downloaded file to /var/www/html if it’s not there already.
  6. Extract it so you end up with this path:
    /var/www/html/wordpress
  7. Check the directory
  8. After extraction, you should see standard WordPress files and folders inside:
    • wp-admin/
    • wp-content/
    • wp-includes/
    • index.php, wp-config-sample.php, and so on.

Tip: keep the folder name simple (wordpress). You can change it later if you want a different URL path.

3. Fix Ownership: Let Apache Own the WordPress Folder

WordPress needs to be readable by Apache, and for updates/plugins/themes to work smoothly, Apache usually needs write access too.

On Debian, the Apache web server process runs under a specific user and group. You need to change the owner of the wordpress folder to that Apache user and group.

Steps:

  1. Change user and group of the wordpress directory
  2. Use chown to set the directory owner to Apache’s user and group (as required on your system):
  3. Apply it recursively so all files inside wordpress use the same owner.
  4. Why this matters
  5. Without proper ownership, you’ll hit permission errors when:

    • Uploading media
    • Installing themes or plugins
    • Updating WordPress core
  6. Quick safety tip
  7. Only change ownership for the WordPress folder, not the whole /var/www directory.
  8. This keeps the rest of your server a bit safer and avoids messing up other sites.

Once ownership is right, Apache will be able to serve the files and WordPress will be able to write its config file later.

4. Run the WordPress Web Installer

Now for the more fun part: installing WordPress through the browser.

Before you start, make sure both Apache and MariaDB are running. If either one is down, the installer will fail or throw database errors.

  1. Open the installer in your browser
  2. Go to:
    http://ip-server/wordpress
  3. Replace ip-server with your server’s IP address.
  4. Choose your language
  5. The first screen asks you to pick a language for the install process.
  6. Default is English – that’s fine for most cases.
  7. Click Continue when ready.
  8. Read the database requirements screen
  9. WordPress tells you what it needs:
    • Database name
    • Database username
    • Database password
    • Database host
    • Table prefix (optional)
  10. This information will be written into wp-config.php.
  11. Click Let’s go! to continue.

If you get an error at this point, double-check that Apache is serving the wordpress directory and that PHP is properly installed and enabled.

5. Connect WordPress to MariaDB

Now WordPress needs the database connection details you prepared earlier.

  1. Fill in the database form
  2. Database Name: the database you created earlier in MariaDB for WordPress.
  3. Username: the MariaDB user that has access to that database.
  4. Password: the password for that user.
  5. Database Host: usually localhost on a local server.
  6. Table Prefix: leave as wp_ unless you have a specific reason to change it.
  7. Submit the form
  8. Click Submit.
  9. WordPress tries to create wp-config.php
  10. If login to the database is successful and permissions are OK, WordPress will confirm that it can write the configuration.
  11. You’ll see a message that connection is successful and that wp-config.php can be created.
  12. Click Run the installation to go to the next step.

If this step fails:

  • Re-check the database name, user, and password.
  • Make sure the MariaDB server is running.
  • Ensure the user has permission to access that database.

Once this works, the wp-config.php file will be in place and WordPress is ready to initialize itself.

6. Set Up Your WordPress Site and Admin User

Now you tell WordPress what this site is and who the admin is.

  1. Fill the site details form
  2. Site Title: the title of your website (you can change it later in Settings).
  3. Username: admin username for logging into the dashboard.
  4. Password: choose a strong password and keep it safe.
  5. Your Email: admin contact email used for notifications and password resets.
  6. Start the installation
  7. Click Install WordPress.
  8. Finish and log in
  9. After install completes, you’ll see a success message.
  10. Click Log In to go to the login page.
  11. Or visit:
    http://ip-server/wordpress/wp-admin

From there you can log into the WordPress dashboard with the username and password you just created.

To see the public site, just open:

  • http://ip-server/wordpress

That’s your front-end homepage.

7. Accessing WordPress with a Domain Name

By default in this setup, WordPress is accessed as:

  • http://ip-server/wordpress

That works fine for internal testing or local use. But on a real server, you’ll want to use a domain instead of the raw IP.

The basic idea when using a domain is:

  • Point your domain to your server (DNS).
  • Configure your server so the domain name serves the WordPress directory.

In this context, the original tutorial mentions using a server that’s already online, such as a VPS. When your server is on the internet and reachable, you can:

  • Use your domain instead of ip-server in the URL.
  • Access WordPress via something like:
    http://your-domain.com/wordpress

The key point is: the steps you’ve done so far (installing WordPress to /var/www/html/wordpress) still apply. Switching from IP to domain is about DNS and web server configuration, not about re-installing WordPress.

8. Quick Recap and Next Steps

Let’s recap what you’ve done:

  • Prepared Debian 9 with Apache, PHP, and MariaDB (with a database and user ready).
  • Downloaded and extracted WordPress to /var/www/html/wordpress.
  • Set ownership so Apache can read/write the WordPress files.
  • Ran the web installer via http://ip-server/wordpress.
  • Connected WordPress to your MariaDB database.
  • Created the site title and admin user, and logged into the dashboard.
  • Learned that you can later swap the IP for a domain when the server is online.

From here, you can start installing themes, plugins, and building out your site.

Need more help? Check the latest CrushEdge posts.

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.