<aside> 📢 This guide is written with Ubuntu in mind. Other distros such as CentOS require additional repositories for PHP and have to download the phpMyAdmin release directly from their site extracting it to /usr/share/phpmyadmin

</aside>

This guide assumes that you already have an existing database host created by following. Setting up a MySQL Server that is hosted on the same machine and using Ubuntu operating system.

Install PHP

Update your package lists and install PHP with all the required extensions

apt update

# Install PHP and required extensions
apt -y install php7.4 php7.4-{mbstring,mysqli,gd,tokenizer,json,xml,fpm,curl,zip,bz2}

Installing phpMyAdmin & Web Server

Install phpMyAdmin itself together with the Nginx web server to serve it

apt -y install phpmyadmin nginx

<aside> ⚠️ We'll be using the Nginx web server. You can press TAB and then ENTER to bypass this prompt.

</aside>

Press Tab to select <Ok> and then press Enter to bypass the prompt.

Press Tab to select <Ok> and then press Enter to bypass the prompt.

Next, phpMyAdmin will ask you to configure a database with dbconfig-common. Select <Yes> and press Enter, then follow the instructions.

Select <Yes> and press Enter, then follow the instructions. If you selected no, type  to return.

Select <Yes> and press Enter, then follow the instructions. If you selected no, type dpkg-reconfigure phpmyadmin to return.

Web Configuration

Make sure to choose the correct server block matching your web server. In addition, we would recommend using an SSL certificate for your phpMyAdmin website.

First, we will create a symlink to serve files using both the domain and /phpmyadmin sub-directory.

ln -s /usr/share/phpmyadmin /var/www/phpmyadmin