<\/span><\/h2>\n\n\n\nFirst, log in to your Ubuntu 20.04 server via SSH as the root user:<\/p>\n\n\n\n
ssh root@IP_Address -p Port_number<\/pre>\n\n\n\nYou will need to replace ‘IP_Address’ and ‘Port_number’ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.<\/p>\n\n\n\n
Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\n\n\n\n
apt-get update -y\napt-get upgrade -y<\/pre>\n\n\n\n<\/span>Step 2: Install LEMP Server<\/span><\/h2>\n\n\n\nWordPress is written in PHP and uses MariaDB as a database backend. So LEMP server must be installed on your server. You can install nginx, MariaDB, PHP and all the required PHP extensions with the following command:<\/p>\n\n\n\n
apt-get install nginx mariadb-server php php-curl php-mysql php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip php-fpm -y<\/pre>\n\n\n\nOnce the LEMP server is installed, start the Nginx and MariaDB service with the following command:<\/p>\n\n\n\n
systemctl start nginx\nsystemctl start mariadb<\/pre>\n\n\n\n<\/span>Step 3: Create a WordPress Database<\/span><\/h2>\n\n\n\nNext, you will need to create a database and user for WordPress. First, connect to the MariaDB shell with the following command:<\/p>\n\n\n\n
mysql<\/pre>\n\n\n\nOnce connected, create a database and user using the following command:<\/p>\n\n\n\n
MariaDB [(none)]> CREATE DATABASE wpdb;\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'securepassword';<\/pre>\n\n\n\nNext, flush the privileges and exit from the MariaDB with the following command:<\/p>\n\n\n\n
MariaDB [(none)]> FLUSH PRIVILEGES;\nMariaDB [(none)]> EXIT;<\/pre>\n\n\n\nAt this point, MariaDB is installed and configured for WordPress. You can now proceed to install WordPress.<\/p>\n\n\n\n
<\/span>Step 4: Download WordPress<\/span><\/h2>\n\n\n\nFirst, change the directory to the Nginx default web root and download the latest version of WordPress with the following command:<\/p>\n\n\n\n
cd \/var\/www\/html\nwget http:\/\/wordpress.org\/latest.tar.gz<\/pre>\n\n\n\nOnce the download is completed, extract the downloaded file with the following command:<\/p>\n\n\n\n
tar -xzvf latest.tar.gz<\/pre>\n\n\n\nNext, change the directory to wordpress and rename the sample configuration file:<\/p>\n\n\n\n
cd wordpress\nmv wp-config-sample.php wp-config.php<\/pre>\n\n\n\nNext, edit the configuration file and define your database settings:<\/p>\n\n\n\n
nano wp-config.php<\/pre>\n\n\n\nChange the following lines:<\/p>\n\n\n\n
\/** The name of the database for WordPress *\/\ndefine('DB_NAME', 'wpdb');\n\n\/** MySQL database username *\/\ndefine('DB_USER', 'wpuser');\n\n\/** MySQL database password *\/\ndefine('DB_PASSWORD', 'securepassword');\n<\/pre>\n\n\n\nSave and close the file then set proper permission and ownership of the wordpress directory:<\/p>\n\n\n\n
chown -R www-data:www-data \/var\/www\/html\/wordpress<\/pre>\n\n\n\nOnce you are finished, you can proceed to configure Nginx to host WordPress.<\/p>\n\n\n\n