In this guide, we will install WordPress on Ubuntu 18.04 server.

For that first we need to install LAMP Stack.

Install WordPress

Wget tool will help us installing WordPress via link.

sudo apt install wget -y

From WordPress official page https://wordpress.org/download/ right click on download wordpress and copy link address

How to install wordpress on ubuntu

Paste the copied link address after the command wget.

wget https://wordpress.org/latest.zip

Followed by command ls to confirm latest.zip directory.

ls

Now install unzip tool.

sudo apt install unzip -y

Once the unzip tool is installed, it’s time to unzip and install WordPress.

unzip latest.zip

Now if we do command ls we should be able to see WordPress directory.

cd wordpress/
ls

Once we are into wordpress directory, copy all to /var/www/html

sudo cp -r * /var/www/html
cd /var/www/html/
ls

Now remove index.html

sudo rm -rf index.html
ls

We need to install PHP modules, these modules will help us to integrate PHP with the database.

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

Now it’s time to restart the service of apache.

sudo systemctl restart apache2

Change the ownership of the files

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

Navigate to WordPress GUI on web-browser with IP address.

WordPress installation page 1 language
WordPress installation page 2 requirement

Now create database and a user

sudo mysql -u root -p
create database wordpress;
show databases;

Replace username with the new user name, and Password@123 with the user password.

create user "username"@"localhost" identified by "Password@123";

The hostname part is set to localhost, which means that the user will be able to connect to the MySQL server only from the localhost (i.e. from the system where MySQL Server runs).

To grant access from another host, change the hostname part with the remote machine IP. (i.e. to grant access from a machine with IP 10.9.0.5 you would run:)

create user "username"@"10.9.0.5" identified by "Password@123";

To create a user that can connect from any host, use the '%' as a host part:

create user "username"@"%" identified by "password@123";

Grant all privileges to a user account over a specific database:

grant all privileges on wordpress.* to "username"@"localhost";

Grant all privileges to a user account on all databases:

grant all privileges on *.* to "username"@"localhost";
exit

As we have created Database Name: wordpress user/Username: username Password: Password@123 Database Host: localhost we are assigning the same here and table prefix is unchanged.

WordPress installation page 3 requirement

Once we click on submit, window should be redirected to run the installation.

WordPress installation page 4 run the installation

Now it’s time to set site title, email and WordPress login’s.

WordPress installation page 5 site title WP login

Once everything is set accordingly, click on Install WordPress.

WordPress installation page 6

Now login to your WordPress website.

WordPress login page
WP dashboard

To check visit site under site title.

WP site/ blog page

conclusion:

Now that you have Installed WordPress with lamp stack on Ubuntu, you can now host your website in the server and design your own website or blog for your business.

Hope this tutorial is helpful and comment down if you have any query or issue.