English version was created automatically using Drupal module auto_node_translate and free DeepL translator.
Debian 10 Buster - how to install LAMP + phpMyAdmin on it
zveřejněno 2019-07-12
At the beginning of July 2019, the new Debian 10 Buster was released. Compared to the Debian 9 Strech version, more or less only the package versions have changed (PHP 7.0 -> PHP 7.3), but the installation procedure remains the same. The only major change is perhaps the removal of phpMyAdmin from the repositories, so you have to install it manually.
Most of the instructions will be very similar to those for Debian 9. The list of versions of the various packages is here https://www.debian.org/News/2019/20190706, we are mainly interested in
- Apache 2.4.38
- MariaDB 10.3
- PHP 7.3
As for phpMyAdmin, I found this update on the project website: phpmyadmin REMOVED from testing https://tracker.debian.org/news/1021625/phpmyadmin-removed-from-testing/
Perhaps compared to the previous tutorial, I would now start with the SQL database. Of course, after the system upgrade:
apt update & sudo apt -y upgrade
MySQL / MariaDB
Nothing to worry about:
apt install -y mariadb-server mariadb-client
Remember that the root user is authenticated by unix_socket, not by password. I recommend not to change this, some other packages may take this into account.
So you need to create another SQL user with admin rights:
CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO 'phpmyadmin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Apache2
So everything is the same as before:
apt install -y apache2 apache2-utils
Plus necessary modules like ssl, rewrite, expires, http2 ...
PHP
My PHP installation includes
apt install php php-common
Back, for H2 to work properly, you need to use PHP FPM - in addition to the SSL certificate
apt install php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
apachectl stop
a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
a2dismod php7.3
a2dismod mpm_prefork
a2enmod mpm_event
apachectl start
One more thing, I'm going to set up my cs_CZ.UTF-8 support right away using pkg-reconfigure locales. It's useful for localized listings, e.g. strftime().
phpMyAdmin
phpMyAdmin didn't fit in the Debian 10 installation, so if we want to keep using it, we have to take care of it manually. Since security updates for it come out quite frequently (https://www.phpmyadmin.net/news/), we need to take care of security as well. Few people have time to keep track of new releases, and then upload them all over the place. Not to mention that a new release may be incompatible in some ways. So my recommendation is this:
- At the very least, reconfigure the default URL
- to further increase security, require authentication (https://httpd.apache.org/docs/2.4/howto/auth.html)
And now the actual instructions:
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-english.tar.gz
tar xzf phpMyAdmin*.tar.gz
rm phpMyAdmin*.tar.gz
mv phpMyAdmin-* /usr/share/phpmyadmin
mkdir -p /var/lib/phpmyadmin/tmp
chown -R www-data:www-data /var/lib/phpmyadmin
mkdir /etc/phpmyadmin/
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
vi /usr/share/phpmyadmin/config.inc.php
And edit/add the following in /usr/share/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = 'H2OxcGXAAlSd8JwrwVlh6KW6s2r11111';
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';
$cfg['NavigationTreeEnableGrouping'] = false;
Then create a MySQL database
mysql -e "CREATE DATABASE phpmyadmin;"
mysql phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql
The last step is to create a configuration file for Apache /etc/apache2/conf-enabled/phpmyadmin.conf A sample file is available for download. As I said, I recommend setting the Alias entry to something harder to guess.
And finally, of course, restart Apache.
Conclusion
Installing LAMP is not difficult, but there are still a few things to keep in mind to ensure optimal performance.