10-10-2020, 10:28 AM
#LAMP is a combination of operating system and open-source software stack. The acronym LAMP came from the first letters of Linux, Apache HTTP Server, MysqL or MariaDB database, and PHP/Perl/Python.
############################# Install apache ####################################
# Apache is an open-source multi-platform web server. It provides a full range of web server
# Install Apache
sudo apt-get install apache2
#Enable and start your apache
sudo systemctl enable apache2
sudo systemctl start apache2
sudo systemctl status apache2
#Test apache
#Open your web browser and navigate to http://localhost/ or http://server-ip-address/.
############################# Install MySQL #######################################
sudo apt-get update
sudo apt-get install mysql-server
#Remeber mysql server automatic configure default port 3306.
sudo mysql_secure_installation
#Here mysql asks some few questions for configuration, give (yes/no) answers according your requirement.
#Check status of mysql
sudo systemctl status mysqld
sudo systemctl enable mysqld
#Access mysql
mysql -u root -p
#Enter a Password of you set for root at installation time.
#Quit/Exit mysql
mysql>exit
####################### Install PHP ##############################
#Install PHP with following command:
sudo apt-get update
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
#In most cases, we'll want to modify the way that Apache serves files when a directory is requested. Currently, if a user requests a directory from the server, Apache will first look for a file called index.html. We want to tell our web server to prefer PHP files, so we'll make Apache look for an index.php file first.
#To do this, type this command to open the dir.conf file in a text editor with root privileges:
sudo vim /etc/apache2/mods-enabled/dir.conf
#Erase all data and paste below Code:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
#Test your php version
php -v
#To test PHP, create a sample “testphp.php” file in Apache document root folder.
sudo vim /var/www/html/testphp.php
#Add the following lines:
<?php
phpinfo();
?>
#Restart apache2 service.
sudo systemctl restart apache2
#Navigate to http://server-ip-address/testphp.php. It will display all the details about php such as version, build date and commands etc.
############################ Install phpMyAdmin #############################
#phpMyAdmin is a free open-source web interface tool used to manage your MySQL databases. It is available in the Official Debian repositories. So install it with command:
sudo apt-get install phpmyadmin
#Select the Web server that should be automatically configured to run phpMyAdmin. In my case, it is apache2.
#The phpMyAdmin must have a database installed and configured before it can be used. This can be optionally handled by dbconfig-common.
#Select ‘Yes’ to configure database for phpmyadmin wjth dbconfig-common.
#Enter password of the database’s administrative user.
#Enter MySQL application password for phpmyadmin:
#Re-enter password:
#Success! phpMyAdmin installation is installed.
#Configure phpMyAdmin
#Include PHPMyAdmin to Apache.
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
#Restart apache service:
sudo systemctl restart apache2
#Access phpMyAdmin Web Console
#Now, you can access the phpmyadmin console by navigating to http://localhost/phpmyadmin/ from your browser.
############################# Install apache ####################################
# Apache is an open-source multi-platform web server. It provides a full range of web server
# Install Apache
sudo apt-get install apache2
#Enable and start your apache
sudo systemctl enable apache2
sudo systemctl start apache2
sudo systemctl status apache2
#Test apache
#Open your web browser and navigate to http://localhost/ or http://server-ip-address/.
############################# Install MySQL #######################################
sudo apt-get update
sudo apt-get install mysql-server
#Remeber mysql server automatic configure default port 3306.
sudo mysql_secure_installation
#Here mysql asks some few questions for configuration, give (yes/no) answers according your requirement.
#Check status of mysql
sudo systemctl status mysqld
sudo systemctl enable mysqld
#Access mysql
mysql -u root -p
#Enter a Password of you set for root at installation time.
#Quit/Exit mysql
mysql>exit
####################### Install PHP ##############################
#Install PHP with following command:
sudo apt-get update
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
#In most cases, we'll want to modify the way that Apache serves files when a directory is requested. Currently, if a user requests a directory from the server, Apache will first look for a file called index.html. We want to tell our web server to prefer PHP files, so we'll make Apache look for an index.php file first.
#To do this, type this command to open the dir.conf file in a text editor with root privileges:
sudo vim /etc/apache2/mods-enabled/dir.conf
#Erase all data and paste below Code:
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
#Test your php version
php -v
#To test PHP, create a sample “testphp.php” file in Apache document root folder.
sudo vim /var/www/html/testphp.php
#Add the following lines:
<?php
phpinfo();
?>
#Restart apache2 service.
sudo systemctl restart apache2
#Navigate to http://server-ip-address/testphp.php. It will display all the details about php such as version, build date and commands etc.
############################ Install phpMyAdmin #############################
#phpMyAdmin is a free open-source web interface tool used to manage your MySQL databases. It is available in the Official Debian repositories. So install it with command:
sudo apt-get install phpmyadmin
#Select the Web server that should be automatically configured to run phpMyAdmin. In my case, it is apache2.
#The phpMyAdmin must have a database installed and configured before it can be used. This can be optionally handled by dbconfig-common.
#Select ‘Yes’ to configure database for phpmyadmin wjth dbconfig-common.
#Enter password of the database’s administrative user.
#Enter MySQL application password for phpmyadmin:
#Re-enter password:
#Success! phpMyAdmin installation is installed.
#Configure phpMyAdmin
#Include PHPMyAdmin to Apache.
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
#Restart apache service:
sudo systemctl restart apache2
#Access phpMyAdmin Web Console
#Now, you can access the phpmyadmin console by navigating to http://localhost/phpmyadmin/ from your browser.