Install Debian 9 with PHP 5.6 and MySQL 8

I

Due to the fact that php5.6-curl only works with libcurl3 and Debian 10 is shipped with libcurl4 with no option to downgrade lib curl, it appears you can only use Debian 9 when wanting to use the old PHP 5.6 and curl extensions.

sudo: command not found

After installation of Debian 9.11 and you try to install a package you might get the message: bash: sudo: command not found

To install sudo, run the following:

su

apt-get install sudo

Give the user the right to run sudo

usermod -aG sudo username

Log out the user to refresh the group permissions of the user

Reference: https://chewett.co.uk/blog/477/sudo-command-not-found-debian-fixed/

Install the firewall ufw on Debian

Run the package installer:

sudo apt-get install ufw

Enable the firewall

sudo ufw enable

Reference: https://www.tecmint.com/how-to-install-and-configure-ufw-firewall/

Install the Apache Web Server

Update the local package index to reflect the latest upstream changes:

sudo apt update

Install the apache2 package

sudo apt install apache2

Configure the firewall for port 80

sudo ufw allow in 'WWW Full'

On your local computer you can check ‘localhost’ in the browser to see if Apache is running.

To test the install from another computer find the IP address of the server with:

ip addr show

Reference: https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-9

Install MYSQL 8.0

MySQL 8.0 packages are available on the official MySQL Dev apt repository

sudo apt -y install wget
wget https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb

sudo apt update
sudo apt -y install mysql-server

Reference: https://computingforgeeks.com/how-to-install-mysql-8-0-on-debian/

Install PHP5.6

sudo apt update
sudo apt upgrade

sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list

sudo apt update
sudo apt install php5.6

sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-mbstring php5.6-mysqlnd php5.6-xml

Create a PHP Info page to see if it is all working.

sudo nano /var/www/html/info.php

Type in:

<?php phpinfo(); ?>

Enter ctrl+x, y and enter

In your browser go to your https://webserver/info.php

Reference: https://tecadmin.net/install-php-debian-9-stretch/

Install phpMyAdmin

sudo nano /etc/mysql/my.cnf

Add the following lines:

[mysqld]
default_authentication_plugin=mysql_native_password
collation-server=utf8_unicode_ci
character-set-server=utf8

Restart mysql server

sudo service mysql restart

Install phpmyadmin with

sudo apt install phpmyadmin php-mbstring php-gettext

Select apache2 by pressing SPACE, TAB and then enter

Configure database for phpmyadmin with dbconfig-common?

Choose no, as the installer will fail

Login to phpmyadmin with root

http://webserver/phpmyadmin

Create a new database called phpmyadmin, click on the Operations tab

Click ‘Create the phpMyAdmin configuration storage

Create an user called phpmyadmin

Choose ‘Native MySQL authentication’

For some reason after adding the user an error was generated, click on the phpmyadmin user, reenter the password and flush privileges.

Give user phpmyadmin full privileges to the database phpmyadmin

Install VSTFTPD

sudo apt update
sudo apt install vsftpd

sudo nano /etc/vsftpd.conf

Set the following in the vsftpd.conf file:

anonymous_enable=NO
local_enable=YES
local umask=022
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO

Add ufw exceptions

sudo ufw allow 20:21/tcp
sudo ufw allow 30000:31000/tcp
sudo systemctl restart vsftpd

Add the users that are allowed to access vsftpd to the vsftpd.userlist (one per line)

sudo nano /etc/vsftpd.user_list

The following is ONLY for dev environment

Add current user to group that owns /var/www/html folder

sudo usermod -a -G GROUPNAME USERNAME

Reboot system

Change group permissions to rwx

sudo chmod -R g+rwx /var/www/html

About the author

By kozel