Setup WordPress on Linux (Ubuntu 22.04)
This guide walks you through setting up WordPress on a Linux VM using the LAMP stack (Linux, Apache, MySQL, PHP). It’s designed for virtual machines hosted on the WebberStop Cloud Platform.
✅ Prerequisites
Before proceeding, make sure:
- You have an Ubuntu 22.04 VM deployed.
- The instance has a public IP address.
- You have root (or sudo) access via SSH.
🔢 Step 1: Update the System
First, update all existing packages:
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2
sudo apt install mysql-server -y
sudo mysql_secure_installation
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;
sudo apt install php libapache2-mod-php php-mysql php-curl php-xml php-gd php-mbstring php-xmlrpc php-soap php-intl php-zip -y
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/html/wordpress
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
Configure Apache for WordPress
Create a new Apache configuration file:
sudo nano /etc/apache2/sites-available/wordpress.conf
Paste the following content:
<VirtualHost *:80>
ServerAdmin admin@your_domain
DocumentRoot /var/www/html/wordpress
ServerName your_domain
<Directory /var/www/html/wordpress>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
Step 7: Complete Installation in Browser
1. Open your browser and go to http://your_server_ip/wordpress.
2. Select your preferred language and click Continue.
3. Enter your database details:
• Database Name: wordpress
• Username: wpuser
• Password: StrongPassword
4. Click Submit, then Run the Installation.
5. Set your WordPress site title, admin username, password, and email.
6. Click Install WordPress.
You’ll be redirected to the login page after successful installation.