
When: 2022
Why: Make a website for your business, friend or a client
Time: 15 Minutes
Tags: Debian, Linux, Apache, PHP, MariaDB, MySQL
WordPress (WP orWordPress.org) is a free and open-sourcecontent management system (CMS) written in hypertext preprocessor language and paired with a MySQL or MariaDB database with supported HTTPS. Features include a plugin architecture and a template system, referred to within WordPress as “Themes”. WordPress was originally created as a blog-publishing system but has evolved to support other web content types including more traditional mailing lists and Internet fora, media galleries, membership sites, learning management systems (LMS) and online stores. One of the most popular content management system solutions in use, WordPress is used by 42.8% of the top 10 million websites as of October 2021.
1. Ensure everything is up to date on your server:
sudo apt update
sudo apt upgrade
2. Install Apache
Check that the service is running, using systemctl (command to introspect and control the state of the systemd system and service manager):
sudo systemctl status apache2

3. Install PHP
We install php and other utilities
sudo apt install php-mysql php-fpm libapache2-mod-php php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip php-imagick
php-mysql: This package provides a MySQL module for PHP.
php-fpm: This package provides the Fast Process Manager interpreter that runs as a daemon and receives Fast/CGI requests.
libapache2-mod-php: This package provides the PHP module for the Apache 2 webserver.
php-curl: Provides a CURL module for PHP. CURL is used in command lines and scripts to transfer data through URLs.
php-gd: Provides a GD module for PHP. The GD library is a library that offers graphics drawing tools to manage image data.
php-intl: Provides an Internationalisation module for PHP.
php-mbstring: A package that provides the MBSTRING module for PHP, which is used to manage non-ASCII strings.
php-soap: Provides the SOAP module for PHP. SOAP is an API architecture that uses the XML language to transfer data between software.
php-xml: A package that provides a DOM, SimpleXML, WDDX, XML, and XSL module for PHP.
php-xmlrpc: Provides a XMLRPC-EPI module for PHP. XML-RPC is a feature of WordPress that enables data to be transmitted via HTTP using XML for encoding.
php-zip: Provides a Zip module for PHP. Zip is a tool that is used to archive and compress files.
php-imagick: Imagick is a native php extension to create and modify images using the ImageMagick API.
Check that the service is running:
sudo systemctl status php7.4-fpm.service
Note: You can check first what version of fpm service you have:
sudo systemctl --type=service --state=running | grep fpm
4. Install MariaDB
Maria DB is a forked version from MySQL (due to concerns over its acquisition by Oracle Corporation)
sudo apt install mariadb-server mariadb-client
mariadb-server : MariaDB database server (metapackage depending on the latest version)
mariadb-client: MariaDB database client (metapackage depending on the latest version)
Check that the service is running:
sudo systemctl status mariadb
Secure MariaDB installation:
sudo mysql_secure_installation
To know what you have to secure your installation and more information, please check mysql_secure_installation – MariaDB Knowledge Base.
5. Create database and user (MariaDB)
We will create a database named “wp” and an user named “wpuser”:
sudo mysql
CREATE DATABASE wp;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL ON wp.* TO 'wpuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;
6. Download wordpress and move it to Apache folder:
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/wordpress
We need also, to give permissions to the folder:
sudo chown -R www-data:www-data /var/www/wordpress/
sudo chmod -R 755 /var/www/wordpress/
Create a new configuration Apache file to handle the request (you can use vi or nano). If you have already an .conf file just edit it.
sudo nano /etc/apache2/sites-available/wordpress.conf
Content of the file:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
ServerAdmin admin@example.com
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the configuration file:
sudo a2ensite wordpress.conf
Restart Apache service:
sudo systemctl restart apache2.service
Check everything is ready, now you can launch WordPress site, by going to the server domain o IP address.
At the first start, it will ask for what user and db you need.