Categories: How-To

Install WordPress 5, Nginx, MariaDB 10, and PHP 7 on Debian 9

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

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 Debian 9 Linux (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.

Debian 9 Update

The first step is to update Debian 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, we have a 3-hour course aimed at making Nginx tinky!

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 🙂

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Recent Posts

Sudo command on Linux (privilege scale) [Basic Guide]

The sudo command on Linux executes a given command as if it were another user.…

2 years ago

SS command on Linux (investigate the network) [Basic Guide]

The ss command on Linux is extremely useful for investigating sockets, providing various information about…

2 years ago

Free Linux command (memory usage) [Basic Guide]

Free Linux command shows the amount of total memory in use and available, as well…

2 years ago

Linux while command (loop – while) [Basic Guide]

The shell has structures for testing conditions and executing certain program sequences several times (loop),…

2 years ago

Linux fstab file (disk mount setup) [Basic Guide]

The /etc/fstab file stores the configuration of which devices should be mounted and what is…

2 years ago

Netcat command on Linux (Swiss network knife) [Basic Guide]

The Netcat Command in Linux or nc is a utility used to do “almost anything”…

2 years ago

This website uses cookies.