Steps to Install WordPress on Ubuntu 204
Step 1: Update & Upgrade system
It is considered to be a best practice to update and upgrade your Ubuntu system before installing or Configuring any software.
sudo apt update
sudo apt upgrade
Step 2: Install LAMP (Linux, Apache, MySQL, PHP) Stack
Install Apache
sudo apt install apache2
Install MySQL
During the installation, Follow the on-screen instruction guide and makes sure that to choose the strong root password and also remember it.
sudo apt install mysql-server
sudo mysql_secure_installation
Install PHP
sudo apt install php libapache2-mod-php php-mysql
Step 3: Create a MySQL Database and User
Login MySQL
sudo mysql
Create a database & user
CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 4: Download, Install and Configure WordPress
Go to the web root directory
cd /var/www/html
After navigating in directory, Download wordpress by using following commands
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
Move the files and set permissions
sudo mv wordpress/* .
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
Step 5: Configuration of Apache
Create a new Apache Web configuration file for wordpress
sudo vim /etc/apache2/sites-available/wordpress.conf
Add code in configuration file
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Restart the Enable site and rewrite module
sudo a2ensite wordpress.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 6: Complete the Installation of WordPress
Open your browser and navigate to “http://your_domain” which is www.example.com or you can directly type your IP_Address of the system “http://your_system_IP”, If you don’t know your ip_address, then open your terminal and type “ifconfig” . You will see the WordPress Settings Wizard. Follow the instructions to complete the setup, Installation, enter database credential that we have configured earlier.
How to Install WordPress on Ubuntu 22.04
WordPress is one of the most popular platforms for building websites, known for its flexibility and ease of use. If you’re looking to set up your own website, installing WordPress on Ubuntu 22.04 is a great choice. This guide will walk you through the process step by step, ensuring you get your WordPress site up and running smoothly. Whether you’re a beginner or have some technical experience, this tutorial will make the installation process straightforward and easy to follow.