L.A.M.P
prerequisite
$ cat /proc/cpuinfo
$ sudo dpkg --configure -a
$ sudo nano /etc/hosts
$ sudo hostnamectl set-hostname new-one
$ newgrp
$ apt-get update --allow-releaseinfo-change
$ apt-get install --reinstall ca-certificates
$ apt-get upgrade -y
$ apt-get install nano wget curl perl sudo -y
$ sudo apt dist-upgrade
$ sudo apt --purge autoremove
$ sudo apt update && sudo apt upgrade
$ apt -y purge Apache2* bind* exim* ufw* firewalld*
================Install Apache==========================================
$ sudo apt -y install apache2 apache2-utils
$ apache2 -v
$ systemctl status apache2
$ systemctl reload apache2
=================PHP=====================
$ sudo apt -y install php software-properties-common
$ sudo apt -y install php-common php-mysql php-xml php-xmlrpc php-curl php-gd php-imagick php-cli php-fpm php-json php-imap php-mbstring php-opcache php-soap php-dev php-cgi php-zip php-intl php-bcmath php-pear
$ sudo apt -y install libmcrypt-dev libreadline-dev mcrypt
$ sudo apt -y install php8.2 php8.2-fpm php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-soap php8.2-zip php8.2-cgi
$ sudo apt -y install php7.4 php7.4-fpm php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc
$ sudo apt -y install php7.4-curl php7.4-gd php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring
$ sudo apt -y install php7.4-soap php7.4-zip php7.4-cgi
================MySql==========================================
$ apt install -y mariadb-server mariadb-client
$ systemctl status mariadb
$ mysql_secure_installation
$ mysql -u root -p
--Enter password:
Maria DB [(none)]>
> CREATE DATABASE rome;
> CREATE USER 'user_name'@localhost IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON *.* TO 'db_name'@localhost IDENTIFIED BY 'password';
> FLUSH PRIVILEGES;
> SHOW GRANTS FOR 'db_name'@localhost;
> SHOW DATABASES;
> Exit;
===============Setting website========================
$ mkdir -p /var/www/website
$ chmod -R 755 /var/www/website
$ nano /var/www/website/index.php
$ cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/website.conf
$ nano /etc/apache2/sites-available/website.conf
<VirtualHost *:80>
ServerName your_domain
ServerAlias www.your_domain
ServerAdmin webmaster@localhost
DocumentRoot /var/www/your_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ a2dissite 000-default.conf
$ a2ensite website.conf
$ systemctl reload apache2
$ sudo apachectl configtest
Output Syntax OK
$ systemctl reload apache2
==========Using php-fpm===========
$ sudo systemctl start php8.2-fpm
$ sudo systemctl status php8.2-fpm
$ sudo systemctl reload apache2
$ sudo chown -R www-data:www-data /var/www/website
$ sudo chmod -R 755 /var/www/website
$ nano /etc/apache2/sites-available/website.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName website.com
DocumentRoot /var/www/website
DirectoryIndex index.php index.html
<Directory /var/www/website>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
</FilesMatch>
ErrorLog ${APACHE_LOG_DIR}/site1_error.log
CustomLog ${APACHE_LOG_DIR}/site1_access.log combined
</VirtualHost>
$ sudo apachectl configtest
Output Syntax OK
$ sudo a2ensite website
$ sudo a2dissite 000-default.conf
$ sudo systemctl reload apache2
================Webmin===================
$ sudo apt -y install curl
$ curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
$ sh setup-repos.sh
$ apt -y install webmin --install-recommends
( change port: $ sudo nano -w /etc/webmin/miniserv.conf )
===============phpMyAdmin=======================
sudo apt install phpmyadmin -y
sudo dpkg --configure -a
sudo apt -y autoremove
sudo apt install phpmyadmin -y
$ sudo ln -s /usr/share/phpmyadmin/ /var/www/html/
$ cd /var/www/html/phpmyadmin
$ ls
$ sudo cp config.sample.inc.php config.inc.php
$ sudo nano config.inc.php
$cfg['blowfish_secret'] = '';
$ sudo chown -R www-data:www-data /var/www/html
$ sudo rm -rf /var/www/html/phpmyadmin/setup
http://i.p addr/phpmyadmin