- Guide created using Debian 11
- If you don't have
apt
package manager maybe you have one of this package managers - If you have any suggestions create an Issue :D
sudo apt update && sudo apt upgrade -y
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
sudo add-apt-repository ppa:ondrej/php
sudo apt update
You can replace with any other version of PHP, for example php5.6
sudo apt install php8.1 -y
php --version
sudo apt install php8.1-{bcmath,xml,fpm,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi} -y
All changes are in php.ini
file. If you want set changes for CLI you need to update .ini
file from /etc/php/8.1/cli/
directory. But if you want changes for websites you need to change .ini
file from /etc/php/8.1/apache2/
directory
sudo nano /etc/php/8.1/cli/php.ini
After changing in apache2
directory you must ALWAYS restart Apache2 server
sudo systemctl restart apache2
In nano
you can go to specific line using CTRL + SHIFT + - , typing line number and pressing ENTER
post_max_size = 16M # Line 698
upload_max_filesize = 16M # Line 850
memory_limit = 256M # Line 430
sudo apt update && sudo apt upgrade -y
Replace php8.1
with yours PHP version
sudo apt install wget php8.1-cli php8.1-zip unzip -y
wget -O composer-setup.php https://getcomposer.org/installer
You can change installation directory by changing /usr/local/bin
in --install-dir=
parameter
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
sudo composer self-update
sudo composer --version
Installation and basic configuration of MySQL and MySQL server
sudo apt update && sudo apt upgrade -y
sudo apt install gnupg wget -y
You can download another version of MySQL form here
# Example link, you put your link after wget
wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
Run your dpkg package with the -i
flag, that indicates that you’d like to install from the specified file and *
char depends all files that's name start from mysql-apt-config
sudo dpkg -i mysql-apt-config*
When you see screen with MySQL and MySQL tools select menu, select mysql-8 and press ENTER, press TAB and ENTER.
sudo apt update
sudo apt install mysql-server -y
During installation, you must set root account password and select authentication plugin. I recommend Strong password encryption
sudo mysql --version
sudo mysql_secure_installation
During installation, you need to configure the password validation level, choose whether you want to change the root password (if set), delete anonymous users or not, prohibit remote root login, delete the test database and reload the permissions.
I recommend: 2, No (if set), Yes, Yes, Yes, Yes
sudo apt update && sudo apt upgrade -y
Change php8.1
to your version, for example php5.6
sudo apt install wget php8.1 php8.1-cgi php8.1-mysqli php8.1-mbstring libapache2-mod-php php8.1-common php8.1-mysql phpmyadmin -y
During installation, you need to select phpMyAdmin type (Apache or lighthttpd). Press SPACE to select, TAB and ENTER. Next you must set up password to phpMyAdmin user and confirm it with root password (Set up in MySQL section)
cd /usr/share
sudo mv phpmyadmin/ phpmyadminold/
Go to phpMyAdmin version list, select wanted version and copy link.
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.zip
sudo unzip phpMyAdmin*
sudo cp -r phpMyAdmin-5.2.0-all-languages phpmyadmin
# Optionally you can remove old directory
sudo rm -rf phpmyadminold
sudo mkdir /usr/share/phpmyadmin/tmp
sudo chmod -R 777 /usr/share/phpmyadmin/tmp
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
sudo nano /usr/share/phpmyadmin/config.inc.php
Go to line 16 (Press CTRL + SHIFT + -, type 16
and press ENTER) and set up variable (Must be 32 characters long!)
$cfg['blowfish_secret'] = '11112222333344445555666677778888'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
You need to rename all domain.com
with yours domain name
The -p
flag create a /websites
folder if you don't have it
sudo mkdir -p /websites/domain.com
sudo nano /etc/apache2/sites-available/domain.com.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /websites/domain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /websites/domain.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# SSL certificate, from HTTP to HTTPS
RewriteEngine on
RewriteCond %{SERVER_NAME} =domain.com [OR]
RewriteCond %{SERVER_NAME} =www.domain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
sudo systemctl restart apache2
sudo a2ensite domain.com.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
If you want host something on default host (000-deafult.conf
) - for example: RoundCube - you need to set <Directory>
tag in this Virtual Host like this:
sudo nano /etc/apache2/sites-available/000-default.conf
And under CustomLog ${APACHE_LOG_DIR}/access.log combined
line you must put this lines
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo apt update && sudo apt upgrade -y
sudo apt install snapd -y
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
You need to replace all domain.com
with your domain name and [email protected]
with your email address
You need to add new certificate for all subdomains!
sudo certbot --apache --agree-tos --redirect -m [email protected] -d domain.com -d www.domain.com
If this is your first certificate on machine you need to agree wih TOS - type Y
and press ENTER
sudo apt update && sudo apt upgrade -y
sudo apt install git -y
sudo git --version
sudo ssh-keygen -t rsa
sudo cat /root/.ssh/id_rsa.pub
Replace 16.x
with wanted version of NodeJS
curl -s https://deb.nodesource.com/setup_16.x | sudo bash
sudo apt install nodejs -y
sudo node -v
sudo npm install -g @angular/cli
sudo ng version
sudo apt update && sudo apt upgrade -y
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev -y
You can select another version from here
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
sudo tar -xvf Python-3.10.0.tgz
cd Python-3.10.0
sudo ./configure --enable-optimizations
sudo make -j 2
sudo make altinstall
sudo python3.10 --version
sudo apt install python3-venv python3-pip -y
sudo pip3 install --upgrade pip
You need to change /usr/local/bin/python3.10
to path to Python version that you want to set as default.
1
number is a priority. 1
is the highest.
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 1
apt update && apt upgrade -y
apt install sudo -y
apt update && apt upgrade -y
sudo apt install firefox-esr -y
apt update && apt upgrade -y
wget https://github.com/mozilla/geckodriver/releases/download/v0.32.0/geckodriver-v0.32.0-linux64.tar.gz
sudo tar -xvzf geckodriver-v0.32.0-linux64.tar.gz
sudo chmod +x geckodriver