Project

General

Profile

NetDRMS Installation » History » Version 323

Herve Ballans, 10/06/2016 17:31

1 50 Herve Ballans
{{toc}}
2 1 Herve Ballans
3 322 Pablo Alingery
h1. NetDRMS 8.11 Installation
4 1 Herve Ballans
5 276 Herve Ballans
h2. Preliminary note
6 275 Herve Ballans
7 275 Herve Ballans
In the following sections, when there is a command line :
8 323 Herve Ballans
<pre>
9 323 Herve Ballans
#
10 323 Herve Ballans
</pre>
11 323 Herve Ballans
means that command is executed into _root_ user
12 323 Herve Ballans
<pre>
13 323 Herve Ballans
$
14 323 Herve Ballans
</pre>
15 323 Herve Ballans
means that command is executed into _production_ user
16 275 Herve Ballans
17 1 Herve Ballans
h2. Requirements
18 1 Herve Ballans
19 47 Pablo Alingery
h3. Configuring production environment
20 1 Herve Ballans
21 284 Herve Ballans
Adding user production
22 47 Pablo Alingery
23 1 Herve Ballans
<pre>
24 1 Herve Ballans
# adduser production
25 1 Herve Ballans
# addgroup ias
26 1 Herve Ballans
# adduser production ias
27 1 Herve Ballans
</pre>
28 1 Herve Ballans
29 49 Herve Ballans
h3. Configure /home/production/.profile
30 1 Herve Ballans
31 49 Herve Ballans
Adding environment variables
32 1 Herve Ballans
33 1 Herve Ballans
<pre>
34 122 Herve Ballans
#Modif Herve.B Pablo.A 12/05/2016
35 122 Herve Ballans
36 1 Herve Ballans
PATH="/usr/local/netdrms_current/bin/linux_x86_64:$PATH"
37 49 Herve Ballans
PATH="/usr/local/netdrms_current/scripts:$PATH"
38 122 Herve Ballans
PATH="/usr/local/jmd/bin:$PATH"
39 122 Herve Ballans
PATH="/usr/local/jmd/scripts:$PATH"
40 141 Pablo Alingery
#The following is not needed as installed with 'apt-get install' 
41 141 Pablo Alingery
#PATH="/usr/local/pgsql/bin:$PATH"
42 122 Herve Ballans
PATH="/usr/local/netdrms-tools/scripts:$PATH"
43 49 Herve Ballans
#2014-12-17 Avec Herve et Pablo on pense que la ligne suivante est intutile as it is f.. install in /usr/local/lib
44 140 Pablo Alingery
PATH="/usr/local/cfitsio:$PATH"
45 1 Herve Ballans
#Done
46 49 Herve Ballans
47 122 Herve Ballans
DERBY_HOME=/usr/local/jmd/databases/derby/derbyBD
48 49 Herve Ballans
export DERBY_HOME
49 49 Herve Ballans
50 49 Herve Ballans
export CVSROOT=:pserver:anonymous@solarch.tuc.noao.edu:2401/vtarc1/vso/cvsroot
51 49 Herve Ballans
</pre>
52 49 Herve Ballans
53 162 Pablo Alingery
h3. Configure /varl/lib/postgres/.profile
54 161 Pablo Alingery
55 163 Pablo Alingery
Add to $PATH so postgres can exeute command like initdb
56 161 Pablo Alingery
57 161 Pablo Alingery
<pre>
58 161 Pablo Alingery
#Modif Herve.B Pablo.A 19/05/2016
59 161 Pablo Alingery
PATH="/usr/lib/postgresql/9.4/bin:$PATH"
60 161 Pablo Alingery
</pre>
61 161 Pablo Alingery
62 125 Pablo Alingery
h3. Setting privileges for SUMS_MANAGER
63 87 Herve Ballans
64 126 Pablo Alingery
Please modify file /etc/sudoers so user 'production' will be able to execute  'sum_chown' that we will locate in the dir : /usr/local/bin . See below
65 125 Pablo Alingery
Add to /etc/sudoers the following line :
66 1 Herve Ballans
	production host=NOPASSWD:/usr/local/bin/sum_chmown
67 1 Herve Ballans
68 127 Pablo Alingery
h3. Set passwords file for db postgres 
69 1 Herve Ballans
70 127 Pablo Alingery
Please create file .pgpass with the following information for user 'production" so he will be able to connect without password as 'production' or 'postgres' to 2 db that we will create later ias_sdo and ias_sdo_sums.
71 1 Herve Ballans
72 1 Herve Ballans
73 1 Herve Ballans
.pgpass content :
74 1 Herve Ballans
<pre>
75 128 Pablo Alingery
	#hostname:5432:ias_sdo:production: 
76 128 Pablo Alingery
	#hostname:5434:ias_sdo_sums:production: 
77 128 Pablo Alingery
	#hostname:5432:ias_sdo:postgres: 
78 128 Pablo Alingery
	#hostname:5434:ias_sdo_sums:postgres
79 1 Herve Ballans
</pre>
80 128 Pablo Alingery
81 129 Pablo Alingery
where #hostname is the name of your server
82 129 Pablo Alingery
83 129 Pablo Alingery
84 131 Pablo Alingery
%{color:red}WARNING : change hostname when migrate sdo-new to sdo%
85 1 Herve Ballans
86 133 Pablo Alingery
h3. Install missing libraries 
87 1 Herve Ballans
88 293 Herve Ballans
* libreadline-dev (but already installed with postgresql)
89 293 Herve Ballans
* libssl-dev 
90 293 Herve Ballans
* libpam0g-dev 
91 293 Herve Ballans
* libperl-dev 
92 293 Herve Ballans
* libnet-ssh-perl
93 293 Herve Ballans
* libstring-shellquote-perl
94 296 Herve Ballans
* libdbi-perl 
95 296 Herve Ballans
* libdbd-pg-perl
96 1 Herve Ballans
97 133 Pablo Alingery
NB : Already done in Debian 8.4 Jessy
98 1 Herve Ballans
<pre>
99 1 Herve Ballans
# apt-get install $library_name
100 1 Herve Ballans
</pre> 
101 1 Herve Ballans
where
102 1 Herve Ballans
	_$library_name_ is the name of library
