/
lamp.sh
executable file
·51 lines (42 loc) · 1.3 KB
/
lamp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
if [ -z "$1" ]; then
echo "Error: No arguements given, for help run:"
echo "./lamp.sh help"
fi
#APACHE
if [ "$1" == "apache" ]; then
if [ -z "$2" ]; then
echo "Error: Pass IP or domain in args"
else
sudo apt-get update
sudo apt-get install apache2
sudo apache2ctl configtest
#Change server_domain_or_IP and uncomment below line
sudo sed -e "\$aServerName $2" /etc/apache2/apache2.conf >> /etc/apache2/apache2.conf
sudo ufw app info "Apache Full"
sudo apache2ctl configtest
sudo systemctl restart apache2
fi
fi
#mysql
if [ "$1" == "mysql" ]; then
echo "MYSQL INSTALLATION"
sudo apt-get install php-mysql
sudo apt-get install mysql-server
sudo apt-get install php libapache2-mod-php php-mcrypt
fi
#PHP
if [ "$1" == "php" ]; then
sudo rm /etc/apache2/mods-enabled/dir.conf
printf "<IfModule mod_dir.c>\n DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm\n</IfModule>\n" >> /etc/apache2/mods-enabled/dir.conf
systemctl status apache2.service
sudo systemctl restart apache2
sudo apt-get install curl php-cli
fi
if [ "$1" == "help" ]; then
echo "To install Apache run: "
echo "./lamp.sh apache {your IP or domain name}"
echo "To install Mysql run: "
echo "./lamp.sh mysql"
echo "To install PHP run: "
echo "./lamp.sh php"
fi