-
Notifications
You must be signed in to change notification settings - Fork 9
/
nZEDb-3.sh
211 lines (195 loc) · 6.71 KB
/
nZEDb-3.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
#!/bin/bash
# Script Name: nZEDb Setup - Part 3
# Author: Jorge Pabon - PREngineer - [email protected]
# License: Personal Use (1 device)
# IMPORTANT: RUN THIS SCRIPT LAST!
# ONLY AFTER SETTING UP NZEDB THROUGH THE
# ADMIN WEB PORTAL:
# http://<YOURIP>/admin/
# This contains the IRCScraper and ZNC as well
# as PhpMyAdmin among other things.
###############################################
# Color definition variables
YELLOW='\e[33;3m'
RED='\e[91m'
BLACK='\033[0m'
CYAN='\e[96m'
GREEN='\e[92m'
# Make sure to clear the Terminal
clear
# Display the Title Information
echo
echo -e $RED
echo -e " nZEDb"
echo -e "╦╔╗╔╔═╗╔╦╗╔═╗╦ ╦ ╔═╗╦═╗"
echo -e "║║║║╚═╗ ║ ╠═╣║ ║ ║╣ ╠╦╝"
echo -e "╩╝╚╝╚═╝ ╩ ╩ ╩╩═╝╩═╝╚═╝╩╚═"
echo -e $CYAN
echo -e "Brought to you by PREngineer"
echo
echo -e $GREEN'nZEDb Server Setup - Part 3'$BLACK
echo
echo -e $RED'1. This script has been tested on Ubuntu (Server & Desktop).'
echo -e '2. The author(s) cannot be held accountable for any problems that might occur if you run this script.'
echo -e '3. Proceed only if you authorize this script to make changes to your system.'$BLACK
echo
echo -e $YELLOW
echo -e "---> [Importing Initial PreDB Dump...]"$BLACK
sudo wget https://www.dropbox.com/s/qkmgbvmdv9a5w8q/predb_dump_08172015.tar.gz
sudo gunzip predb_dump_08172015.tar.gz
sudo tar -xvf predb_dump_08172015.tar
echo
echo -e $RED"PLEASE BE PATIENT! THIS + W I L L + TAKE A LONG TIME!"$BLACK
echo
sudo php /var/www/nzedb/misc/testing/PreDB/dump_predb.php remote tmp/predb_dump_08172015.csv
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Importing Daily Dumps...]"$BLACK
sudo chmod 777 /var/www/nzedb/resources
sudo chown -R YOUR_USERNAME:www-data /var/www/nzedb/cli
echo
echo -e $RED"PLEASE BE PATIENT! THIS + M A Y + TAKE A LONG TIME!"$BLACK
echo
sudo php /var/www/nzedb/cli/data/predb_import_daily_batch.php 0 remote true
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Install ZNC...]"$BLACK
sudo apt-get install python-software-properties -y
sudo apt-get install libssl-dev libperl-dev pkg-config build-essential -y > /dev/null
cd ~
sudo wget http://znc.in/releases/archive/znc-1.2.tar.gz
sudo tar -xvf znc-1.2.tar.gz
cd znc-1.2
./configure
sudo make
sudo make install
sudo rm -R ~/znc*
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Installing ZNC...]"$RED
echo
echo -e "You will be prompted for these settings."
echo
echo -e "-------------Server Settings------------"
echo -e "Port: 6666"
echo -e "SSL: [ENTER]"
echo -e "IPV6: No"
echo -e "-------------Global Modules-------------"
echo -e "Partyline: Yes"
echo -e "webadmin: Yes"
echo -e "Username: Nick1"
echo -e "Password: SOMEPASSWORD"
echo -e "Password: SOMEPASSWORD"
echo -e "Admin: Yes"
echo -e "Nick: Nick1"
echo -e "Alt Nick: Nick2"
echo -e "Ident: [ENTER]"
echo -e "Real Name: Nick1"
echo -e "Bind host: [ENTER]"
echo -e "# of Lines: 100"
echo -e "clear buffer: [ENTER]"
echo -e "Chan Mode: [ENTER]"
echo -e "-------------User Modules----------------"
echo -e "Chansaver: Yes"
echo -e "Controlpanel: Yes"
echo -e "Perform: Yes"
echo -e "Webadmin: Yes"
echo -e "Setup Net: Yes"
echo -e "Name: synirc"
echo -e "-------------Network Modules-------------"
echo -e "Chansaver: Yes"
echo -e "Keepnick: Yes"
echo -e "KicjRejoin: Yes"
echo -e "Nickserv: Yes"
echo -e "Perform: Yes"
echo -e "Simple_Away: Yes"
echo -e "-----------------SERVERS-----------------"
echo -e "Server host: toronto.on.ca.synirc.net"
echo -e "Server SSL: no"
echo -e "Server Port: 6697"
echo -e "Server Pass: [ENTER]"
echo -e "Init, Chann: #nZEDbPRE"
echo
echo -e "-------------Add Servers:-------------"
echo -e "SERVER 1: toronto.on.ca.synirc.net"
echo -e "PORT: 6697"
echo -e "PASSWORD: [ENTER]"
echo -e "SSL: [ENTER]"
echo -e "Another?: Yes"
echo -e "--------------------------------------"
echo -e "SERVER 2: monster.va.us.synirc.net"
echo -e "PORT: 6667"
echo -e "PASSWORD: [ENTER]"
echo -e "SSL: [ENTER]"
echo -e "Another?: Yes"
echo -e "--------------------------------------"
echo -e "SERVER 3: avarice.wa.us.synirc.net"
echo -e "PORT: 6697"
echo -e "PASSWORD: [ENTER]"
echo -e "SSL: [ENTER]"
echo -e "Another?: [ENTER]"
echo -e "-------------CHANNELS-----------------"
echo -e "Add Channel: Yes"
echo -e "Channel Name: #nZEDbPRE"
echo -e "Add Another: No"
echo -e "Another Net: No"
echo -e "Another User: No"
echo -e "----------------------------------------------"
echo
echo -e $CYAN"Launch ZNC now: Yes"$RED
echo
echo -e "###########################################################"
echo -e "#I SUGGEST YOU COPY THIS INFORMATION IN YOUR NOTEPAD! E^.^3"
echo -e "###########################################################"
echo -e ""$BLACK
read -p "Press [Enter] to continue..."
znc --makeconf
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Running ZNC on startup...]"$BLACK
(crontab -l 2>/dev/null; echo "@reboot /bin/sleep 10; /usr/local/bin/znc >/dev/null 2>&1") | crontab -
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Setting Up IRC Scraper...]"$BLACK
echo -e "Fill the next blank screen with:"
echo -e "--------------------------------------"
echo -e "username = NICK1"
echo -e "SCRAPE_IRC_SERVER = 127.0.0.1"
echo -e "SCRAPE_IRC_PORT = 6666"
echo -e "SCRAPE_IRC_TLS = false"
echo -e "define('SCRAPE_IRC_PASSWORD', 'password');"
echo -e "--------------------------------------"
echo -e $RED"After this, enable IRCScraper in the Page"
echo -e "http://IP/admin/tmux-edit.php"$BLACK
echo -e "--------------------------------------"
sudo cp /var/www/nzedb/nzedb/config/ircscraper_settings_example.php /var/www/nzedb/nzedb/config/ircscraper_settings.php
sudo nano /var/www/nzedb/nzedb/config/ircscraper_settings.php
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Installing TMUX...]"$BLACK
sudo apt-get install -y tmux time python-setuptools python-pip python3-setuptools python3-pip > /dev/null
sudo easy_install cymysql pynntp socketpool
sudo pip3 install cymysql pynntp socketpool
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Configuring TMUX To Run On Startup...]"$BLACK
(crontab -l 2>/dev/null; echo "@reboot /bin/sleep 10; /usr/bin/php /var/www/nzedb/misc/update/nix/tmux/start.php") | crontab -
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Installing PHPMyAdmin...]"$BLACK
sudo apt-get install -y phpmyadmin
echo -e $GREEN
echo -e "DONE!"
echo -e $YELLOW
echo -e "---> [Tunning MySQL...]"$BLACK
sudo apt-get install mysqltuner -y
echo -e $GREEN
echo -e "DONE!"$BLACK