In this tutorial, we explain all the steps you must follow to install and configure Wordpress in Ubuntu.
WordPress has been designed as a content management system (CMS) which allows us to create and maintain a blog or other type of website dynamically.
WordPress is a free and open source CMS based on PHP and MySQL.
It is a lightweight script that has many add-ons and themes, allowing users a wide range of options for website development and another of its advantages is the ease of installation.
Today you will learn how to install WordPress in Ubuntu.
Install Web Server in Ubuntu & Configure Firewall
First of all we must install Apache so that it fulfills the function of web server since this is the fundamental part to manage web pages in a web browser.
For this we will install Apache 2 running the following line:
sudo apt install apache2
Once installed, we will start the service executing the following:
sudo service apache2 start
Apache uses port 80 to listen for which we must enable it in the firewall, for this we execute the following line if we use UFW:
sudo ufw allow 80/tcp
If we use IPTABLES we will run the following:
iptables -A INPUT -p tcp –dport 80 -j ACCEPT
Proceed to restart Apache Service by executing the following:
sudo service apache2 restart
Install MySQL on Ubuntu
MySQL is the database that we will use to store the data to work with WordPress but we have another option like MariaDB.
To install MySQL in Ubuntu we will execute the following:
sudo apt install mysql-server mysql-client
During the installation process, we must enter and confirm the password of the MySQL root user.
Secure MySQL & Create WordPress Database
Once MySQL is installed we will execute the following command to ensure MySQL:
There will be displayed a series of questions that we will answer based on the current requirements.
The next step is to create the database for WordPress in MySQL and for this we will execute the following lines in their order:
mysql -u root -p CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; EXIT;
Install PHP in Ubuntu
Next we will install PHP in Ubuntu running the following line:
sudo apt install php libapache2-mod-php php-mcrypt php-mysql
Install WordPress on Ubuntu
Once configured the previous steps we proceed to the installation of WordPress in Ubuntu, and for this first of all we will go to the directory www / html:
Later we execute the following line to download the latest version of WordPress from the official site:
Unzip the downloaded file:
tar -xvzf latest.tar.gz
We access the WordPress directory by running the wordpress cd line, and there we proceed to use the following command to copy the content:
cp -rf * /var/www/html
We can visualize the content using ll:
Set up WordPress on Ubuntu
Next we will edit the file wp-config.php to modify the connectivity of the database:
sudo nano /var/www/html/wp-config.php
There we will indicate the name of the database, username and password:
Save the changes using the Ctrl + O keys and we exit using Ctrl + X.
Now we can go to a browser and there enter the IP address of the computer to access the WordPress configuration:
There we select the language and we will continue with the configuration process:
In this way WordPress has been installed in Ubuntu 17.