Hint: You can use the Tab key to autocomplete all filenames and directories, so you don't have to type in the complete file or directory name manually.
Important: This tutorial is for Debian 8. However, if you use Debian 9 or 10 (latest Debian version), you'll find the appropriate tutorial for Debian 9/10 here.
This tutorial was last checked and updated on July 5, 2020.
- If you havn't already done so, download the program "PuTTY".
- Connect to your root server or VPS/vServer via SSH using PuTTY. To do this, open PuTTY and enter the domain or IP address of your server in the text box named "Host Name (or IP address)". Then click the "OK" button below.
- Update your package lists with the command
- Now install any available updates of the packages already installed on your server using the command
apt upgrade -y.
- Next, install the packages needed for future installations in this tutorial by executing the following command:
apt install ca-certificates apt-transport-https lsb-release curl nano unzip -y
- Use the command
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -to add the key needed for the PHP repository.
- Add the repository needed to install PHP 7.4 by executing the command
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list. PHP 7.4 is not yet available through the official repositories.
- Now update your package lists again with the command
- Install the Apache2 web server and other required packages with the following command:
apt install apache2 -y
- Install PHP 7.4 and some important PHP modules. The command for this is:
apt install php7.4 php7.4-cli php7.4-curl php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-xsl php7.4-zip php7.4-bz2 libapache2-mod-php7.4 -y
- Next, install the MySQL server and client using the command
apt install mysql-server mysql-client -y. During the installation you have to set a password for the MySQL user "root".
- Go to the directory where phpMyAdmin will be installed using the command
- To download phpMyAdmin, execute the command
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -O phpmyadmin.zip.
- Then unzip the archive you just downloaded by executing this command:
- Remove the downloaded archive, which is already unzipped, with the command
- Now you have to rename the directory to "phpmyadmin". Use this command:
mv phpMyAdmin-*-all-languages phpmyadmin
- After that, assign the required permissions to the phpMyAdmin directory using the command
chmod -R 0755 phpmyadmin.
- Now create an Apache2 configuration file for phpMyAdmin by executing the command
- Add the following content to this configuration file:
# phpMyAdmin Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin
# Disallow web access to directories that don't need it
Require all denied
Require all denied
Require all denied
- Save your changes to the configuration by pressing CTRL + X, then hit the "Y" key followed by enter.
- Activate the Apache2 configuration file you just added with the command
a2enconf phpmyadminand then execute the command
systemctl reload apache2to reload the Apache2 web server.
- Create the temporary directory that phpMyAdmin needs by running the command
- Now assign the required owner permissions for this temporary directory to the web server user with the command
chown -R www-data:www-data /usr/share/phpmyadmin/tmp/.
- Your Apache2 web server including PHP 7.4, the MySQL server and phpMyAdmin is now ready to use. By default, the web directory is "/var/www/html/". You can access the phpMyAdmin web interface in your web browser by appending "/phpmyadmin" to the IP address or domain of your server. There you can log in with the MySQL username "root" and the password you chose during the MySQL server installation.