103 19 Pablo Alingery
104 1 Herve Ballans
Then to update path on libraries, please type :
105 1 Herve Ballans
<pre>
106 19 Pablo Alingery
# ldconfig
107 1 Herve Ballans
</pre>
108 1 Herve Ballans
109 1 Herve Ballans
h3. Reconfigure locale
110 1 Herve Ballans
111 1 Herve Ballans
<pre>
112 1 Herve Ballans
# dpkg-reconfigure locales
113 1 Herve Ballans
</pre>
114 1 Herve Ballans
115 1 Herve Ballans
select fr_FR.UTF8 UTF8 and unselect en_US.UTF-8
116 1 Herve Ballans
117 1 Herve Ballans
localedef -i en_US -f UTF-8 en_US.UTF-8
118 1 Herve Ballans
119 1 Herve Ballans
(see here : [[http://www.thomas-krenn.com/en/wiki/Perl_warning_Setting_locale_failed_in_Debian]])
120 1 Herve Ballans
121 134 Pablo Alingery
h3. Install gfortran packages
122 1 Herve Ballans
123 1 Herve Ballans
<pre>
124 1 Herve Ballans
# apt-get install gfortran swig
125 1 Herve Ballans
</pre>
126 1 Herve Ballans
127 1 Herve Ballans
h3. Installation of cfitsio library
128 1 Herve Ballans
129 135 Pablo Alingery
In /usr/local dir
130 135 Pablo Alingery
131 135 Pablo Alingery
Version 3.39 (currently on sdo : 3.24)
132 1 Herve Ballans
<pre>
133 135 Pablo Alingery
# wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3390.tar.gz
134 1 Herve Ballans
</pre>
135 137 Pablo Alingery
Untar and  decompression
136 1 Herve Ballans
<pre>
137 136 Pablo Alingery
# tar -xzvf cfitsio3390.tar.gz
138 1 Herve Ballans
</pre> 
139 1 Herve Ballans
140 139 Pablo Alingery
Go into /usr/local and type
141 1 Herve Ballans
142 1 Herve Ballans
su - root and :
143 1 Herve Ballans
<pre>
144 1 Herve Ballans
# ./configure --prefix=/usr/local
145 1 Herve Ballans
# make 
146 1 Herve Ballans
# make install
147 135 Pablo Alingery
</pre>
148 118 Pablo Alingery
149 237 Herve Ballans
h3. Installation des libraries libtar-dev, libcurl3-dev et libecpg-dev
150 237 Herve Ballans
151 237 Herve Ballans
<pre>
152 237 Herve Ballans
apt-get install libtar libtar-dev
153 237 Herve Ballans
</pre>
154 237 Herve Ballans
155 238 Pablo Alingery
Note, selecting 'libcurl4-openssl-dev' instead of 'libcurl3-dev'
156 238 Pablo Alingery
libcurl4-openssl-dev is already the newest version
157 237 Herve Ballans
<pre>
158 237 Herve Ballans
apt-get install libcurl3-dev
159 237 Herve Ballans
</pre>
160 237 Herve Ballans
161 237 Herve Ballans
<pre>
162 237 Herve Ballans
apt-get install libecpg-dev
163 237 Herve Ballans
</pre>
164 237 Herve Ballans
165 144 Pablo Alingery
h3. Installation of apache2 and lib perl
166 118 Pablo Alingery
167 118 Pablo Alingery
<pre>
168 118 Pablo Alingery
# apt-get install apache2
169 118 Pablo Alingery
170 118 Pablo Alingery
# apt-get install libjson-perl
171 118 Pablo Alingery
172 118 Pablo Alingery
# apt-get install libapache2-mod-perl2
173 118 Pablo Alingery
</pre>
174 1 Herve Ballans
175 183 Herve Ballans
h3. Installation of postgresql
176 1 Herve Ballans
177 145 Pablo Alingery
Into 'root'
178 145 Pablo Alingery
 
179 145 Pablo Alingery
<pre>
180 147 Pablo Alingery
apt-get install postgresql-9.4 postgresql-client-9.4 
181 145 Pablo Alingery
</pre>
182 145 Pablo Alingery
183 213 Herve Ballans
h3. Installation of python3
184 209 Pablo Alingery
185 209 Pablo Alingery
Into 'root'
186 209 Pablo Alingery
 
187 209 Pablo Alingery
<pre>
188 209 Pablo Alingery
apt-get install python3 
189 1 Herve Ballans
</pre>
190 210 Pablo Alingery
191 211 Pablo Alingery
Add some modules psycopg2 (postgres connector) and pySmartDL (Download manager) 
192 210 Pablo Alingery
193 210 Pablo Alingery
<pre>
194 210 Pablo Alingery
apt-get install python3-psycopg2
195 210 Pablo Alingery
</pre>
196 210 Pablo Alingery
197 210 Pablo Alingery
<pre>
198 210 Pablo Alingery
apt-get install python3-psycopg2
199 210 Pablo Alingery
</pre>
200 210 Pablo Alingery
201 210 Pablo Alingery
Add python3-pip for modules within python3
202 210 Pablo Alingery
203 210 Pablo Alingery
<pre>
204 210 Pablo Alingery
apt-get install python3-pip
205 1 Herve Ballans
</pre>
206 212 Pablo Alingery
207 212 Pablo Alingery
<pre>
208 212 Pablo Alingery
pip3 install pySmartDL
209 212 Pablo Alingery
</pre>
210 1 Herve Ballans
211 213 Herve Ballans
Both python2.7 and 3.4 versions are installed on the system.
212 213 Herve Ballans
By default, the python2.7 is used.
213 213 Herve Ballans
In order to change in 3.4 by default, type :
214 213 Herve Ballans
<pre>
215 213 Herve Ballans
update-alternatives --config python
216 213 Herve Ballans
</pre>
217 209 Pablo Alingery
218 1 Herve Ballans
h3. Installation of sdo_scripts
219 218 Pablo Alingery
220 219 Pablo Alingery
Install monitoring scripts for sdo
221 218 Pablo Alingery
222 218 Pablo Alingery
<pre>
223 268 Pablo Alingery
rsync -av scripts production@sdo-new:/home/production/netdrms-tools/
224 218 Pablo Alingery
</pre>
225 218 Pablo Alingery
226 1 Herve Ballans
h2. NetDRMS databases
227 1 Herve Ballans
228 156 Pablo Alingery
into /var/lib/postgresql  (hard mount point separated,  7 disks 15000 tr/min in raid5 in order to distribute read and write) 
229 1 Herve Ballans
230 1 Herve Ballans
<pre>
231 158 Pablo Alingery
# cd /var/lib/postgresql
232 157 Pablo Alingery
# mkdir data  data_sums data_monitor
233 157 Pablo Alingery
# chown -R postgres:postgres * 
234 1 Herve Ballans
</pre>
235 1 Herve Ballans
236 160 Pablo Alingery
h3. Initialize 3 servers data,  data_sums, data_monitor
237 1 Herve Ballans
238 159 Pablo Alingery
Into postgres
239 1 Herve Ballans
<pre>
240 1 Herve Ballans
# su - postgres
241 1 Herve Ballans
242 1 Herve Ballans
$ initdb --locale=C -D data -A md5 -W
243 1 Herve Ballans
(no password)
244 2 Herve Ballans
245 2 Herve Ballans
Success. You can now start the database server using:
246 2 Herve Ballans
247 2 Herve Ballans
    postgres -D data
248 2 Herve Ballans
or
249 2 Herve Ballans
    pg_ctl -D data -l logfile start
250 2 Herve Ballans
251 1 Herve Ballans
252 1 Herve Ballans
$ initdb --locale=C -D data_sums -A md5 -W
253 2 Herve Ballans
(no password)
254 2 Herve Ballans
255 2 Herve Ballans
Success. You can now start the database server using:
256 2 Herve Ballans
257 2 Herve Ballans
    postgres -D data_sums
258 2 Herve Ballans
or
259 2 Herve Ballans
    pg_ctl -D data_sums -l logfile start
260 8 Pablo Alingery
261 8 Pablo Alingery
$ initdb --locale=C -D data_monitor -A md5 -W
262 8 Pablo Alingery
(no password)
263 8 Pablo Alingery
264 8 Pablo Alingery
Success. You can now start the database server using:
265 8 Pablo Alingery
266 8 Pablo Alingery
    postgres -D data_monitor
267 8 Pablo Alingery
or
268 8 Pablo Alingery
    pg_ctl -D data_monitor -l logfile start
269 2 Herve Ballans
</pre>
270 2 Herve Ballans
271 1 Herve Ballans
272 1 Herve Ballans
273 1 Herve Ballans
Edition des fichiers postgresql.conf pour configurer les bons ports d'écoute :
274 1 Herve Ballans
listen_addresses = '*'
275 1 Herve Ballans
data -> port 5432
276 10 Pablo Alingery
data_sums -> port 5434
277 1 Herve Ballans
data_monitor -> port 5436
278 10 Pablo Alingery
279 165 Pablo Alingery
Edit files data*/pg_hba.conf : replace 'md5' by 'trust'
280 1 Herve Ballans
<pre>
281 1 Herve Ballans
#"local"
282 1 Herve Ballans
local   all             all                                     trust
283 1 Herve Ballans
#"IPv4"
284 1 Herve Ballans
host   all             all                                     trust
285 1 Herve Ballans
</pre>
286 166 Pablo Alingery
287 166 Pablo Alingery
h3. Tunning postgres 
288 166 Pablo Alingery
289 166 Pablo Alingery
In file postgres.conf ( according to https://www.qwant.com/?q=Tunning+postgres+server+9.4+&client=firefox  )
290 166 Pablo Alingery
291 168 Pablo Alingery
shared_buffer=4096MB %{color:red}So 1/12 of the total RAM memory available%
292 1 Herve Ballans
293 169 Pablo Alingery
work_mem = 24MB
294 168 Pablo Alingery
295 168 Pablo Alingery
maintenance_work_mem = 4096MB
296 1 Herve Ballans
297 169 Pablo Alingery
wal_buffers = 16MB
298 169 Pablo Alingery
299 169 Pablo Alingery
checkpoint_segments = 32
300 169 Pablo Alingery
301 169 Pablo Alingery
checkpoint_completion_target = 0.9
302 169 Pablo Alingery
303 169 Pablo Alingery
random_page_cost = 1.0
304 169 Pablo Alingery
305 169 Pablo Alingery
effective_cache_size = 16384MB so 1/4 of the max memory 
306 169 Pablo Alingery
307 170 Pablo Alingery
308 170 Pablo Alingery
309 170 Pablo Alingery
#log
310 169 Pablo Alingery
logging_collector = on 
311 169 Pablo Alingery
log_directory = 'pg_log' 
312 169 Pablo Alingery
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
313 169 Pablo Alingery
log_truncate_on_rotation = on           # If on, an existing log file with the
314 169 Pablo Alingery
log_rotation_age = 1d                   # Automatic rotation of logfiles will
315 170 Pablo Alingery
client_min_messages = error
316 170 Pablo Alingery
log_min_messages = error 
317 170 Pablo Alingery
log_min_duration_statement = 0
318 170 Pablo Alingery
319 170 Pablo Alingery
log_connections = on
320 170 Pablo Alingery
log_disconnections = on
321 170 Pablo Alingery
log_duration = off
322 170 Pablo Alingery
log_hostname = on
323 170 Pablo Alingery
log_line_prefix = '%t [%p]: %u@%h - %d :'  
324 170 Pablo Alingery
325 170 Pablo Alingery
track_counts = on
326 170 Pablo Alingery
autovacuum = on 
327 170 Pablo Alingery
328 170 Pablo Alingery
extra_float_digits = 3
329 170 Pablo Alingery
330 177 Pablo Alingery
h3. Start the 3 databases :
331 1 Herve Ballans
332 1 Herve Ballans
<pre>
333 1 Herve Ballans
# su - postgres
334 196 Herve Ballans
$ cd /var/lib/postgresql
335 172 Pablo Alingery
$ pg_ctl -D data  start
336 172 Pablo Alingery
$ pg_ctl -D data_sums start
337 172 Pablo Alingery
$ pg_ctl -D data_monitor start
338 1 Herve Ballans
</pre>
339 174 Pablo Alingery
340 1 Herve Ballans
h3. Create the 3 databases :
341 181 Pablo Alingery
342 178 Pablo Alingery
Into user 'postgres'
343 1 Herve Ballans
344 179 Pablo Alingery
* createdb --locale C -E LATIN1 -T template0 ias_sdo
345 179 Pablo Alingery
* createdb --locale C -E LATIN1 -T template0 -p 5434 ias_sdo_sums
346 179 Pablo Alingery
* createdb --locale C -E LATIN1 -T template0 -p 5436 ias_sdo_monitor
347 54 Herve Ballans
348 182 Herve Ballans
h3. Automatic startup
349 182 Herve Ballans
350 182 Herve Ballans
Add following lines in the /etc/rc.local file :
351 182 Herve Ballans
352 182 Herve Ballans
<pre>
353 197 Herve Ballans
su -l -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D /var/lib/postgresql/data start" postgres
354 197 Herve Ballans
su -l -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D /var/lib/postgresql/data_sums start" postgres
355 197 Herve Ballans
su -l -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D /var/lib/postgresql/data_monitor start" postgres
356 182 Herve Ballans
</pre>
357 182 Herve Ballans
358 184 Herve Ballans
h2. System tuning
359 1 Herve Ballans
360 187 Herve Ballans
Current configuration :
361 185 Herve Ballans
<pre>
362 185 Herve Ballans
# sysctl -a
363 185 Herve Ballans
</pre>
364 1 Herve Ballans
365 187 Herve Ballans
In the following file :
366 185 Herve Ballans
<pre>
367 185 Herve Ballans
# vi /etc/sysctl.conf
368 185 Herve Ballans
</pre>
369 1 Herve Ballans
370 188 Herve Ballans
we change some values (default values are commented with '#')
371 194 Herve Ballans
372 195 Herve Ballans
(resources links [[Links|here]])
373 194 Herve Ballans
374 185 Herve Ballans
<pre>
375 191 Herve Ballans
# Semaphore is a object that is used to control utilization of a particular process.
376 191 Herve Ballans
# kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
377 191 Herve Ballans
# SEMMSL        maximum number of semaphores per array  (min 128)
378 191 Herve Ballans
# SEMMNS        maximum semaphores system-wide  
379 191 Herve Ballans
# SEMOPM        maximum operations per semop call       
380 191 Herve Ballans
# SEMMNI        maximum arrays 
381 191 Herve Ballans
#semop incresed from 32 (default value)operation to 100 (3rd value )
382 191 Herve Ballans
# kernel.sem = 250      32000   32      128
383 191 Herve Ballans
kernel.sem = 250 32000 100 128
384 191 Herve Ballans
385 191 Herve Ballans
In order to  apply changes :#This sets the  OS receive buffer size for all types of connections (default value 212992)
386 191 Herve Ballans
#net.core.rmem_default = 212992
387 191 Herve Ballans
#net.core.rmem_max = 212992
388 191 Herve Ballans
net.core.rmem_default = 33554432
389 191 Herve Ballans
net.core.rmem_max = 33554432
390 191 Herve Ballans
391 191 Herve Ballans
#This is the OS send buffer size for all types of connections (212992 default value) 
392 191 Herve Ballans
#net.core.wmem_default = 212992
393 191 Herve Ballans
#net.core.wmem_max = 212992
394 191 Herve Ballans
net.core.wmem_default = 33554432
395 191 Herve Ballans
net.core.wmem_max = 33554432
396 191 Herve Ballans
397 193 Pablo Alingery
#TCP Autotuning setting. "The first value tells the kernel the minimum receive buffer for each TCP connection, and this buffer is always
398 193 Pablo Alingery
# allocated to a TCP socket, even under high pressure on the system. ... The second value specified tells the kernel the default receive
399 193 Pablo Alingery
# buffer allocated for each TCP socket. This value overrides the /proc/sys/net/core/rmem_default value used by other protocols. ...
400 192 Pablo Alingery
# The third and last value specified in this variable specifies the maximum receive buffer that can be allocated for a TCP socket."
401 1 Herve Ballans
#net.ipv4.tcp_rmem = 4096       87380   6291456
402 1 Herve Ballans
net.ipv4.tcp_rmem = 10240 87380 33554432
403 1 Herve Ballans
404 193 Pablo Alingery
#TCP Autotuning setting. "This variable takes 3 different values which holds information on how much TCP sendbuffer memory space
405 193 Pablo Alingery
# each TCP socket has to use. Every TCP socket has this much buffer space to use before the buffer is filled up. Each of the three 
406 193 Pablo Alingery
#values are used under different conditions. ... The first value in this variable tells the minimum TCP send buffer space available
407 193 Pablo Alingery
# for a single TCP socket. ... The second value in the variable tells us the default buffer space allowed for a single TCP socket to use. ... 
408 193 Pablo Alingery
#The third value tells the kernel the maximum TCP send buffer space." 
409 191 Herve Ballans
#net.ipv4.tcp_wmem = 4096       16384   4194304
410 191 Herve Ballans
net.ipv4.tcp_wmem = 10240 87380 33554432
411 191 Herve Ballans
412 191 Herve Ballans
#Disable cache metrics so the initial conditions of the closed connections will not be saved to be used in near future connections
413 191 Herve Ballans
#net.ipv4.tcp_no_metrics_save = 0
414 191 Herve Ballans
net.ipv4.tcp_no_metrics_save = 1
415 191 Herve Ballans
416 1 Herve Ballans
# Increase number of incoming connections backlog
417 1 Herve Ballans
# net.core.netdev_max_backlog = 1000
418 1 Herve Ballans
net.core.netdev_max_backlog = 5000
419 1 Herve Ballans
420 1 Herve Ballans
# The tcp_mem variable defines how the TCP stack should behave when it comes to memory usage. ... 
421 192 Pablo Alingery
#The first value specified in the tcp_mem variable tells the kernel the low threshold. 
422 192 Pablo Alingery
#Below this point, the TCP stack do not bother at all about putting any pressure on the memory usage by different TCP sockets. ... 
423 193 Pablo Alingery
#The second value tells the kernel at which point to start pressuring memory usage down. ... The final value tells the kernel how many
424 193 Pablo Alingery
# memory pages it may use maximally
425 1 Herve Ballans
# net.ipv4.tcp_mem = 1543347    2057796 3086694
426 191 Herve Ballans
net.ipv4.tcp_mem = 786432 1048576 26777216
427 191 Herve Ballans
428 192 Pablo Alingery
# local port range that is used by TCP and UDP traffic to choose the local port. You will see in the parameters of this file two numbers:
429 192 Pablo Alingery
# The first number is the first local port allowed for TCP and UDP traffic on the server, the second is the last local port number.
430 191 Herve Ballans
# net.ipv4.ip_local_port_range = 32768  61000
431 191 Herve Ballans
net.ipv4.ip_local_port_range = 1024 65535
432 191 Herve Ballans
433 191 Herve Ballans
# maximum number of sockets in TIME-WAIT to be held simultaneously.
434 191 Herve Ballans
# net.ipv4.tcp_max_tw_buckets = 262144
435 191 Herve Ballans
net.ipv4.tcp_max_tw_buckets = 360000
436 1 Herve Ballans
</pre>
437 185 Herve Ballans
438 191 Herve Ballans
Then we run the following command to make our change take effect:
439 191 Herve Ballans
440 185 Herve Ballans
<pre>
441 185 Herve Ballans
# sysctl -p
442 185 Herve Ballans
</pre>
443 176 Pablo Alingery
444 216 Pablo Alingery
h2. JMD Installation 
445 215 Herve Ballans
446 217 Pablo Alingery
Download new JMD package build by Niles Oien 2016-04-07 following thoses actions :
447 215 Herve Ballans
448 215 Herve Ballans
<pre>
449 215 Herve Ballans
cd /urs/local
450 215 Herve Ballans
451 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ ftp gong2.nso.edu
452 215 Herve Ballans
Name (gong2.nso.edu:oien): anonymous
453 215 Herve Ballans
Password: <---------------- use your email as the password
454 215 Herve Ballans
ftp> cd outgoing/oien
455 215 Herve Ballans
ftp> get pablo_jmd.tar.gz
456 215 Herve Ballans
ftp> quit
457 215 Herve Ballans
</pre>
458 215 Herve Ballans
459 215 Herve Ballans
Install new JMD package following thoses actions 
460 215 Herve Ballans
461 215 Herve Ballans
<pre>
462 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ gunzip -vf pablo_jmd.tar.gz
463 215 Herve Ballans
pablo_jmd.tar.gz:      8.3% -- replaced with pablo_jmd.tar
464 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ tar xf pablo_jmd.tar
465 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ cd pablo_jmd
466 215 Herve Ballans
[oien@spsc-nso19-12 pablo_jmd]$ less PABLO_README.txt
467 215 Herve Ballans
cd ..
468 215 Herve Ballans
mv jmd jmd_old
469 215 Herve Ballans
mv pablo_jmd jmd 
470 215 Herve Ballans
</pre>
471 215 Herve Ballans
472 266 Herve Ballans
h2. Apache Configuration for JMD
473 215 Herve Ballans
474 215 Herve Ballans
Configure webserver  to request jsoc_fetch
475 215 Herve Ballans
(following the mail from nilesoien@gmail.com)
476 215 Herve Ballans
477 222 Pablo Alingery
%{color:red}WARNING : change hostname when migrate sdo-new to sdo%
478 222 Pablo Alingery
479 220 Pablo Alingery
config d 'apache2 fichier sdo-new.ias.u-psud.fr 
480 215 Herve Ballans
<pre>
481 215 Herve Ballans
482 215 Herve Ballans
<VirtualHost *:80>
483 220 Pablo Alingery
        ServerName sdo-new.ias.u-psud.fr
484 215 Herve Ballans
        ServerAdmin pablo.alingery@ias.u-psud.fr
485 215 Herve Ballans
        #ErrorLog /var/log/apache2/error.log
486 215 Herve Ballans
        DocumentRoot /var/www
487 215 Herve Ballans
488 215 Herve Ballans
        # Possible values include: debug, info, notice, warn, error, crit,
489 215 Herve Ballans
        # alert, emerg.
490 215 Herve Ballans
        LogLevel debug
491 215 Herve Ballans
492 215 Herve Ballans
        #CustomLog /var/log/apache2/VSO/access.log combined
493 215 Herve Ballans
494 215 Herve Ballans
        Alias /VSO/DRMS/cgi-bin/ "/home/production/netdrms-tools/scripts/cgi-bin/"
495 215 Herve Ballans
496 215 Herve Ballans
        <Location /VSO/DRMS/cgi-bin>
497 215 Herve Ballans
                SetHandler perl-script
498 215 Herve Ballans
                PerlResponseHandler ModPerl::Registry
499 215 Herve Ballans
                PerlOptions +ParseHeaders
500 215 Herve Ballans
                Options +ExecCGI
501 215 Herve Ballans
                Order allow,deny
502 215 Herve Ballans
                Allow from all
503 215 Herve Ballans
        </Location>
504 215 Herve Ballans
</VirtualHost>
505 215 Herve Ballans
506 215 Herve Ballans
</pre>
507 215 Herve Ballans
508 223 Herve Ballans
Activate the new virtualhost and disable the default one :
509 223 Herve Ballans
<pre>
510 225 Herve Ballans
# a2ensite sdo-new.ias.u-psud.fr.conf
511 225 Herve Ballans
# a2dissite 000-default.conf
512 225 Herve Ballans
# service apache2 restart
513 225 Herve Ballans
</pre>
514 225 Herve Ballans
515 225 Herve Ballans
Allow symlink for the cgi scripts dierctory in apache2.conf :
516 225 Herve Ballans
<pre>
517 225 Herve Ballans
<Directory /home/production/netdrms-tools/scripts/>
518 225 Herve Ballans
        Options FollowSymLinks
519 225 Herve Ballans
        AllowOverride None
520 225 Herve Ballans
        Require all granted
521 225 Herve Ballans
</Directory>
522 225 Herve Ballans
</pre>
523 225 Herve Ballans
524 225 Herve Ballans
<pre>
525 225 Herve Ballans
# service apache2 restart
526 223 Herve Ballans
</pre>
527 223 Herve Ballans
 
528 226 Pablo Alingery
%{color:red}To be  added futher to test cgi%
529 1 Herve Ballans
Execution test cgi with URL :
530 226 Pablo Alingery
531 226 Pablo Alingery
make sure my $hostname=in the cgi file vso_jsoc_fetch.cgi is correct and test
532 224 Pablo Alingery
http://sdo-new.ias.u-psud.fr/VSO/DRMS/cgi-bin/vso_jsoc_fetch.cgi
533 215 Herve Ballans
534 215 Herve Ballans
expected result  :
535 215 Herve Ballans
<pre>
536 215 Herve Ballans
{
537 215 Herve Ballans
   "wait" : 0,
538 215 Herve Ballans
   "requestid" : "",
539 215 Herve Ballans
   "data" : {},
540 215 Herve Ballans
   "method" : "url_quick",
541 215 Herve Ballans
   "size" : 0,
542 215 Herve Ballans
   "errormsg" : "Empty query",
543 215 Herve Ballans
   "protocol" : "as-is",
544 215 Herve Ballans
   "status" : 1,
545 215 Herve Ballans
   "space_ratio" : 0.1,
546 215 Herve Ballans
   "load_ratio" : 0.066875,
547 215 Herve Ballans
   "dir" : "",
548 215 Herve Ballans
   "count" : 0
549 215 Herve Ballans
}
550 215 Herve Ballans
</pre>
551 215 Herve Ballans
552 267 Herve Ballans
h2. JMD configuration
553 267 Herve Ballans
554 291 Herve Ballans
Modify the file [[/usr/local/jmd/cfg/JMD.cfg]]
555 267 Herve Ballans
556 267 Herve Ballans
557 271 Herve Ballans
%{color:red}Warning : when migrate production server, change _sdo-new_ by _sdo_%
558 271 Herve Ballans
559 1 Herve Ballans
h2. NetDRMS tool Install
560 23 Pablo Alingery
561 199 Pablo Alingery
The following installed is based on : [[http://inf-redmine.ias.u-psud.fr/redmine/attachments/download/114/Netdrms_First_Install.odt]]
562 1 Herve Ballans
563 207 Pablo Alingery
The sources are in : http://jsoc.stanford.edu/netdrms/dist/ 
564 207 Pablo Alingery
Locally on sdo-new in  : /home/production/sources
565 1 Herve Ballans
566 199 Pablo Alingery
Symbolic link created 'netdrms_current' that corresponds to the last release
567 227 Pablo Alingery
ln -s netdrms_8.11/ netdrms_current 
568 1 Herve Ballans
569 199 Pablo Alingery
Edit file config.local
570 27 Pablo Alingery
<pre>
571 27 Pablo Alingery
cp config.local.template config.local
572 1 Herve Ballans
</pre>
573 29 Pablo Alingery
574 203 Pablo Alingery
%{color:red}Warning WEB_DBUSER      apache  We think that it should value www maybe , to be checked testing the cgi%
575 208 Pablo Alingery
%{color:red}So check the cgi to figure out which user is used to connect to bd%
576 32 Herve Ballans
577 199 Pablo Alingery
Create 2 followings dirs : 
578 1 Herve Ballans
<pre>
579 227 Pablo Alingery
mkdir /usr/local/netdrms_8.11/logs/SUM
580 227 Pablo Alingery
mkdir /usr/local/netdrms_8.11/logs/slony
581 27 Pablo Alingery
</pre>
582 1 Herve Ballans
583 205 Pablo Alingery
%{color:red}Warning config.local from line 150 =>222 Remote config to provide data, series to externals%
584 205 Pablo Alingery
%{color:red}To be checked for PLATO%
585 1 Herve Ballans
586 1 Herve Ballans
Création d'un alias netdrms dans /root/.bashrc
587 27 Pablo Alingery
<pre>
588 1 Herve Ballans
alias netdrms='cd /usr/local/netdrms_current'
589 1 Herve Ballans
</pre>
590 31 Pablo Alingery
591 1 Herve Ballans
h3. Prepare compiling
592 1 Herve Ballans
593 252 Herve Ballans
Into _production_ profile
594 252 Herve Ballans
595 246 Herve Ballans
<pre>
596 252 Herve Ballans
$ ./configure
597 246 Herve Ballans
</pre>
598 246 Herve Ballans
599 113 Pablo Alingery
h3. Compilation
600 113 Pablo Alingery
601 249 Herve Ballans
Creating lib64 link (lib64 does not exist on debian 8)
602 113 Pablo Alingery
<pre>
603 249 Herve Ballans
# cd /usr
604 249 Herve Ballans
# ln -s lib/ lib64
605 249 Herve Ballans
</pre>
606 249 Herve Ballans
607 249 Herve Ballans
<pre>
608 253 Herve Ballans
$ make
609 253 Herve Ballans
$ make sums
610 113 Pablo Alingery
</pre>
611 113 Pablo Alingery
612 255 Herve Ballans
h2. SSH-HPN install 
613 255 Herve Ballans
614 258 Herve Ballans
Intallation de openssh 7.2p2 car le dernier patch hpn dispo est 7.2hpn14.V10 
615 255 Herve Ballans
616 258 Herve Ballans
web site for open ssh : http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.2p2.tar.gz
617 258 Herve Ballans
patch hpn : https://sourceforge.net/projects/hpnssh/files/HPN-SSH%2014v10%207.2p2/openssh-7_2_P2-hpn-14.10.diff
618 255 Herve Ballans
619 256 Pablo Alingery
In the dir /home/production/sources into  'root'
620 255 Herve Ballans
621 255 Herve Ballans
<pre>
622 258 Herve Ballans
# tar -xzvf openssh-7.2p2.tar.gz
623 258 Herve Ballans
# cd openssh-7.2p2/
624 258 Herve Ballans
# cat ../openssh-7_2_P2-hpn-14.10.diff |patch -p1
625 255 Herve Ballans
# ./configure --prefix=/usr/local/hpn-ssh --with-pam --with-md5-passwords --without-zlib-version-check --with-tcp-wrappers
626 255 Herve Ballans
# make
627 255 Herve Ballans
# make install
628 255 Herve Ballans
</pre>
629 255 Herve Ballans
630 255 Herve Ballans
Depuis sdo :
631 255 Herve Ballans
<pre>
632 255 Herve Ballans
# cd /usr/local/hpn-ssh/etc/
633 259 Herve Ballans
# rsync -av *key* production@sdo-new:/home/production/
634 255 Herve Ballans
</pre>
635 255 Herve Ballans
636 273 Herve Ballans
Following the link : http://vso.stanford.edu/netdrms/rmtsums.html
637 1 Herve Ballans
<pre>
638 274 Herve Ballans
$ cd /home/production/
639 273 Herve Ballans
$ ssh-agent -c > ~/.ssh-agent_rs
640 285 Pablo Alingery
</pre>
641 286 Pablo Alingery
NB : correct file   ~/.ssh-agent_rs it should look like :
642 285 Pablo Alingery
<pre>
643 285 Pablo Alingery
#!/bin/csh
644 285 Pablo Alingery
export SSH_AUTH_SOCK=/tmp/ssh-9POrTXobhLR4/agent.74272;
645 285 Pablo Alingery
export SSH_AGENT_PID=74273;
646 285 Pablo Alingery
echo Agent pid 74273;
647 285 Pablo Alingery
</pre>
648 285 Pablo Alingery
649 285 Pablo Alingery
<pre>
650 273 Herve Ballans
$ source ~/.ssh-agent_rs
651 273 Herve Ballans
$ ssh-add ~/.ssh/id_rsa
652 269 Herve Ballans
</pre>
653 269 Herve Ballans
654 259 Herve Ballans
Sur sdo-new :
655 255 Herve Ballans
<pre>
656 260 Herve Ballans
# mv /home/production/*key* /usr/local/hpn-ssh/etc/
657 255 Herve Ballans
</pre>
658 255 Herve Ballans
659 255 Herve Ballans
We have to configure the port number to 55000
660 255 Herve Ballans
<pre>
661 255 Herve Ballans
# vi ssh_config
662 255 Herve Ballans
</pre>
663 255 Herve Ballans
664 255 Herve Ballans
and add :
665 255 Herve Ballans
<pre>
666 255 Herve Ballans
#Port 22
667 255 Herve Ballans
Port 55000
668 255 Herve Ballans
</pre>
669 255 Herve Ballans
670 255 Herve Ballans
We configure also the server hpn (even we don't use it yet)
671 255 Herve Ballans
<pre>
672 255 Herve Ballans
# vi sshd_config
673 255 Herve Ballans
</pre>
674 255 Herve Ballans
675 255 Herve Ballans
and add :
676 255 Herve Ballans
<pre>
677 255 Herve Ballans
#Port 22
678 255 Herve Ballans
Port 55000
679 255 Herve Ballans
680 255 Herve Ballans
#PidFile /var/run/sshd.pid
681 255 Herve Ballans
PidFile /var/run/sshd.55000.pid
682 255 Herve Ballans
683 255 Herve Ballans
# allow the use of the none cipher
684 255 Herve Ballans
#NoneEnabled no
685 255 Herve Ballans
NoneEnabled yes
686 255 Herve Ballans
</pre>
687 255 Herve Ballans
688 265 Herve Ballans
In order to force the use of SSH-hpn by JMD :
689 265 Herve Ballans
690 265 Herve Ballans
<pre>
691 265 Herve Ballans
$ vi /usr/local/jmd/cfg/JMD.cfg
692 265 Herve Ballans
</pre>
693 265 Herve Ballans
694 265 Herve Ballans
and replace the path of scp binary :
695 265 Herve Ballans
696 265 Herve Ballans
<pre>
697 265 Herve Ballans
SCPCommand=/usr/local/hpn-ssh/bin/scp -o NoneSwitch=yes -o NoneEnabled=yes
698 265 Herve Ballans
</pre>
699 265 Herve Ballans
700 262 Herve Ballans
h2. Private key Public key generation 
701 262 Herve Ballans
702 262 Herve Ballans
JSOC need your public key to directly connect to your netdrms server. In order to generate your RSA public/private key pair :
703 262 Herve Ballans
704 262 Herve Ballans
<pre>
705 262 Herve Ballans
$ ssh-keygen -t rsa
706 262 Herve Ballans
</pre>
707 262 Herve Ballans
708 263 Pablo Alingery
Not necessary in our case cause we recover the ssh keys of the current server 'sdo'.
709 262 Herve Ballans
710 262 Herve Ballans
However, we have to retrieve the private key of production account on sdo-new
711 262 Herve Ballans
712 262 Herve Ballans
From sdo :
713 262 Herve Ballans
<pre>
714 262 Herve Ballans
rsync -av id_rsa production@sdo-new:/home/production/.ssh/
715 262 Herve Ballans
</pre>
716 262 Herve Ballans
717 300 Herve Ballans
In order to test the connection :
718 300 Herve Ballans
<pre>
719 300 Herve Ballans
$ ssh jsocexp@jsocport.stanford.edu -p55000
720 300 Herve Ballans
</pre>
721 300 Herve Ballans
722 301 Herve Ballans
Note : the IP of the server has to be declared to the jsoc
723 301 Herve Ballans
724 299 Pablo Alingery
h2. NetDRMS Replication Config
725 112 Herve Ballans
726 319 Herve Ballans
%{color:red}To be check if we keep that here or not%
727 311 Pablo Alingery
To prevent from deleting files 
728 307 Pablo Alingery
<pre>
729 307 Pablo Alingery
cd logs/SUM ; scp production@sdo:/usr/local/netdrms/install-config-files/sum_rm.cfg .
730 112 Herve Ballans
</pre>
731 1 Herve Ballans
732 1 Herve Ballans
Create tmp dir in netdrms working directory (/usr/local/netdrms_current)
733 112 Herve Ballans
<pre>
734 315 Herve Ballans
$ mkdir tmp
735 112 Herve Ballans
</pre>
736 112 Herve Ballans
737 308 Pablo Alingery
Create config file from template 
738 112 Herve Ballans
<pre>
739 315 Herve Ballans
$ cd base/drms/replication/etc
740 313 Pablo Alingery
cp repclient.template.cfg ias.repclient.cfg
741 307 Pablo Alingery
</pre>
742 91 Herve Ballans
743 316 Herve Ballans
Define node in file : [[/usr/local/netdrms_current/base/drms/replication/etc/ias.repclient.cfg]]
744 1 Herve Ballans
745 309 Pablo Alingery
In our case :
746 94 Herve Ballans
<pre>
747 1 Herve Ballans
node=IASprod
748 319 Herve Ballans
</pre>
749 319 Herve Ballans
750 319 Herve Ballans
There are 4 new fileds in the new version of repclient. 
751 319 Herve Ballans
%{color:red}Has to be checked with Art :%
752 319 Herve Ballans
<pre>
753 320 Herve Ballans
#kRSBaseURL=<base URL for all Slony services>
754 320 Herve Ballans
kRSBaseURL=
755 320 Herve Ballans
#kSubService=<URL of the subscription service>
756 320 Herve Ballans
kSubService=
757 320 Herve Ballans
#kPubListService=<URL of the publication-list service>
758 320 Herve Ballans
kPubListService=
759 320 Herve Ballans
#kSubXfer=<URL of the file transfer directory>
760 320 Herve Ballans
kSubXfer=
761 105 Pablo Alingery
</pre>
762 106 Pablo Alingery
763 321 Pablo Alingery
764 321 Pablo Alingery
h2. NetDRMS Subsribe list Config
765 321 Pablo Alingery
766 321 Pablo Alingery
Create config subscribe file from template 
767 321 Pablo Alingery
<pre>
768 321 Pablo Alingery
$ cd base/drms/replication/etc
769 321 Pablo Alingery
cp subscribe_list.template.cfg ias.subscribe_list.cfg
770 321 Pablo Alingery
</pre>
771 321 Pablo Alingery
772 321 Pablo Alingery
773 292 Pablo Alingery
h2. TO BE DONE BEFORE MIGRATION
774 108 Pablo Alingery
775 107 Pablo Alingery
776 152 Pablo Alingery
%{color:red} configure sytem nbr de fichier ouvert en meme temps%
777 1 Herve Ballans
778 152 Pablo Alingery
%{color:red} configure sytem taille  buffer%
779 152 Pablo Alingery
780 155 Pablo Alingery
%{color:red} swap désactivé ? discussion Stephane et Gilles%
781 1 Herve Ballans
782 1 Herve Ballans
%{color:red}Test ssh connection to JSOC , NSO CFA before subcription and just after name sdo-new into sdo%
783 317 Pablo Alingery
%{color:red}Take old counter and place it in the same dir before migration%