-
Notifications
You must be signed in to change notification settings - Fork 61
/
OCSAutoScrptz.sh
216 lines (188 loc) · 7.2 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/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/Clrkz/VPSAutoScrptz/master"
else
source="https://raw.githubusercontent.com/Clrkz/VPSAutoScrptz/master"
fi
# go to root
cd
MYIP=$(wget -qO- ipv4.icanhazip.com);
: '
# check registered ip
wget -q -O daftarip http://188.166.215.119:85/ocs/ip.txt
if ! grep -w -q $MYIP daftarip; then
echo "Sorry, only registered IPs can use this script!"
if [[ $vps = "vps" ]]; then
echo "Powered by Clrkz"
else
echo "Powered by Clrkz"
fi
rm -f /root/daftarip
exit
fi
'
#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 baru: " -e -i clrkz 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 " # ### ### /"' >> .bashrc
echo 'echo -e " / /### / ### #/"' >> .bashrc
echo 'echo -e " / / ###/ ## ##"' >> .bashrc
echo 'echo -e " / ## ## ## ##"' >> .bashrc
echo 'echo -e " / ### ## ##"' >> .bashrc
echo 'echo -e "## ## ## ### /### ## /## ######"' >> .bashrc
echo 'echo -e "## ## ## ###/ #### / ## / ### /#######"' >> .bashrc
echo 'echo -e "## ## ## ## ###/ ##/ / / ##"' >> .bashrc
echo 'echo -e "## ## ## ## ## / /"' >> .bashrc
echo 'echo -e "## ## ## ## ## / /"' >> .bashrc
echo 'echo -e " ## ## ## ## ## ## ###"' >> .bashrc
echo 'echo -e " ## # / ## ## ###### ###"' >> .bashrc
echo 'echo -e " ### / ## ## ## ### ###"' >> .bashrc
echo 'echo -e " ######/ ### / ### ## ### / ##"' >> .bashrc
echo 'echo -e " ### ##/ ### ## ##/ ##"' >> .bashrc
echo 'echo -e " /"' >> .bashrc
echo 'echo -e " /"' >> .bashrc
echo 'echo -e " /"' >> .bashrc
echo 'echo -e " /"' >> .bashrc
echo 'echo -e "welcome to the server $HOSTNAME" | lolcat' >> .bashrc
echo 'echo -e "Script mod by Clrkz"' >> .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
wget $source/OCS.zip
unzip OCS.zip
rm -f OCS.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:85/ 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 "- Password Baru: 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:85" | tee -a log-install.txt
echo "" | tee -a log-install.txt
echo "Auto Script Installer OCS Panels Mod by Clrkz" | tee -a log-install.txt
echo " (http://bytehax.blogspot.com/ - fb.com/143Clarkz) " | 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