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 and copy link address

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.


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.

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

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

Once everything is set accordingly, click on Install WordPress.

Now login to your WordPress website.


To check visit site under site title.

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.
