forked from emilas44/laravel-5.4-on-Ubuntu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.sh
executable file
·122 lines (94 loc) · 3.29 KB
/
script.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
##################################################################
#!/bin/bash
# update the sources
sudo apt update
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::updated apt repos"
sleep 2
# install zip & git
sudo apt -y install zip git
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed ZIP-GIT"
sleep 2
# install apache
sudo apt -y install apache2 phpmyadmin
echo 'Include /etc/phpmyadmin/apache.conf' >> /etc/apache2/apache2.conf
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed APACHE"
sleep 2
# install php and needed mods
sudo apt install -y curl php
sudo apt install -y php-mysql php-fpm php-curl php-gd php7.0-mcrypt php-mbstring php-gettext php-token-stream php-zip
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed PHP7"
sleep 2
# enable the mods for laravel
sudo phpenmod mcrypt mbstring curl gettext
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::enabled PHP mods"
sleep 2
# install mysql
sudo apt -y install mysql-server
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed mysql-server"
sleep 2
# disable cgi scripting -security reasons
sudo -- sh -c "echo 'cgi.fix_pathinfo=0' >> /etc/php/7.0/fpm/php.ini"
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::disabled cgi scripting -security reasons"
sleep 2
# restart to apply changes
sudo systemctl restart php7.0-fpm
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::restarted PHP"
sleep 2
# restart apache
sudo service apache2 restart
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::restarted APACHE"
sleep 2
# do a secure mysql installation
sudo mysql_secure_installation <<EOF
password
n
y
y
y
y
y
EOF
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mysql secure installed 1/2"
sleep 2
# do a secure mysql installation
sudo mysql_secure_installation <<EOF
password
n
y
y
y
y
y
EOF
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mysql secure installed 1/2"
sleep 2
mysql -u root -ppassword << EOF
UPDATE mysql.user SET authentication_string=PASSWORD("password") where user='root';
DROP USER IF EXISTS ''@'localhost';
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
FLUSH PRIVILEGES;
EOF
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::mysql secure installed 2/2"
sleep 2
sudo apt install -y git
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed git"
sleep 2
# install redis
sudo apt install -y redis-server
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed redis"
sleep 2
#install composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed composer"
sleep 2
# install laravel installer
composer global require "laravel/installer"
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::installed laravel installer"
sleep 2
# clean unnecesary files from apt-get
sudo apt-get clean
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::cleaned apt-files"
sleep 2
echo ":::::::::::::::::::::::::::: INSTALLATION COMPLETED! ::::::::::::::::::::::::::::::::"