How To Install WordPress in Ubuntu Cli

You must follow a set of steps in order to install WordPress on Ubuntu using the command line interface (CLI). Here is a detailed instruction:

1 System package updates:
Update the system packages to the most recent versions first. Run the following commands in a terminal after opening it:

sudo apt update
sudo apt upgrade

2 Set up the LAMP stack:

A web server, database, and PHP are necessary for WordPress. Using the command line, you may install the LAMP stack (Linux, Apache, MySQL, and PHP):

( 1 ) Install Apache

sudo apt-get install apache2 -y

( 2 ) Activate Apache and start it:
Start the service and make Apache boot up automatically after installation.

sudo systemctl start apache2
sudo systemctl enable apache2

( 3 ) Install MariaDB

sudo apt-get install mariadb -y

( 4 ) Activate Mariadb and start it:
Start the service and make Mariadb boot up automatically after installation.

sudo systemctl start mariadb
sudo systemctl enable mariadb

( 5 ) MySQL configuration

You’ll be asked to choose a root password when installing the MySQL server. Establish a strong password and abide by the directions. Run the subsequent command to protect the MySQL installation after that:

sudo mysql_secure_installation

follow a pick 



Your root password 


And then create the database

( 7 ) The creation of a MySQL database and user

Run the following command to enter the MySQL shell:

sudo mysql -u root -p

Enter the root password you created before. A new database and user can be created for highsky_db after you are logged in:

create database highsky_db

Check the Database


And Exit 

( 6 ) Install PHP

sudo apt-get install php

( 7 ) Install PHP-MySQL

sudo apt-get install php-mysql php-cgi php-cli php-gd

( 8 ) Restart the Apache service

sudo systemctl enable apache2

( 9 ) Installing and setting up WordPress:

Move to the Apache web server root directory:

sudo cd /var/www/html/

( 10 ) Install WordPress using the most recent version:

sudo wget

( 11 ) Unzip Tar File

sudo unzip

( 12 ) Check the unzip file

sudo ls

( 13 ) Copy this  file /var/www/html/

sudo cp -r wordpress/* /var/www/html/

( 14 ) Allow the Apache service in ufw

sudo ufw allow http

( 15 ) your IP address copy

sudo ip a

( 16 ) Access WordPress:

Open a web browser and type your server’s IP address or domain name. The WordPress installation page ought to appear. To finish the installation, adhere to the on-screen directions.

And click the Let ‘s go’

Scroll and click  Submit  

( 17 ) And go to Terminal to create a file /var/www/html/wp-config.php

sudo vim wp-config.php

Copy the full path And paste /var/www/html/wp-config.php

Click the Run the installation

your Email id file then Click install WordPress

Click Log in

Successful WordPress installation


WhatsApp chat