Looking to install WordPress on your VPS running Ubuntu? You’re in the right place. In this comprehensive 2025 guide, you’ll learn how to set up WordPress on a clean Ubuntu server from scratch — perfect for tech-savvy beginners, developers, and bloggers.
By the end of this tutorial, your WordPress website will be live, secure, and blazing fast.
🧰 What You’ll Need:
- A VPS with Ubuntu 22.04 or 24.04 (like Hostinger, DigitalOcean, etc.)
- Root or sudo access via SSH
- A domain name (e.g., yoursite.com)
- Basic terminal knowledge
✅ Step 1: Update and Upgrade Your Ubuntu Server
sudo aptupdate && sudo apt upgrade -y
✅ Step 2: Install Apache (Web Server)
sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2
Test it by visiting your VPS IP address in a browser. You should see the Apache default page.
✅ Step 3: Install MySQL (Database Server)
sudo apt install mysql-server -y
sudo mysql_secure_installation
Create a database and user for WordPress:
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
✅ Step 4: Install PHP
sudo apt install php php-mysql libapache2-mod-php php-cli php-curl php-gd php-mbstring php-xml php-xmlrpc php-zip php-soap -y
Check PHP version:
php -v
✅ Step 5: Download WordPress
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/html/
Set the right permissions:
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
✅ Step 6: Configure Apache for WordPress
Create a new virtual host file:
sudo nano /etc/apache2/sites-available/wordpress.conf
Paste this:
<VirtualHost *:80>
ServerAdmin admin@yoursite.com
ServerName yoursite.com
ServerAlias www.yoursite.com
DocumentRoot /var/www/html/wordpress
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the site and rewrite module:
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
✅ Step 7: Configure WordPress
Rename the sample config file:
cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php
nano wp-config.php
Edit the database settings:
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'strongpassword' );
define( 'DB_HOST', 'localhost' );
Save and exit.
✅ Step 8: Point Your Domain to VPS (DNS Setup)
- Go to your domain registrar (e.g., Hostinger)
- Add an A record pointing your domain to your VPS IP
Example:
Type: A
Host: @
Value: YOUR.VPS.IP.ADDRESS
TTL: Default
✅ Step 9: Secure WordPress with HTTPS (Optional but Recommended)
Install Certbot:
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache
Follow the prompts to secure your domain with SSL.
✅ Step 10: Finish Installation via Web Interface
- Visit
http://yoursite.com - Follow the on-screen WordPress setup wizard:
- Site Title
- Admin Username
- Password
Once done, you’ll be redirected to your new WordPress dashboard!
🎉 Conclusion:
Congratulations! You’ve successfully installed WordPress on your Ubuntu VPS in 2025. With full control over your server, you can now customize, optimize, and scale your site like a pro.
👉 Next Steps? Secure your server, install a caching plugin, and explore themes that match your niche.


