Install WordPress on Ubuntu 18.04 with a LAMP Stack

Install WordPress on Ubuntu 18.04 with a LAMP Stack

Stuck Getting WordPress Running on Ubuntu 18.04?

You’ve got an Ubuntu 18.04 server, you’ve heard you need this “LAMP” thing, and all you want is a working WordPress site without breaking the server.
This is usually where small business owners, freelancers, and DIY sysadmins start to sweat.

This walkthrough keeps it practical: what you need ready, why it matters, and the logical order to get WordPress installed on top of a LAMP stack on Ubuntu 18.04.
We’ll stick to what’s in the source: LAMP, MySQL database prep, and SSL options.


Before You Start: What You Must Have Ready

Let’s get the checklist out of the way.
You’ll save yourself a lot of reinstall headaches if these are set up first.

You need:

  1. Ubuntu 18.04 server with a sudo user
  2. You should not be doing everything as root.
  3. Use a normal user that can run sudo when needed.
  4. If you don’t have that user yet, create it using an initial server setup routine for Ubuntu 18.04.
  5. A working LAMP stack (Linux, Apache, MySQL, PHP)
  6. WordPress needs a web server, a database, and PHP.
  7. On Ubuntu 18.04, Apache + MySQL + PHP is the standard combo.
  8. Make sure Apache responds in a browser and PHP is installed and talking to Apache.
  9. SSL/TLS configured on your site
  10. WordPress handles logins and other sensitive stuff.
  11. Encrypting traffic with SSL/TLS is important even on small or test sites.

There are two main paths here:

  • If you have a domain name:
    Use Let’s Encrypt with Apache to get a free, trusted SSL certificate.
    This gives you a browser-trusted lock icon and encrypted traffic.
  • If you don’t have a domain name and you’re just testing or using it personally:
    Use a self-signed SSL certificate with Apache.
    The connection will still be encrypted, but browsers will show a warning because it’s not tied to a real domain.

Do all of that first.
Once your server, LAMP stack, and SSL are sorted, log in as your sudo user and move on.


Why the Database Comes First

Before you even think about the WordPress installer screen, you need a database ready.
WordPress stores almost everything in MySQL: posts, users, settings, plugin data.

So the first real step is in the source: create a MySQL database and a dedicated MySQL user just for WordPress.
This is better than using the root MySQL account, for security and sanity.

Quick safety notes:

  • Make sure you are on the right server (production vs staging).
  • If there is already data on this server, don’t delete or drop any existing databases unless you’re absolutely sure what they are.

Step 1 – Create a MySQL Database and User for WordPress

You’ll be working inside MySQL for this part.
The general flow is: log in to MySQL, create the database, create a user, grant that user access to the database.

1. Log into MySQL

Use your sudo user on the server and connect to MySQL.
You should end up at the MySQL prompt (the mysql> line).

From here, all commands are MySQL commands.

2. Create a Database for WordPress

You’ll create a database that will hold all WordPress data.
Pick a name that clearly says it’s WordPress-related so you don’t confuse it later.

This matters because:

  • It keeps things organized if you run multiple apps.
  • It helps avoid accidental deletions when cleaning up databases later.

3. Create a MySQL User Just for WordPress

Next, you create a new MySQL user.
This user will be used only by WordPress to talk to the database.

Why bother with a separate user?

  • If that user’s credentials ever leak, the attacker only has access to this one database, not your whole MySQL server.
  • It’s easier to rotate or revoke access if you have issues later.

Use a strong password here and keep it somewhere safe (password manager, encrypted notes, etc.).
You’ll need the username, password, database name, and host when running the WordPress installer.

4. Grant the User Permissions on the Database

After creating the user, you grant it access to the WordPress database.
The idea is: this user should be able to read, write, modify, and delete data inside that one database.

Avoid giving this user global privileges or access to other databases.
You want it scoped to the single WordPress database for safety.

