deploying-wordpress-on-ubuntu-with-apache-mysql

Recently, I deployed a WordPress site from scratch on an Ubuntu 22.04 server. The stack was Apache 2.4, PHP 8.2, and MySQL 8.0. Here is the full walkthrough.


Step 1: System Update

Always start with updating the system.

sudo apt update && sudo apt upgrade -y


Step 2: Install Apache

sudo apt install apache2 -y
sudo systemctl enable apache2
sudo systemctl start apache2


Step 3: Install MySQL

sudo apt install mysql-server -y
sudo mysql_secure_installation

Create a database and user:

CREATE DATABASE wp_db;
CREATE USER ‘wp_user’@’localhost’ IDENTIFIED BY ‘strong_password’;
GRANT ALL PRIVILEGES ON wp_db.* TO ‘wp_user’@’localhost’;


Step 4: Install PHP 8.2

sudo apt install php8.2 php8.2-mysql php8.2-curl php8.2-xml php8.2-mbstring -y


Step 5: Download WordPress

cd /var/www/html/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo chown -R www-data:www-data wordpress/


Step 6: Configure Apache

Create a virtual host configuration and enable it.

sudo a2ensite wordpress.conf
sudo systemctl reload apache2


Step 7: Complete Installation

Visit the server IP in the browser and complete the WordPress installation wizard using the database credentials created earlier.


Final Status

systemctl status apache2 → active (running)
curl -I http://192.168.1.100/wordpress → HTTP/1.1 200 OK

WordPress successfully deployed.

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部