Documentation processing and upload more mechanised.
[monikop.git] / doc / installation.muse
blobe6ac64e62e932e5da00c87dbe97a037a8349a2af
1 #title Monikop (and Pokinom)
2 #subtitle rsync between unconnected hosts
3 #author Bert Burgemeister
7 * Installation
9 We assume Debian GNU/Linux here, but any distribution should
10 work. Adapt installation instructions accordingly.
12 Debian Packages needed:
14  - to run Monikop (on Rover) or Pokinom (in office): 
15    rsync, mingetty, sudo, libcurses-perl, libfile-rsync-perl;
17  - to install from a git repository: git-core;
19  - to run the tests: bc, time.
21  - Both Monikop and Pokinom run on text console; you don't need
22    anything like Gnome, KDE or even X.
25 ** Prepare Removable Disks
27 Put sticker labels with disk names on your removable disks.
29 *** File Systems
31 Create labelled file systems on the removable disks. Example
32 (suppose a removable disk with a sticker label "=disk_10=" on its case is attached to =/dev/sdg1=): 
34 =# mke2fs -j -L disk_10 /dev/sdg1=
36 On both Monikop's and Pokinom's host, label the system root
37 partition. If it were on =/dev/sda1/, that's e.g.=:
39 =# e2label /dev/sda1 root=
41 On both Monikop's and Pokinom's host, label the swap partition. If it
42 happens to be on /dev/sda5, e.g.: 
44 =# swapoff=
46 =# mkswap -L swap /dev/sda5=
48 =# swapon=
50 *** Mount Points
52 On both Monikop's and Pokinom's host, create mount points, one for
53 each removable disk: 
55 =# mkdir -p /media/disk_{01,02,03,04...}=
57 =# chmod a+rx /media/disk_{01,02,03,04...}=
59 #fstab
60 In =/etc/fstab= on both Monikop's and Pokinom's host, make use of the disk labels:
62 <src lang="conf">
63 ## System partitions ###
64 LABEL=root     /               ext3  defaults,errors=remount-ro 0  1
65 LABEL=swap     none            swap  sw                         0  0
66 ## Removable disks                   
67 LABEL=disk_01  /media/disk_01  ext3  rw,user,auto               0  0
68 LABEL=disk_02  /media/disk_02  ext3  rw,user,auto               0  0
69 LABEL=disk_03  /media/disk_03  ext3  rw,user,auto               0  0
70 LABEL=disk_04  /media/disk_04  ext3  rw,user,auto               0  0
71 # etc.
72 </src>
74 Put each removable disk in and make it writable; e.g.:
76 =# mount /media/disk_01=
78 =# chmod a+rwx /media/disk_01=
80 *** Maintain Bootability
82 On both Monikop's and Pokinom's host, make sure the operating system boots
83 actually from its system disk rather than from some of the removable
84 ones. Change =/boot/grub/menu.lst= where it says <code># kopt=root=...</code>:
86 <src lang="conf">
87 ### BEGIN AUTOMAGIC KERNELS LIST
88 ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
89 ## by the debian update-grub script except for the default options below
91 ## DO NOT UNCOMMENT THEM, Just edit them to your needs
93 ## ## Start Default Options ##
94 ## default kernel options
95 ## default kernel options for automagic boot options
96 ## If you want special options for specific kernels use kopt_x_y_z
97 ## where x.y.z is kernel version. Minor versions can be omitted.
98 ## e.g. kopt=root=/dev/hda1 ro
99 ##      kopt_2_6_8=root=/dev/hdc1 ro
100 ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
101 # kopt=root=/dev/disk/by-label/root noresume ro
102 </src>
104 and call
106 =# update-grub=
109 #Configure_Monikop_and_Pokinom
110 ** Configure Monikop and Pokinom
112 Create a user on both Monikop's and Pokinom's machine. For
113 description's sake, we assume they're called m-operator.
115 Inside m-operator's home directory, [[download][get Monikop (and Pokinom)]];
116 unpack the tarball:
118 =$ tar -xzf monikop-<version>.tar.gz=
120 =$ mv monikop-<version> monikop=
122 =$ cd monikop=.
124 Copy =monikop.config.example= to =monikop.config= and
125 =pokinom.config.example= to =pokinom.config, respectively,= and
126 adapt them according to your needs. Both are perl code, so be careful
127 and keep the punctuation in place. 
129 #monikop.config
130 *** =monikop.config=
132 <include file="../monikop.config.example" markup="src" lang="perl">
134 For Monikop, change in [[installation#monikop.config][monikop.config]] at least:
136  - =%sources=: Data producing Sources on Rover in one of the formats Rsync
137    understands, together with a source-specific directory name where data
138    of the respective Source goes. Those directory names can be equal for
139    several Sources as long as all filenames in the payload are certain to be
140    unique.
142  - =@usable_mount_points=: Mount points (directories) you set up [[installation#fstab][earlier]] for your
143    removable disks.
145    
146 #pokinom.config
148 *** =pokinom.config=
150 <include file="../pokinom.config.example" markup="src" lang="perl">
152 For Pokinom you should edit in [[installation#pokinom.config][pokinom.config]] at least:
154  - =@usable_mount_points= (as with [[installation#monikop.config][monikop.config]])
155  - =$destination=: Data destination in one of the formats Rsync
156    understands; cf. setup of [[installation#Data_Destination][Data Destination]].
157  - =$rsync_username=, =$rsync_password=: credentials of (and only
158    known to) the Rsync server;
159    cf. setup of [[installation#Data_Destination][Data Destination]]. 
162 *** Automatic Program Start
164 Append to
165 =/home/m-operator/.profile= (create it if necessary):
167 <src lang="bash">
168 /home/m-operator/monikop/monikop
169 </src>
173 <src lang="bash">
174 /home/m-operator/monikop/pokinom,
175 </src>
177 respectively.
179 If necessary, specify path to config file, e.g.  
180 <src lang="bash">
181 /home/m-operator/monikop/monikop /home/m-operator/monikop/monikop.config
182 </src>
185 *** Setup Sudo
187 On both Monikop's and Pokinom's host authorise m-operator to shut down computer.
188 Use =visudo= to change =/etc/sudoers=; add:
190 <src lang="conf">
191 m-operator ALL=(ALL) NOPASSWD: /sbin/halt -p
192 m-operator ALL=(ALL) NOPASSWD: /sbin/reboot
193 </src>
196 *** Automatic Login
198 On both Monikop's and Pokinom's host, change the line in
199 =/etc/inittab= that looks like
201 <src lang="conf">
202 1:2345:respawn:/sbin/getty 38400 tty1
203 </src>
205 into
207 <src lang="conf">
208 1:2345:respawn:/sbin/mingetty --autologin m-operator --noclear tty1
209 </src>
212 #Configure_Rsync_on_Sources
213 ** Configure Rsync on Sources
215 Install package rsync.
217 Example for =/etc/rsyncd.conf=:
219 <src lang="conf">
220 pid file=/var/run/rsyncd.pid
221 [data]
222     path = /mnt/hdd_0
223     use chroot = false
224     lock file = /var/lock/rsyncd
225     read only = yes
226     list = yes
227     transfer logging = false
228 </src>
230 In =/etc/default/rsync=, change the line
232 <src lang="conf">
233 RSYNC_ENABLE = false
234 </src>
238 <src lang="conf">
239 RSYNC_ENABLE = true
240 </src>
242 Start rsync server:
244 =# /etc/initd/rsync start=
246 or reboot.
249 On Windows, install
250 [[http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download][cwRsync]]. Click
251 Start, Programs, cwRsyncServer, rsyncd.conf; edit:
253 <src lang="conf">
254 use chroot = false
255 strict modes = false
256 hosts allow = *
257 logfile = rsyncd.log
258 [data]
259 #   /cygdrive/e/log stands for E:\log
260     path = /cygdrive/e/log
261     read only = false
262     transfer logging = false
263 </src>
265 Configure service RsyncServer: right-click My Computer; click Manage, Services
266 and Applications, Services, RsyncServer; set Startup Type to Automatic.
269 #Network_Setup
270 ** Network Setup
272 Depending on the amount of data to transfer, consider putting a
273 dedicated NIC for each Source into Monikop's machine.  In this case,
274 you should provide for non-overlapping subnets. [[http://jodies.de/ipcalc][IP-Calculator]] may be
275 helpful.
278 *** Monikop
280 **** Name the Sources
282 #etc_hosts
283 Example for =/etc/hosts=:
285 <src lang="conf">
286 127.0.0.1      localhost
287 192.168.200.10 data-producer1
288 192.168.200.20 data-producer2
289 192.168.200.30 data-producer3
290 192.168.200.50 data-producer4
291 192.168.178.1  monikop
292 </src>
295 **** Configure NICs
297 Example for =/etc/network/interfaces=:
298 <src lang="conf">
299 # The loopback network interface
300 auto lo
301 iface lo inet loopback
303 # Net of smaller Sources
304 allow-hotplug eth1
305 iface eth1 inet static
306    address 192.168.178.1
307    netmask 255.255.255.0
309 # Dedicated NIC for data-producer1
310 allow-hotplug eth2
311 iface eth2 inet static
312    address 192.168.200.9
313    netmask 255.255.255.248
315 # Dedicated NIC for data_producer2
316 allow-hotplug eth3
317 iface eth3 inet static
318    address 192.168.200.19
319    netmask 255.255.255.248
321 # Dedicated NIC for data_producer3
322 allow-hotplug eth4
323 iface eth4 inet static
324    address 192.168.200.29
325    netmask 255.255.255.248
327 # Dedicated NIC for data_producer4
328 allow-hotplug eth5
329 iface eth5 inet static
330    address 192.168.200.49
331    netmask 255.255.255.248
332 </src>
335 *** Data Sources
337 Use [[installation#etc_hosts][/etc/hosts]] as with Monikop. For Windows, it's =%SystemRoot%\system32\drivers\etc\hosts=.
340 **** Source's NIC
342 Example for =/etc/network/interfaces=:
344 <src lang="conf">
345 auto lo
346 iface lo inet loopback
348 # service (not relevant for Monikop)
349 allow-hotplug eth0
350 iface eth0 inet static
351    address 192.168.178.2
352    netmask 255.255.255.0
354 # Monikop's dedicated NIC
355 allow-hotplug eth1
356 iface eth1 inet static
357    address 192.168.200.10
358    netmask 255.255.255.248
359 </src>
361 For Windows, configure your network settings accordingly.
364 *** Pokinom
366 Pokinom's network settings don't need any special treatment. Just
367 integrate it into the office LAN Destination is connected to.
370 #Data_Destination
371 ** Data Destination
373 *** Rsync Server on Destination
375 Install package rsync.
377 Adapt =/etc/rsyncd.conf=, e.g.:
379 <src lang="conf">
380 gid = data_receiving_group
381 use chroot = yes
382 max connections = 0
383 pid file = /var/run/rsyncd.pid
385 [incoming]
386         path = /mnt/./raid_0
387         list = no
388         comment = Pokinom only; requires authentication
389         read only = no
390         incoming chmod = g+r,g+w
391         write only = yes
392         # Pokinom's IP:
393         hosts allow = 192.168.180.120
394         auth users = m-operator
395         secrets file = /etc/rsyncd.secrets
396 </src>
398 =/etc/rsyncd.secrets= contains Rsync's credentials which must
399 correspond to settings =$rsync_passwd= and =$rsync_username= in [[installation#pokinom.config][pokinom.config]]:
401 <src lang="conf">
402 m-operator:sEcReT
403 </src>
405 =/etc/rsyncd.secrets= must not be world-readable.
407 In =/etc/default/rsync=, change the line
409 <src lang="conf">
410 RSYNC_ENABLE = false
411 </src>
415 <src lang="conf">
416 RSYNC_ENABLE = true
417 </src>
419 Start rsync server:
421 =# /etc/initd/rsync start=
423 or reboot.
425 With the above, rsync puts the payload it receives into
426 =/mnt/raid_0/NEW_DATA/=. ("=NEW_DATA=" was set with
427 =$destination= in [[installation#pokinom.config][pokinom.config]].)
429 =NEW_DATA/= and everything inside belongs to user
430 nobody and group data_receiving_group.
432 If on Destination you can't do without Windows, install 
433 [[http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download][cwRsync]],
434 configure its =rsyncd.conf= accordingly, and set service rsync to
435 automatic start.
437 ; TODO: net topology for Monikop, for Pokinom