Table of Contents >> Show >> Hide
- Why Install WordPress on Ubuntu Server?
- What You Need Before You Begin
- Step 1: Update Ubuntu and Prepare the Server
- Step 2: Install Apache, MySQL, PHP, and Required Extensions
- Step 3: Secure MySQL and Create a WordPress Database
- Step 4: Download and Copy WordPress Files
- Step 5: Configure Apache Virtual Host for WordPress
- Step 6: Create and Edit wp-config.php
- Step 7: Complete the WordPress Installation in Your Browser
- Step 8: Add HTTPS with Certbot
- Recommended Post-Install Hardening
- Common Problems and Quick Fixes
- Final Thoughts
- Experience and Lessons From Installing WordPress on Ubuntu Server
- SEO Tags
If you have ever wanted full control over your website instead of tossing it into a mystery box labeled “managed hosting,” installing WordPress on an Ubuntu server is a great move. It gives you freedom, flexibility, and the satisfying feeling of knowing exactly what is running under the hood. It also gives you the power to break things yourself, which is how many sysadmins achieve enlightenment.
In this guide, you will learn how to install WordPress on an Ubuntu server using a classic LAMP stack: Linux, Apache, MySQL, and PHP. This method works especially well on Ubuntu 22.04 and 24.04, and it is perfect for developers, site owners, agencies, and anyone who wants a clean, manual setup without one-click shortcuts.
We will walk through server preparation, package installation, database creation, WordPress deployment, Apache virtual host setup, HTTPS, file permissions, and the final browser-based installation. By the end, you will have a production-ready WordPress site and a much healthier respect for configuration files.
Why Install WordPress on Ubuntu Server?
Ubuntu is popular for WordPress hosting because it is stable, well-documented, widely supported, and friendly to both beginners and seasoned Linux users. Pair it with Apache, PHP, and MySQL, and you have a proven stack that powers everything from personal blogs to busy business sites.
A manual Ubuntu WordPress installation also gives you several advantages:
- More control over your web server, PHP modules, and database settings
- Cleaner performance tuning than many shared hosting environments
- Better understanding of WordPress security and file structure
- Easier troubleshooting when something goes sideways
- A strong foundation for staging, backups, SSL, and future scaling
What You Need Before You Begin
Before installing WordPress on Ubuntu, make sure you have the following:
- An Ubuntu server with sudo access
- A domain name pointed to your server’s public IP address
- A non-root sudo user
- Basic familiarity with SSH
- Ports 80 and 443 open in your firewall
For the smoothest WordPress experience, use modern versions of PHP, MySQL or MariaDB, and HTTPS. You should also decide early whether you want Apache or Nginx. This tutorial uses Apache because it is straightforward, friendly to WordPress beginners, and works beautifully with .htaccess and pretty permalinks.
Step 1: Update Ubuntu and Prepare the Server
Start by connecting to your Ubuntu server through SSH, then update package indexes and installed packages:
If UFW is enabled, allow web traffic:
This step is boring, yes, but skipping updates before a fresh install is the server equivalent of building a house on a trampoline.
Step 2: Install Apache, MySQL, PHP, and Required Extensions
Now install the packages WordPress needs. On Ubuntu, Apache and MySQL are available directly from the default repositories, and PHP extensions can be added in one shot.
After installation, enable and start the services:
Check that Apache is running:
You can also confirm your PHP version:
At this point, your Ubuntu server has the basic LAMP stack required for a manual WordPress installation.
Step 3: Secure MySQL and Create a WordPress Database
Next, secure MySQL:
Then create a database and user for WordPress. Log in to MySQL:
Run the following SQL commands:
Use a long, unique password. “password123” is not a password. It is a cry for help.
Step 4: Download and Copy WordPress Files
Move into a temporary directory, download the latest WordPress package, and extract it:
Create a dedicated document root for your site:
Copy the WordPress files into it:
Now set the correct ownership and permissions:
These permissions are a sensible starting point for a secure WordPress deployment on Ubuntu.
Step 5: Configure Apache Virtual Host for WordPress
Create a new Apache virtual host file:
Add the following configuration:
Enable the site and Apache’s rewrite module:
This part matters more than many beginners realize. WordPress pretty permalinks depend on Apache rewrite support, and Apache ignores .htaccess when AllowOverride is set to None. In plain English: no rewrite settings, no pretty URLs, just sadness.
Step 6: Create and Edit wp-config.php
Inside your WordPress directory, create the configuration file:
Update these values:
While editing, replace the authentication keys and salts with fresh values. You can generate them from the official WordPress secret-key service. This helps harden login sessions and cookies.
After saving the file, lock down its permissions a bit more:
Step 7: Complete the WordPress Installation in Your Browser
Open your browser and visit your domain:
You should see the WordPress installation screen. Choose your site language, then enter:
- Site title
- Admin username
- Strong admin password
- Email address
Once installation finishes, sign in to the WordPress dashboard at:
Congratulations. WordPress is now installed on your Ubuntu server, and the internet has gained another dashboard with too many plugin notifications.
Step 8: Add HTTPS with Certbot
If your site is public, HTTPS is not optional anymore. It protects logins, sessions, forms, and visitor trust. Install Certbot:
Then request and install a certificate for Apache:
Test automatic renewal:
After that, update your WordPress settings so both the WordPress Address and Site Address use https://.
Recommended Post-Install Hardening
Getting WordPress installed is only half the job. The other half is making sure future-you does not wake up to a hacked admin account and a homepage trying to sell counterfeit sunglasses.
Practical Security Checklist
- Keep Ubuntu packages updated regularly
- Update WordPress core, themes, and plugins promptly
- Remove unused themes and plugins
- Use strong passwords and two-factor authentication
- Back up both files and database
- Limit plugin count to what you truly need
- Use a security plugin and a server firewall
- Consider disabling direct file editing in WordPress
You can disable theme and plugin editing by adding this line to wp-config.php:
Common Problems and Quick Fixes
Apache loads the default page instead of WordPress
Check that your virtual host is enabled and the default site is disabled. Then reload Apache.
Pretty permalinks do not work
Make sure mod_rewrite is enabled and AllowOverride All is set in your virtual host directory block.
Error establishing a database connection
Double-check your database name, user, password, and host value in wp-config.php.
Permission errors when uploading media
Verify ownership is set to www-data:www-data and that directory permissions are correct.
HTTPS works, but WordPress still shows mixed content warnings
Update old HTTP URLs in theme settings, plugin settings, and the database. Mixed content is usually caused by hard-coded image, script, or stylesheet links.
Final Thoughts
Installing WordPress on an Ubuntu server is not difficult, but it does reward careful attention. The real magic is not in running a few commands. It is in understanding how Apache, PHP, MySQL, file permissions, and WordPress itself fit together. That understanding makes your site easier to secure, optimize, and scale later.
If you want a setup that feels professional, flexible, and built to last, this manual method is absolutely worth learning. One-click installers are convenient, but doing it yourself teaches you the architecture behind the website. And once you understand the architecture, you stop fearing it.
Experience and Lessons From Installing WordPress on Ubuntu Server
One of the most useful lessons from real-world WordPress deployments on Ubuntu is that the installation itself is usually the easy part. The tricky part is everything around it: DNS propagation, file permissions, SSL, caching conflicts, plugin choices, and remembering which tiny config tweak you made at 1:13 a.m. because “it seemed smart at the time.”
In practice, the best installations start simple. A clean Ubuntu server, a fresh LAMP stack, one virtual host, one database, and the latest WordPress release. That minimal approach makes troubleshooting much easier. When people run into problems, it is often because they tried to optimize everything before the site even loaded once. They added Redis, a firewall rule, a performance plugin, a page cache, and a custom PHP config before confirming that WordPress could even connect to the database. That is like decorating a kitchen before checking whether the house has plumbing.
Another experience that shows up again and again is the importance of naming things clearly. Use a meaningful database name, a proper domain-based Apache config file, and a predictable document root. Six months later, when you revisit the server, your past self will either feel like a considerate engineer or a chaotic gremlin. There is rarely an in-between.
File permissions are another classic lesson. New users often overcorrect in one of two directions: either permissions are too strict and WordPress cannot upload anything, or permissions are too loose and the server becomes a security invitation. The sweet spot is not glamorous, but it is reliable: correct ownership, sane defaults, and special attention to wp-config.php.
Performance also becomes more intuitive after a few installs. On Ubuntu, you begin to see how Apache, PHP modules, image sizes, and plugin quality affect response times. A “slow WordPress site” is rarely just WordPress. It is often oversized images, unnecessary plugins, a bloated theme, or a server that never got tuned after installation. Manual setup helps you see the whole stack instead of blaming the dashboard for everything.
Perhaps the biggest lesson is confidence. The first time you install WordPress manually, every step feels important enough to trigger mild panic. By the third or fourth install, it starts to feel systematic. Update the server, install the stack, create the database, copy the files, configure Apache, add SSL, harden the site, and move on. That repeatable workflow is valuable whether you run one site or fifty.
So yes, installing WordPress on Ubuntu server is technical. But it is also practical, teachable, and empowering. Once you have done it yourself, hosting stops feeling mysterious. It becomes a set of moving parts you can understand, manage, and improve.
