๐ Step 1: Create the E2 VM Instance
In Google Cloud Console:
Go to Compute Engine โ VM instances
Click Create Instance
Configure:
Name: wordpress-e2
Region/Zone: closest to users
Machine type:
โ E2-medium (recommended minimum for WP)
Boot disk:
OS: Ubuntu 25.10
Size: โฅ 20 GB (SSD preferred)
Firewall:
โ
Allow HTTP
โ
Allow HTTPS
Click Create
๐ Step 2: Connect via SSH
gcloud compute ssh wordpress-e2
Or use the browser SSH button.
๐ฆ Step 3: Update System
sudo apt update && sudo apt upgrade -y
๐ Step 4: Install Apache
sudo apt install apache2 -y
Enable + start:
sudo systemctl enable apache2
sudo systemctl start apache2
Test:
http://YOUR_EXTERNAL_IP
๐๏ธ Step 5: Install MySQL
sudo apt install mysql-server -y
Secure it:
sudo mysql_secure_installation
Recommended:
Remove anonymous users โ Yes
Disallow root login remotely โ Yes
Remove test DB โ Yes
๐งฉ Step 6: Install PHP (WordPress-compatible)
sudo apt install php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip libapache2-mod-php -y
Restart Apache:
sudo systemctl restart apache2
๐งฎ Step 7: Create WordPress Database
sudo mysql
Inside MySQL:
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER ‘wpuser’@’localhost’ IDENTIFIED BY ‘StrongPassword123!’;
GRANT ALL PRIVILEGES ON wordpress.* TO ‘wpuser’@’localhost’;
FLUSH PRIVILEGES;
EXIT;
๐ฅ Step 8: Download WordPress
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar -xvf latest.tar.gz
Move to web root:
sudo mv wordpress /var/www/html/
๐ Step 9: Configure Permissions
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
โ๏ธ Step 10: Configure Apache Virtual Host
Create config:
sudo nano /etc/apache2/sites-available/wordpress.conf
Paste:
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
<Directory /var/www/html/wordpress>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Enable site + rewrite:
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo a2dissite 000-default.conf
sudo systemctl reload apache2
๐งพ Step 11: Configure wp-config.php
cd /var/www/html/wordpress
cp wp-config-sample.php wp-config.php
nano wp-config.php
Update:
define(‘DB_NAME’, ‘wordpress’);
define(‘DB_USER’, ‘wpuser’);
define(‘DB_PASSWORD’, ‘StrongPassword123!’);
define(‘DB_HOST’, ‘localhost’);
Add salts from:
๐ https://api.wordpress.org/secret-key/1.1/salt/
๐ Step 12: Access WordPress Installer
Open browser:
http://YOUR_EXTERNAL_IP
Follow:
Site name
Admin user
Password
Email
Leave a Reply