System: Ubuntu 20.04
Edition: 20210804

Web server Apache + PHP + MySQL based on Ubuntu


Ubuntu Linux 20.04.2 updated at 4 august 2021.


  • apache2 - 2.4.41-4ubuntu3.4
  • libapache2-mod-php - 2:7.4+75
  • mysql-server - 8.0.26-0ubuntu0.20.04.2
  • php - 2:7.4+75
  • php-mysql - 2:7.4+75

Kernel version:

Linux Ubuntu 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Operating system version:

Distributor ID:    Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:    focal
Base Linux / WEB
5.00 GB
Image added:
Image updated:

Getting started

Wordpress install:

  • Execute sudo mysql_secure_installation and configure mysql
  • Start mysql shell: sudo mysql
  • Execute next SQL-requests to configure database, user, password and priveleges:
CREATE DATABASE wordpress_db; --wordpress_db - название нужной базы данных
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'my_password'; --wordpress_user - Имя пользователя. localhost - Имя хоста. my_password - пароль пользователя.
GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost'; --Выдаём полные права пользователю wordpress_user на базу данных wordpress_db
FLUSH PRIVILEGES; --Применяем изменения прав
  • Exit from mysql shell: exit
  • Create an file: sudo nano /etc/apache2/sites-available/wordpress.conf with this settings:  

<VirtualHost *:80>

    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/wordpress

    ServerName localhost

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined


  • Save file with CTRL+O hotkey and exit from editor with CTRL+X hotkey
  • Enable wordpress and disable other sites:
sudo a2ensite wordpress.conf
sudo a2dissite 000-default.conf
sudo a2dissite site.conf
  • Restart Apache2:
sudo systemctl reload apache2

  •  Download and unpack Wordpress:
wget -O /tmp/wordpress.tar.gz
sudo tar -xzvf /tmp/wordpress.tar.gz -C /var/www
sudo chown -R www-data.www-data /var/www/wordpress
  • In next step go to your virtual machine ip address in web-browset and configure Wordpress by setting database name (wordpress_db), username (wordpress_user), and user password (my_password).