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*
1 ================Install Apache==========================================
$ sudo apt -y install apache2 apache2-utils
$ apache2 -v
$ systemctl status apache2
$ systemctl reload apache2
2 ==========Install PHP==================
$ sudo apt -y install php software-properties-common libmcrypt-dev libreadline-dev mcrypt
$ 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
3 ================MySql==========================================
$ apt install -y mariadb-server mariadb-client
$ systemctl status mariadb
$ mariadb_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;
4 ==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 )
add adminer.php
5 ===============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
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
==========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
ServerAdmin [email protected]
ServerName website.com
DocumentRoot /var/www/website
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost"
ErrorLog ${APACHE_LOG_DIR}/site1_error.log
CustomLog ${APACHE_LOG_DIR}/site1_access.log combined
$ sudo ln -s /etc/apache2/sites-available/website1.conf /etc/apache2/sites-enabled/
$ sudo apachectl configtest
Output Syntax OK
$ sudo a2ensite website
$ sudo a2dissite 000-default.conf
$ sudo systemctl reload apache2
Posted :
Saturday 29th of August 2015 @ 03:47 PM— Tags :
apache