Created
March 9, 2020 10:39
-
-
Save LinuxDevOpsGirl/624dd482f751d82ed67b8009080a07ad to your computer and use it in GitHub Desktop.
LAMP Stack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What is a LAMP Stack? | |
Lamp Stack is a renowned web development platform commonly used to run dynamic websites. Lamp Stack's main specialty is that it consists of Linux, Apache, MySQL, and PHP/Python/Perl. Usually Lamp Stack is selected for the construction and development of high performance website owing the strong foundation it has. | |
# Step 0: Before we install the LAMP stack, it’s a good idea to update repository and software packages: | |
sudo apt update | |
sudo apt upgrade | |
############## APACHE ############## | |
# Install Apache from the Ubuntu repository | |
sudo apt install apache2 | |
# Some Basic apache commands | |
# version check | |
apache2 -v | |
# status Check | |
systemctl status apache2 | |
# start apache | |
systemctl start apache2.service | |
# stop apache | |
systemctl stop apache2.service | |
# restart apache | |
systemctl restart apache2.service | |
# visit apache localhost | |
firefox http://localhost/ | |
# Enable the firewall to allow web traffic | |
#To view UFW firewall application profile list: | |
sudo ufw app list | |
#Check the ports that are enabled for Apache Full Profile: | |
sudo ufw app info "Apache Full" | |
#Ports 80 and 443 should be listed as enabled. | |
#To allow incoming HTTP and HTTPS traffic for Apache Full profile: | |
sudo ufw allow in "Apache Full" | |
############## MYSQL ############## | |
# Step 2: Install the mysql-server package: | |
sudo apt install mysql-server | |
sudo mysql_secure_installation | |
#Basic MySql Commands | |
mysql --version | |
service mysql start | |
service mysql stop | |
service mysql restart | |
# Access MySql From Terminal | |
sudo mysql -u USERNAME -p | |
# Show Database List | |
show databases; | |
# create new user | |
CREATE USER 'newusername'@'localhost' IDENTIFIED BY 'user_password'; | |
# Create Database | |
CREATE DATABASE databasename; | |
#Grant all database permission to that user | |
GRANT ALL PRIVILEGES ON *.* TO 'newusername'@'localhost'; | |
############## PHP ############## | |
# Step 3: Install PHP and additional support libraries | |
# Install PHP, PHP Extension and Application Repository, Apache support,and MySQL support | |
sudo apt install php libapache2-mod-php php-mysql | |
# Install PhpMyAdmin | |
sudo apt install phpmyadmin php-mbstring php-gettext | |
# PHP Version Check | |
php --version | |
# Open apache2.conf file with any text editor like nano, gedit, nano etc | |
sudo nano /etc/apache2/apache2.conf | |
# Then add the following line to the end of the file and save that file | |
# Include /etc/phpmyadmin/apache.conf | |
# Then restart apache: | |
sudo service apache2 restart | |
# Visit phpmyadmin page | |
firefox http://localhost/phpmyadmin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment