Installing WordPress on linux

Giteqa

In this article, we will look at how to install and configure WordPress on linux. We will go through all the points from updating the server to configuring the web server and wordpress itself.

An example will be shown on Ubuntu 20.04

Video Instructions

Server Preparation

First we need to update the server and this is done using the following command:

Apt update && apt upgrade -y (At the beginning, enter Sudo if you are acting on behalf of a newly created user)

After we have waited for the end of the system update (you will need to agree to download additional files several times), we proceed to install the Apache web server.

To install a web server, enter the command:

Apt install apache2 apache2-utils -y

After the server is installed, add it to the startup and run it using the commands:

Systemctl enable apache2 - adds to startup
Systemctl start apache 2 - starts

After that, we check if everything works. To do this, you must go to the IP address of your server

Installing MySQL

Now we need to install and configure the MySQL database. This is done using the following commands:

Apt install mysql-client mysql-server

After that, the download and installation of the MySQL client and server will start, you need to agree to the installation by entering Y.

Next, we need to configure security, this is done using the command:

Mysql_secure_installation

This command will allow you to enter the password for the administrator, disable remote access to the admin account, and much more.

Installing PHP

After the database has been configured, we have to install PHP modules to do this, enter the command:

apt install php7.4 php7.4-mysql libapache2-mod-php7.4 php7.4-cli php7.4-cgi php7.4-gd

We also agree with the installation of an add-on. Files

To check if PHP is working, enter the command:

Nano /var/www/html/info.php

And then enter:

<?php
phpinfo();
?>

After that, just go type in the address bar

ipaddres/info.php

After that, we will need to activate Apache modules. In order to activate them, enter the following commands:

A2enmod rewrite
Systemctl restart apache2

Downloading WordPress

Now the server is ready to run the site on WordPress. To download it, enter the following commands:

Wget -c http://wordpress.org/latest.tar.gz - download the archive
Tar -xzvf latest.tar.gz - unpacking the archive
Rsync -av wordpress/* /var/www/html/ - copying files

After we have made these commands, it is necessary to give access rights to work with the web server

Chown -R www-data:www-data /var/www/html/
Chmod -R 775 /var/www/html/

Creating a MySQL database

Log in to the MySQL admin panel using the command

Mysql -u root -p

After that, enter the following commands:

CREATE DATABASE wp_database; - create mysql database
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'password'; - create user
GRANT ALL PRIVILEGES ON wp_database.* TO 'wp_user'@'localhost'; - assigning mysql rights to the user
FLUSH PRIVILEGES; - updating mysql privileges
EXIT; - exiting the MySQL admin panel

All server settings have been completed and we can proceed to the WordPress setup

Setting up WordPress

To configure the system, enter in the address bar

ip address/wp-admin/

After that, a menu with a choice of language will open in front of you

After selecting the language, you will need to enter the data in the table You need to enter your DB name, DB username, password from your database, specify the host and prefix.

After you have filled it out, confirm the action and you will be taken to the user profile creation page. You will need to select the site name, username, password of the user (administrator), and also enter your e-mail.

Conclusion

We have just created a website on a wordpress engine on an Ubuntu server. Following these instructions, you can easily create your own website and use it. In future articles, we will analyze how to add plugins to the site, as well as how to add themes, ssl certificate, and so on.