Once done, refresh MySQL’s privilege system so the changes take effect.
Then exit the MySQL prompt.

At this point, your MySQL side is ready for WordPress: database created, user created, permissions in place.


Step 2 – Confirming Your LAMP Stack Is Ready for WordPress

You already installed a LAMP stack, but it’s worth a quick sanity check before you hit the WordPress installer.
This saves you from half-installed WordPress setups that break mid-install.

Here’s what to verify:

  1. Apache is running
  2. Make sure the web server is active and serving some kind of page.
  3. If you open your server’s IP or domain in a browser and see the default Apache page, that’s a good start.
  4. PHP is installed and working with Apache
  5. WordPress is written in PHP, so if PHP isn’t wired correctly to Apache, the installer won’t run.
  6. Confirm PHP is installed and Apache is using it.
  7. MySQL is running and reachable
  8. You already logged into MySQL to create the database, which doubles as a test that the database service is running.

If any of these are broken, fix them first.
It’s much easier to debug Apache/PHP/MySQL before WordPress gets involved.


Step 3 – SSL Choices: Let’s Encrypt vs Self-Signed

SSL is already in the prerequisite list, but it’s worth repeating how it affects your WordPress setup.
Especially if you plan to log in from public networks or share the site with others.

If You Have a Domain Name

Use Let’s Encrypt with Apache.
It gives you:

  • A free SSL certificate
  • Encryption between your visitors and the server
  • A certificate that browsers trust by default

This is the right move for anything public, even simple blogs.

If You Don’t Have a Domain Name

If you’re just testing, doing local development, or using the server personally, you can go with a self-signed SSL certificate.

With self-signed:

  • Traffic is still encrypted.
  • Browsers will show a warning because it’s not issued by a recognized authority.

This is totally fine for personal/testing use where you control who accesses the site.

Whichever path you choose, make sure SSL is actually configured on Apache before you move forward.
That means Apache is listening on HTTPS and serving your site with that certificate.


Step 4 – General Safety Tips Before Running the WordPress Installer

You’re almost at the fun part (the WordPress installer), but a few quick safety checks will save you trouble:

  1. Double-check which server you’re on
    If you manage multiple servers (dev/staging/prod), make sure you’re installing WordPress on the right one.
  2. Use proper permissions for web files
    WordPress needs write access to certain directories, but you don’t want to just make everything world-writable.
    Keep your Apache user and file permissions aligned with your LAMP setup.
  3. Keep your database details somewhere safe
    You’ll be asked for the database name, user, password, and host by the WordPress installer.
    If you lose them, you’ll be digging back into MySQL.
  4. Plan your SSL URL from the start
    Decide if your site will live at https://your-domain right away.
    It’s easier than switching from HTTP to HTTPS later.

Step 5 – What Happens Next (High-Level WordPress Install Flow)

The source focuses on setting up the environment and the database, which is the heavy lifting.
Once that’s ready, the rest usually looks like this:

  1. Place the WordPress files in your web directory.
  2. Make sure Apache is pointing to that directory for your domain or IP.
  3. Visit the site in your browser.
  4. The WordPress installer asks for your MySQL details (the database and user you created earlier).
  5. WordPress writes its configuration file and sets up its database tables.

If your database and LAMP stack are correctly set up, this part is usually straightforward.
If anything fails here, you now know where to check first: permissions, database user, SSL setup, or Apache/PHP status.


Quick Recap

  • Use a sudo-capable non-root user on Ubuntu 18.04.
  • Make sure a LAMP stack (Apache, MySQL, PHP) is installed and working.
  • Secure your site with SSL: Let’s Encrypt for real domains, self-signed for tests.
  • Create a dedicated MySQL database and user for WordPress instead of using root.
  • Confirm everything (Apache, PHP, MySQL, SSL) is healthy before launching the WordPress installer.

If this worked for you, keep CrushEdge handy for the next fix.

No Comments

Leave a Reply

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