Created
November 8, 2020 04:37
-
-
Save lablnet/c3b11e43dd92b5d9f2c498c0c072a871 to your computer and use it in GitHub Desktop.
A simple bash script to install lamp-stack (Apache, Mysql and PHP) on your Linux Debian based system
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
| #!/bin/bash | |
| echo ".....Let's Install Lamp Stack (Apache, MySql and PHP)....." | |
| echo "Installing in progress step 1 of 4" | |
| echo "Updating the repo..." | |
| sudo apt -y update | |
| clear | |
| echo "Installing in progress step 2 of 4" | |
| sudo apt install -y apache2 | |
| clear | |
| echo "Adjusting Firewall" | |
| sudo ufw allow in "Apache Full" | |
| sudo ufw reload | |
| clear | |
| echo "Allowing apache to start on boot up" | |
| # Allow to run Apache on boot up | |
| sudo systemctl enable apache2 | |
| clear | |
| echo "Installing in progress step 3 of 4" | |
| echo "Installing MySql" | |
| sudo apt install -y mysql-server | |
| clear | |
| echo "Installing in progress step 4 of 4" | |
| echo "Installing PHP" | |
| sudo apt install -y php libapache2-mod-php php-mysql | |
| clear | |
| # Allow Read/Write for Owner | |
| sudo chmod -R 0755 /var/www/html/ | |
| clear | |
| # Create info.php for testing php processing | |
| sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php | |
| clear | |
| # Open localhost in the default browser | |
| xdg-open "http://localhost" | |
| xdg-open "http://localhost/info.php" | |
| clear | |
| echo "All Done" | |
| echo "You can secure your mysql by entering following command" | |
| echo "sudo mysql_secure_installation" | |
| echo "Bye" | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just setup a new VM so adjusted your nice script a little bit (not that has a relevance in 2025 with AI as our assist :-)))
#!/bin/bash
echo ".....Let's Install Lamp Stack++ (Apache, MySql, PHP, phpmyadmin)....."
echo "Installing in progress step 1 of 6"
echo "Updating the repo..."
sudo apt -y update
clear
echo "... progress step 2 of 6"
echo "Installing Apache Webserver"
sudo apt install -y apache2 apache2-doc
clear
echo "... progress step 3 of 6"
echo "Installing minimal protection with fail2ban"
apt install -y fail2ban
echo "Adjusting Firewall"
sudo ufw allow in "Apache Full"
sudo ufw reload
clear
echo "Allowing apache to start on boot up"
Allow to run Apache on boot up
sudo systemctl enable apache2
clear
echo "... in progress step 4 of 6"
echo "Installing MySql/MariaDB"
sudo apt install -y mariadb-server mariadb-client mariadb-common
clear
echo "Almost last step in progress 5 of 6"
echo "Installing PHP"
sudo apt install -y php php-mysql python3 libapache2-mod-python libapache2-mod-php perl libapache2-mod-perl2
clear
clear
echo "Final step 6 of 6"
echo "Installing phpmyadmin"
sudo apt install -y phpmyadmin
clear
Allow Read/Write for Owner
sudo chmod -R 0755 /var/www/html/
clear
Create info.php for testing php processing
sudo echo "" > /var/www/html/info.php
clear
echo "Its all Done"
echo "You can secure your mysql by entering following command"
echo "sudo mysql_secure_installation"
echo "Have Fun :)"
exit