Skip to content

Install Wordpress 5, Nginx, MariaDB 10, and PHP 7 on Ubuntu 18.04

WordPress 5 was released recently with some fundamental changes, such as the Gutenberg editor, which is wonderful. In this article we are going to set up WordPress 5 with NGINX, MariaDB 10, and PHP 7 on Ubuntu 18.04.

If you want to have a blog or even a website, Wordpress is the ideal choice. And version 5 improved a lot.

In this article we will discuss the installation of Wordpress 5 on a fresh Linux Ubuntu 18.04 (with nothing installed).

As a web server, we will install NGINX, which is an excellent web server, much lighter than Apache, ideal for virtual machines.

We will also install PHP 7, which is undoubtedly the best option for Wordpress, since it is capable of running 5x faster than its predecessor, PHP 5.

As a database, we will install the Mysql Open Source FORK, which is MARIA DB version 10, which is also very robust and powerful.

Ubuntu update

The first step is to update Ubuntu to make sure you have the latest updates and fixes:

Sudo apt update && sudo apt upgrade

Nginx Web Server Installation

Now let’s install Nginx, start the service and then enable it to start when the system boots:

Sudo apt install nginx sudo systemctl start nginx.service sudo systemctl enable nginx.service

If you want to delve deeper into Nginx, check out the Linux Certification Ngnix course.

Configuring Nginx for Wordpress

Now let’s configure Nginx to work with Wordpress, creating the site configuration file. To do this, we will edit the file with vim. You can use another editor if you prefer.

sudo vim /etc/nginx/sites-available/wordpress.conf

Now paste the content below into the file:

server {
listen 80;
listen [: :]:80;
root /var/www/html/wordpress;
index index.php index.html index.htm;
server_name _ meusite.com.br www.meusite.com.br;

& nbsp; client_max_body_size 100M;

location/{
try_files $uri $uri/ /index.php? $args;
}

location ~ .php$ {
includes snippets/fastcgi-php.conf;
fastcgi_pass unix: /var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $ document_root$fastcgi_script_name;

}
} Don’t forget to change mysite.com.br and www.mysite.com.br. If you want to learn more about DNS, we have a DNS Bind 9 course.

Now, let’s create the symbolic link to the configuration file, and also delete the default site configuration:

sudo ln -s /etc/nginx/sites-available/wordpress.conf /etc/nginx/sites-enabled/

sudo rm /etc/nginx/sites-available/default

sudo systemctl reload nginx

Install MariaDB

Now let’s install MariaDB version 10. After installation, we will start the service and then set it to start at boot.

If you want to make your standard MySQL database super oiled up, check out our Mysql tunning course.

Sudo apt install mariadb-server mariadb-client sudo systemctl start mariadb.service sudo systemctl enable mariadb.service

Now, we recommend that you run the MySQL security script. Basically you will set a root password, disable anonymous access, and remove the test database.

Sudo mysql_secure_installation

Create the Wordpress database and login user

Now let’s access the database with the root password that you defined in the previous step, create the database and also create the WordPress user.

Sudo mysql -u root -p

Now, inside the MySQL shell, enter the following commands. Don’t forget to change the password:

The user will be: wp_user and the password you define.

CREATE WORDPRESS DATABASE; CREATE USER ‘wp_user’@‘localhost’ IDENTIFIED BY’ change_to_password ’; GRANT ALL ON wordpress.* TO’ wp_user’@‘localhost’; FLUSH PRIVILEGES; EXIT;

Install PHP 7

Now let’s install PHP 7 on the server. Soon after, we will enable the service and also set it to start when the system boots.

Sudo apt install php-fpm php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-mysql php-cli php-ldap php-zip php-curl sudo systemctl start php7.2-fpm sudo systemctl enable php7.2-fpm

Finally, install Wordpress 5

Now let’s download the latest version of Wordpress 5.

cd /tmp && wget http://wordpress.org/latest.tar.gz sudo tar -xvzf latest.tar.gz -C /var/www/html sudo chown www-data: /var/www/html/wordpress/ -R sudo service nginx reload

Setting up Wordpress for the first time

Now that Wordpress is installed, it’s time to set up access. To do this, you must access the server through your preferred browser.

Enter your server address or its IP. If everything worked out you will see a screen like this:

Choose Brazilian Portuguese and click ahead to set up the database. Change the user to wp_user and enter the password you chose when creating the wp_user user user.

Once this is done, the next step is to configure the Name of Your Site and your user to log in to WordPress.

Now it’s time to log into your Wordpress:

Voila. Your Wordpress 5 with MariaDB 10, Nginx and PHP 7 is ready to use:

Learn much more about Linux in our online course. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.

Did you like it? Share :-)