Outline

WordPress is the most famous open-source writing for a blog framework and CMS Online. It depends on PHP and MySQL. Its highlights can be reached out with great many free modules and subjects.


In this instructional exercise we will introduce WordPress on Apache2 server and make our most memorable post.


What you'll realize

Instructions to set up WordPress

Instructions to arrange WordPress

Instructions to make first post

What you'll require

A PC running Ubuntu Server 20.04 LTS

This guide will likewise tell you the best way to design a data set for WordPress 

Prerequirement

1 Fresh Installation of Ubuntu20.04 Server

2 Apache server

3 Mysql/MariaDB/PostgreSql

4 Php

The Above requirements are also known as LAMP Services


Steps to Install wordpress on Ubuntu 20.04 Server


Step 1: Update and Upgrade Repositories

sudo apt update && upgrade -y

Step 2: Enable root login

sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

Step 3: Restart ssh

sudo systemctl restart ssh

Step 4: Set password for root login, by default root password is not set

sudo passwd

Step 5: Login using root credentials

ssh root@ip-address


After login using root user, continue the steps below

Step 6: Install apache & libapache2-mod-php module

apt install apache2 libapache2-mod-php -y

Step 7: Install ghostscript

apt install ghostscript -y

Step 8: Install PHP and related php packages

apt install php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip -y

Step 9: Install Mysql Server

apt install mysql-server -y

After Installation, the following steps, we can start installing wordpress

Step 10: Creation Directory, changing the ownership and download the wordpress from the link

Creating the directory
    mkdir -p /srv/www

changing the ownership of the folder
    chown www-data: /srv/www

downloading the workpress data from the link and putting it into the created folder
    curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /srv/www

You can see/verify the downloaded file by
ls -l /srv/www
ls -l /srv/www/wordpress

Step 11 : Configuration Apache file for Wordpress

Create the Apache file, by

    nano /etc/apache2/sites-available/wordpress.conf
        or
    vim /etc/apache2/sites-available/wordpress.conf

After creating the file, then add the lines below into the create file

<VirtualHost *:80> DocumentRoot /srv/www/wordpress <Directory /srv/www/wordpress> Options FollowSymLinks AllowOverride Limit Options FileInfo DirectoryIndex index.php Require all granted </Directory> <Directory /srv/www/wordpress/wp-content> Options FollowSymLinks Require all granted </Directory> </VirtualHost>

Step 12 : Enable wordpress, redirect rule and disable the default webpage

copy the commands and paste in terminal
    a2ensite wordpress     a2enmod rewrite     a2dissite 000-default

After that we need to restart the Apache server
    systemctl reload apache2

To see, what it has done after we reload Apache, use the beloe command
    ls -la /etc/apache2/sites-enabled/

Step 13:Now we have to create Sql database for Wordpress

login into sql using root previliges
    mysql -u root

Create wordpress database
    CREATE DATABASE wordpress;

Create user in the local machine for wordpress and password to secure
    CREATE USER wordpress@localhost IDENTIFIED BY '<your-password>';

Note: Change <your-password> with your password

Then to grant privilages like select,insert,update etc
    GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;

Next to refresh/reload every thing we done
    FLUSH PRIVILEGES;
Then,
    quit

Step 14: Now we have to connect the databade with wordpress to configure

sudo -u www-data cp /srv/www/wordpress/wp-config-sample.php /srv/www/wordpress/wp-config.php

Now execute the below commands to connect database with wordpress

sudo -u www-data sed -i 's/database_name_here/wordpress/' /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i 's/username_here/wordpress/' /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i 's/password_here/<your-password>/' /srv/www/wordpress/wp-config.php

Note: change <your-password>, to the password given in the mysql database

Step 15: Chaning few lines

copy the link and open in the browser
    https://api.wordpress.org/secret-key/1.1/salt/

copy the content from the website, and the open the file
    sudo -u www-data nano /srv/www/wordpress/wp-config.php
replace the following lines and replace with the content copied from thw website
    define( 'AUTH_KEY',         'put your unique phrase here' );
    define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
    define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
    define( 'NONCE_KEY',        'put your unique phrase here' );
    define( 'AUTH_SALT',        'put your unique phrase here' );
    define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
    define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
    define( 'NONCE_SALT',       'put your unique phrase here' );

save and exit

Step 16: Open Browser and the enter the ip-address of the system

Enter the Ip-address of the system, then it will pop-up like below
Click on next,

Enter the details like site Title, username, etc and Click on Install Wordpress. After that login into the wordpress

After login, the dashboard will look like