Work on documentation.
[monikop.git] / doc / installation.muse
blob8696f0bffebaae9bf9358654d14fa5bfeadb1da4
1 #title Monikop and Pokinom
2 #subtitle rsync between unconnected hosts
6 * Installation
8 We assume Debian GNU/Linux here, but any distribution should
9 work. Adapt installation instructions accordingly.
11 Debian Packages needed:
13  - to install from a git repository: git-core;
15  - to run Monikop (on Rover) or Pokinom (in office): 
16    rsync, mingetty, sudo, libcurses-perl, libfile-rsync-perl;
18  - to run the tests: bc, time.
20  - Both Monikop and Pokinom run on text console; you don't need
21    anything like Gnome, KDE or even X.
24 ** Prepare Removable Disks
26 Put sticker labels with disk names on your removable disks.
28 *** File Systems
30 Create labelled filesystems on the removable disks. Example
31 (suppose a removable with a sticker label "=disk_10=" on its case is attached to =/dev/sdg1=): 
33 =# mke2fs -j -L disk_10 /dev/sdg1=
35 On both Monikop's and Pokinom's host, label the system root
36 partition. If it were on =/dev/sda1/, that's e.g.=:
38 =# e2label /dev/sda1 root=
40 On both Monikop's and Pokinom's host, label the swap partition. If it
41 happens to be on /dev/sda5, e.g.: 
43 =# swapoff=
45 =# mkswap -L swap /dev/sda5=
47 =# swapon=
49 *** Mount Points
51 On both Monikop's and Pokinom's host, create mount points, one for
52 each removable disk: 
54 =# mkdir -p /media/disk_{01,02,03,04...}=
56 =# chmod a+rx /media/disk_{01,02,03,04...}=
58 #fstab
59 In =/etc/fstab= on both Monikop's and Pokinom's host, make use of the disk labels:
61 <src lang="conf">
62 ## System partitions ###
63 LABEL=root     /               ext3  defaults,errors=remount-ro 0  1
64 LABEL=swap     none            swap  sw                         0  0
65 ## Removable disks                   
66 LABEL=disk_01  /media/disk_01  ext3  rw,user,auto               0  0
67 LABEL=disk_02  /media/disk_02  ext3  rw,user,auto               0  0
68 LABEL=disk_03  /media/disk_03  ext3  rw,user,auto               0  0
69 LABEL=disk_04  /media/disk_04  ext3  rw,user,auto               0  0
70 # etc.
71 </src>
73 Put each removable disk in and make it writable; e.g.:
75 =# mount /media/disk_01=
77 =# chmod a+rwx /media/disk_01=
79 *** Maintain Bootability
81 On both Monikop's and Pokinoms host, make sure the operating system boots
82 actually from its system disk rather than from some of the removable
83 ones. Change =/boot/grub/menu.lst= where it says <code># kopt=root=...</code>:
85 <src lang="conf">
86 ### BEGIN AUTOMAGIC KERNELS LIST
87 ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
88 ## by the debian update-grub script except for the default options below
90 ## DO NOT UNCOMMENT THEM, Just edit them to your needs
92 ## ## Start Default Options ##
93 ## default kernel options
94 ## default kernel options for automagic boot options
95 ## If you want special options for specific kernels use kopt_x_y_z
96 ## where x.y.z is kernel version. Minor versions can be omitted.
97 ## e.g. kopt=root=/dev/hda1 ro
98 ##      kopt_2_6_8=root=/dev/hdc1 ro
99 ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
100 # kopt=root=/dev/disk/by-label/root noresume ro
101 </src>
103 and call
105 =# update-grub=
108 #Configure_Monikop_and_Pokinom
109 ** Configure Monikop and Pokinom
111 Create a user on both Monikop's and Pokinom's machine. For
112 description's sake, we assume they're called m-operator.
114 Get Monikop (and Pokinom); from m-operator's home directory say:
116 =$ git-clone (FIXME: repo here)=
118 Copy =monikop.config.example= to =monikop.config= and
119 =pokinom.config.example= to =pokinom.config, respectively,= and
120 adapt them according to your needs. Both are perl code, so be careful
121 and keep the interpunction in place. 
123 #monikop.config
124 *** =monikop.config=
126 <include file="../monikop.config.example" markup="src" lang="perl">
128 For Monikop, change in [[installation#monikop.config][monikop.config]] at least:
130  - =%sources=: Data producing Sources on Rover in one of the formats Rsync
131    understands, together with a source-specific directory name where data
132    of the respective Source goes. Those directory names can be equal for
133    several Sources as long as all filenames in the payload are certain to be
134    unique.
136  - =@usable_mount_points=: Mount points (directories) you set up [[installation#fstab][earlier]] for your
137    removable disks.
139    
140 #pokinom.config
142 *** =pokinom.config=
144 <include file="../pokinom.config.example" markup="src" lang="perl">
146 For Pokinom you should edit in [[installation#pokinom.config][pokinom.config]] at least:
148  - =@usable_mount_points= (as with [[installation#monikop.config][monikop.config]])
149  - =$destination=: Data destination in one of the formats Rsync
150    understands; cf. setup of [[installation#Data_Destination][Data Destination]].
151  - =$rsync_username=, =$rsync_password=: credentials of (and only
152    known to) the Rsync server;
153    cf. setup of [[installation#Data_Destination][Data Destination]]. 
156 *** Automatic Program Start
158 Append to
159 =/home/m-operator/.profile= (create it if necessary):
161 <src lang="bash">
162 /home/m-operator/monikop/monikop
163 </src>
167 <src lang="bash">
168 /home/m-operator/monikop/pokinom,
169 </src>
171 respectively.
173 If necessary, specify path to config file, e.g.  
174 <src lang="bash">
175 /home/m-operator/monikop/monikop /home/m-operator/monikop/monikop.config
176 </src>
179 *** Setup Sudo
181 On both Monikop's and Pokinom's host authorize m-operator to shut down computer.
182 Use =visudo= to change =/etc/sudoers=; add:
184 <src lang="conf">
185 m-operator ALL=(ALL) NOPASSWD: /sbin/halt -p
186 m-operator ALL=(ALL) NOPASSWD: /sbin/reboot
187 </src>
190 *** Automatic Login
192 On both Monikop's and Pokinom's host, change the line in
193 =/etc/inittab= that looks like
195 <src lang="conf">
196 1:2345:respawn:/sbin/getty 38400 tty1
197 </src>
199 into
201 <src lang="conf">
202 1:2345:respawn:/sbin/mingetty --autologin m-operator --noclear tty1
203 </src>
206 #Configure_Rsync_on_Sources
207 ** Configure Rsync on Sources
209 Install package rsync.
211 Example for =/etc/rsyncd.conf=:
213 <src lang="conf">
214 pid file=/var/run/rsyncd.pid
215 [data]
216     path = /mnt/hdd_0
217     use chroot = false
218     lock file = /var/lock/rsyncd
219     read only = yes
220     list = yes
221     transfer logging = false
222 </src>
224 In =/etc/default/rsync=, change the line
226 <src lang="conf">
227 RSYNC_ENABLE = false
228 </src>
232 <src lang="conf">
233 RSYNC_ENABLE = true
234 </src>
236 Start rsync server:
238 =# /etc/initd/rsync start=
240 or reboot.
243 On Windows, install
244 [[http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download][cwRsync]]. Click
245 Start, Programs, cwRsyncServer, rsyncd.conf; edit:
247 <src lang="conf">
248 use chroot = false
249 strict modes = false
250 hosts allow = *
251 logfile = rsyncd.log
252 [data]
253 #   /cygdrive/e/log stands for E:\log
254     path = /cygdrive/e/log
255     read only = false
256     transfer logging = false
257 </src>
259 Configure service rsync for automatic start.
262 #Network_Setup
263 ** Network Setup
265 Depending on the amount of data to transfer, consider putting a
266 dedicated NIC for each Source into Monikop's machine.  In this case,
267 you should provide for non-overlapping subnets. [[http://jodies.de/ipcalc][IP-Calculator]] may be
268 helpful.
271 *** Monikop
273 **** Name the Sources
275 #etc_hosts
276 Example for =/etc/hosts=:
278 <src lang="conf">
279 127.0.0.1      localhost
280 192.168.200.10 data-producer1
281 192.168.200.20 data-producer2
282 192.168.200.30 data-producer3
283 192.168.200.50 data-producer4
284 192.168.178.1  monikop
285 </src>
288 **** Configure NICs
290 Example for =/etc/network/interfaces=:
291 <src lang="conf">
292 # The loopback network interface
293 auto lo
294 iface lo inet loopback
296 # Net of smaller Sources
297 allow-hotplug eth1
298 iface eth1 inet static
299    address 192.168.178.1
300    netmask 255.255.255.0
302 # Dedicated NIC for data-producer1
303 allow-hotplug eth2
304 iface eth2 inet static
305    address 192.168.200.9
306    netmask 255.255.255.248
308 # Dedicated NIC for data_producer2
309 allow-hotplug eth3
310 iface eth3 inet static
311    address 192.168.200.19
312    netmask 255.255.255.248
314 # Dedicated NIC for data_producer3
315 allow-hotplug eth4
316 iface eth4 inet static
317    address 192.168.200.29
318    netmask 255.255.255.248
320 # Dedicated NIC for data_producer4
321 allow-hotplug eth5
322 iface eth5 inet static
323    address 192.168.200.49
324    netmask 255.255.255.248
325 </src>
328 *** Data Sources
330 Use [[installation#etc_hosts][/etc/hosts]] as with Monikop. For Windows, it's =%SystemRoot%\system32\drivers\etc\hosts=.
333 **** Source's NIC
335 Example for =/etc/network/interfaces=:
337 <src lang="conf">
338 auto lo
339 iface lo inet loopback
341 # service (not relevant for Monikop)
342 allow-hotplug eth0
343 iface eth0 inet static
344    address 192.168.178.2
345    netmask 255.255.255.0
347 # Monikop's dedicated NIC
348 allow-hotplug eth1
349 iface eth1 inet static
350    address 192.168.200.10
351    netmask 255.255.255.248
352 </src>
354 For Windows, configure your network settings accordingly.
357 *** Pokinom
359 Pokinom's network settings don't need any special treatment. Just
360 integrate it into the office LAN Destination is connected to.
363 #Data_Destination
364 ** Data Destination
366 *** Rsync Server on Destination
368 Install package rsync.
370 Adapt =/etc/rsyncd.conf=, e.g.:
372 <src lang="conf">
373 gid = data_receiving_group
374 use chroot = yes
375 max connections = 0
376 pid file = /var/run/rsyncd.pid
378 [incoming]
379         path = /mnt/./raid_0
380         list = no
381         comment = Pokinom only; requires authentication
382         read only = no
383         incoming chmod = g+r,g+w
384         write only = yes
385         # Pokinom's IP:
386         hosts allow = 192.168.180.120
387         auth users = m-operator
388         secrets file = /etc/rsyncd.secrets
389 </src>
391 =/etc/rsyncd.secrets= contains Rsync's credentials which must
392 correspond to settings =$rsync_passwd= and =$rsync_username= in [[installation#pokinom.config][pokinom.config]]
394 <src lang="conf">
395 m-operator:seCreT
396 </src>
398 In =/etc/default/rsync=, change the line
400 <src lang="conf">
401 RSYNC_ENABLE = false
402 </src>
406 <src lang="conf">
407 RSYNC_ENABLE = true
408 </src>
410 Start rsync server:
412 =# /etc/initd/rsync start=
414 or reboot.
416 With the above, rsync puts the payload it receives into
417 =/mnt/raid_0/NEW_DATA/=. ("=NEW_DATA=" was set with
418 =$destination= in [[installation#pokinom.config][pokinom.config]].)
420 =NEW_DATA/= and everything inside belongs to user
421 nobody and group data_receiving_group.
423 If on Destination you can't do without Windows, install 
424 [[http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download][cwRsync]],
425 configure its =rsyncd.conf= accordingly, and set service rsync to
426 automatic start.
428 ; TODO: net topology for Monikop, for Pokinom