In this guide, we will install WordPress on Ubuntu 18.04 server.
For that first we need to install LAMP Stack.
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
Followed by command
ls to confirm latest.zip directory.
Now install unzip tool.
sudo apt install unzip -y
Once the unzip tool is installed, it’s time to unzip and install WordPress.
Now if we do command
ls we should be able to see WordPress directory.
Once we are into wordpress directory, copy all to /var/www/html
sudo cp -r * /var/www/html
Now remove index.html
sudo rm -rf index.html
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;
username with the new user name, and
[email protected] with the user password.
create user "username"@"localhost" identified by "[email protected]";
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 "[email protected]";
To create a user that can connect from any host, use the
'%' as a host part:
create user "username"@"%" identified by "[email protected]";
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";
As we have created Database Name:
[email protected] 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.
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.