Learn WordPress Installation on LEMP Server

· >

In our previous post, we learnt how to setup LEMP server but we didn’t installed WordPress on it. So in this post, we shall together learn to install WordPress on LEMP server. So let’s get started.

1. Update & Upgrade Repositories

$sudo apt update && sudo apt upgrade

2. Configure MySQL Database

As database was installed and secured in our post on installation of LEMP server on Ubuntu. Now login to mysql database with the root password & create database, database user & Database Password. Then Flush privileges.

$sudo mysql -u root
mysql> CREATE DATABASE WordPressDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
mysql> GRANT ALL ON WordPressDB.* TO WordPressUser @'localhost' IDENTIFIED BY 'W0rdpre$$';
mysql> EXIT;

3. Create root directory & Download WordPress in /tmp

$sudo mkdir /var/www/wordpress
$cd /tmp
$wget https://wordpress.org/latest.tar.gz

4. Unzip the tar file and Copy all Files to Root Directory

$tar -zxvf latest.tar.gz
$sudo cp -a /tmp/wordpress/.  /var/www/wordpress

5. Update Nginx as the Document Root Owner

$sudo chown -R www-data:www-data /var/www/wordpress

6. Generate WordPress Secure Keys

$curl -s https://api.wordpress.org/secret-key/1.1/salt/

7. Change wp-config.php File

To change wp-config.php file, you need following information.

1. Database Name (Configured in Step 2)
2. Database Username (Configured in Step 2)
3. Database Password (Configured in Step 2)

Also Read:

8. Update wp-config.php As Follows

Below mentioned information was configured during MySQL configuration in step 2. Kindly use secure usernames & passwords for avoid your site from getting hacked.

define( 'DB_NAME', 'wordpressDB' );
define( 'DB_USER', 'wordpressuser' );
define( 'DB_PASSWORD', 'W0rdpre$$' );
define( 'DB_HOST', 'localhost' );

/*Replace the wordpress secure keys generated from step 6 with keys already /*present in this file

Once you are done with the file, open the website URL, if all went well, word press welcome installation page should appear like below. Enter Site title, secure username & password and email and press Install WordPress button. This will take to your freshly installed WordPress site dashboard.

In this post, we had the opportunity on how to setup wordpress on LEMP server. That’s all for now. Hope you enjoyed, thanks for viewing.

Notify of
Inline Feedbacks
View all comments