-
Notifications
You must be signed in to change notification settings - Fork 3
/
OCSAutoScrptz.sh
189 lines (161 loc) · 5.71 KB
/
OCSAutoScrptz.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
if [ $USER != 'root' ]; then
echo "You must run this as root"
exit
fi
# initialisasi var
export DEBIAN_FRONTEND=noninteractive
OS=`uname -m`;
if [[ -e /etc/debian_version ]]; then
#OS=debian
RCLOCAL='/etc/rc.local'
else
echo "You are not running this script on Debian OS"
exit
fi
vps="vps";
if [[ $vps = "vps" ]]; then
source="https://raw.githubusercontent.com/PHC-Basagulero19/basagautoscripts/master"
else
source="https://raw.githubusercontent.com/PHC-Basagulero19/basagautoscripts/master"
fi
# go to root
cd
MYIP=$(wget -qO- ipv4.icanhazip.com)
#https://github.com/adenvt/OcsPanels/wiki/tutor-debian
clear
echo ""
echo "I need to ask some questions before starting setup"
echo "You can leave the default option and just hit enter if you agree with the option"
echo ""
echo "First I need to know the new password of MySQL root user:"
read -p "Password: " -e -i basagulero DatabasePass
echo ""
echo "Finally, name the Database Name for OCS Panels"
echo " Please, use one word only, no special characters other than Underscore (_)"
read -p " Database Name: " -e -i OCS_PANEL DatabaseName
echo ""
echo "Okay, that's all I need. We are ready to setup your OCS Panels now"
read -n1 -r -p "Press any key to continue..."
#apt-get update
apt-get update -y
apt-get install build-essential expect -y
echo "clear" >> .bashrc
echo 'echo -e " B "' >> .bashrc
echo 'echo -e " A "' >> .bashrc
echo 'echo -e " S "' >> .bashrc
echo 'echo -e " A "' >> .bashrc
echo 'echo -e " G "' >> .bashrc
echo 'echo -e "welcome to the server $HOSTNAME" | lolcat' >> .bashrc
echo 'echo -e "Script mod by Basagulero"' >> .bashrc
echo 'echo -e "Type menu to display a list of commands"' >> .bashrc
echo 'echo -e ""' >> .bashrc
apt-get install -y mysql-server
#mysql_secure_installation
so1=$(expect -c "
spawn mysql_secure_installation; sleep 3
expect \"\"; sleep 3; send \"\r\"
expect \"\"; sleep 3; send \"Y\r\"
expect \"\"; sleep 3; send \"$DatabasePass\r\"
expect \"\"; sleep 3; send \"$DatabasePass\r\"
expect \"\"; sleep 3; send \"Y\r\"
expect \"\"; sleep 3; send \"Y\r\"
expect \"\"; sleep 3; send \"Y\r\"
expect \"\"; sleep 3; send \"Y\r\"
expect eof; ")
echo "$so1"
#\r
#Y
#pass
#pass
#Y
#Y
#Y
#Y
chown -R mysql:mysql /var/lib/mysql/
chmod -R 755 /var/lib/mysql/
apt-get -y install nginx php5 php5-fpm php5-cli php5-mysql php5-mcrypt
rm /etc/nginx/sites-enabled/default
rm /etc/nginx/sites-available/default
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup
mv /etc/nginx/conf.d/vps.conf /etc/nginx/conf.d/vps.conf.backup
wget -O /etc/nginx/nginx.conf "http://script.hostingtermurah.net/repo/blog/ocspanel-debian7/nginx.conf"
wget -O /etc/nginx/conf.d/vps.conf "http://script.hostingtermurah.net/repo/blog/ocspanel-debian7/vps.conf"
sed -i 's/cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
sed -i 's/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g' /etc/php5/fpm/pool.d/www.conf
useradd -m vps
mkdir -p /home/vps/public_html
rm /home/vps/public_html/index.html
echo "<?php phpinfo() ?>" > /home/vps/public_html/info.php
chown -R www-data:www-data /home/vps/public_html
chmod -R g+rw /home/vps/public_html service php5-fpm restart
service php5-fpm restart
service nginx restart
apt-get -y install zip unzip
cd /home/vps/public_html
cd /home/vps/public_html
wget https://raw.githubusercontent.com/PHC-Basagulero19/basagautoscripts/master/OCSPanel.zip
unzip OCSPanel.zip
rm -f OCSPanel.zip
chown -R www-data:www-data /home/vps/public_html
chmod -R g+rw /home/vps/public_html
#mysql -u root -p
so2=$(expect -c "
spawn mysql -u root -p; sleep 3
expect \"\"; sleep 3; send \"$DatabasePass\r\"
expect \"\"; sleep 3; send \"CREATE DATABASE IF NOT EXISTS $DatabaseName;EXIT;\r\"
expect eof; ")
echo "$so2"
#pass
#CREATE DATABASE IF NOT EXISTS OCS_PANEL;EXIT;
chmod 777 /home/vps/public_html/config
chmod 777 /home/vps/public_html/config/inc.php
chmod 777 /home/vps/public_html/config/route.php
apt-get -y --force-yes -f install libxml-parser-perl
clear
echo "Open Browser, access http://$MYIP/ and complete the data as below!"
echo "Database:"
echo "- Database Host: localhost"
echo "- Database Name: $DatabaseName"
echo "- Database User: root"
echo "- Database Pass: $DatabasePass"
echo ""
echo "Admin Login:"
echo "- Username: anything you want"
echo "- Enter Password: anything you want"
echo "- Re-enter New Password: as desired"
echo ""
echo "Click Install and wait for the process to finish, go back to terminal and then press [ENTER key]!"
sleep 3
echo ""
read -p "If the above step has been done, please Press [Enter] key to continue...."
echo ""
read -p "If you really believe the above step has been done, please Press [Enter] key to continue..."
echo ""
cd /root
#wget http://www.webmin.com/jcameron-key.asc
#apt-key add jcameron-key.asc
#sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
#service webmin restart
#rm -f /root/jcameron-key.asc
#rm -R /home/vps/public_html/installation
cd
rm -f /root/.bash_history && history -c
echo "unset HISTFILE" >> /etc/profile
chmod 755 /home/vps/public_html/config
chmod 644 /home/vps/public_html/config/inc.php
chmod 644 /home/vps/public_html/config/route.php
# info
clear
echo "=======================================================" | tee -a log-install.txt
echo "Please login Reseller Panel at http://$MYIP" | tee -a log-install.txt
echo "" | tee -a log-install.txt
echo "Auto Script Installer OCS Panels Mod by PHC-Basagulero19" | tee -a log-install.txt
echo " " | tee -a log-install.txt
echo "" | tee -a log-install.txt
echo "Thanks " | tee -a log-install.txt
echo "" | tee -a log-install.txt
echo "Installation Log --> /root/log-install.txt" | tee -a log-install.txt
echo "=======================================================" | tee -a log-install.txt
cd ~/
#rm -f /root/ocspanel.sh