How to Install WordPress on Ubuntu: Step-by-Step Guide for Beginners
Thinking of launching your WordPress website on an Ubuntu server? You’re in the right place. Ubuntu is a popular, open-source operating system that’s both lightweight and secure—making it ideal for WordPress hosting. In this beginner-friendly tutorial, we’ll walk you through each step to get WordPress running on Ubuntu.
Why Use Ubuntu for WordPress Hosting?
Ubuntu is a top choice for developers and tech-savvy entrepreneurs because:
- It’s free and open-source.
- It’s highly customizable.
- It integrates smoothly with NGINX, Apache, MySQL, and PHP (aka the LAMP/LEMP stack).
- You have full control over performance, security, and configurations.
Prerequisites
Before you begin, make sure you have:
- A VPS or cloud server (e.g., from DigitalOcean, AWS, or Linode) running Ubuntu 22.04 or 20.04.
- A user with
sudoprivileges. - A registered domain name.
- Basic knowledge of the Linux command line.
Step-by-Step WordPress Installation on Ubuntu
1. Update Your System
sudo apt update && sudo apt upgrade -y
2. Install LAMP Stack (Linux, Apache, MySQL, PHP)
sudo apt install apache2 mysql-server php php-mysql libapache2-mod-php php-cli php-curl php-gd php-mbstring php-xml php-xmlrpc unzip curl -y
Enable Apache and start the server:
sudo systemctl enable apache2
sudo systemctl start apache2
Secure MySQL:
sudo mysql_secure_installation
Create a database and user for WordPress:
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
3. Download WordPress
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/html/
4. Configure WordPress
sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
Edit wp-config.php and add your database name, user, and password.
5. Set Permissions
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress 6. Enable Apache Rewrite Module and Restart Apache
sudo a2enmod rewrite
sudo systemctl restart apache2
7. Complete Installation via Browser
Navigate to http://your_domain_or_IP/wordpress to complete the setup wizard.
Final Thoughts
Running WordPress on Ubuntu gives you unmatched flexibility and control—perfect for developers or businesses seeking performance and security. But if you’re not comfortable with server management, consider managed WordPress hosting or let us handle the setup for you.
Need Help Installing WordPress?
Let the experts at MIK Web Solutions set up your Ubuntu-based WordPress site — secure, fast, and optimized for your business.
Contact Us for a free consultation.
Frequently Asked Questions (FAQ’s)
Is Ubuntu a good choice for WordPress hosting?
Yes, Ubuntu is stable, secure, and widely supported for web hosting environments.
Can I use NGINX instead of Apache?
Absolutely. You can swap Apache with NGINX for better performance, especially with high-traffic sites.
What’s the difference between LAMP and LEMP?
LAMP = Linux + Apache + MySQL + PHP
LEMP = Linux + NGINX + MySQL + PHP