Documentation.
[monikop.git] / doc / installation.muse
blob0d62d2ec6377b6c58e56d2d2db522e7349729252
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 install from a git repository: git-core;
16  - to run Monikop (on Rover) or Pokinom (in office): 
17    rsync, mingetty, sudo, libcurses-perl, libfile-rsync-perl;
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)]] and
117 =$ cd monikop=.
119 Copy =monikop.config.example= to =monikop.config= and
120 =pokinom.config.example= to =pokinom.config, respectively,= and
121 adapt them according to your needs. Both are perl code, so be careful
122 and keep the punctuation in place. 
124 #monikop.config
125 *** =monikop.config=
127 <include file="../monikop.config.example" markup="src" lang="perl">
129 For Monikop, change in [[installation#monikop.config][monikop.config]] at least:
131  - =%sources=: Data producing Sources on Rover in one of the formats Rsync
132    understands, together with a source-specific directory name where data
133    of the respective Source goes. Those directory names can be equal for
134    several Sources as long as all filenames in the payload are certain to be
135    unique.
137  - =@usable_mount_points=: Mount points (directories) you set up [[installation#fstab][earlier]] for your
138    removable disks.
140    
141 #pokinom.config
143 *** =pokinom.config=
145 <include file="../pokinom.config.example" markup="src" lang="perl">
147 For Pokinom you should edit in [[installation#pokinom.config][pokinom.config]] at least:
149  - =@usable_mount_points= (as with [[installation#monikop.config][monikop.config]])
150  - =$destination=: Data destination in one of the formats Rsync
151    understands; cf. setup of [[installation#Data_Destination][Data Destination]].
152  - =$rsync_username=, =$rsync_password=: credentials of (and only
153    known to) the Rsync server;
154    cf. setup of [[installation#Data_Destination][Data Destination]]. 
157 *** Automatic Program Start
159 Append to
160 =/home/m-operator/.profile= (create it if necessary):
162 <src lang="bash">
163 /home/m-operator/monikop/monikop
164 </src>
168 <src lang="bash">
169 /home/m-operator/monikop/pokinom,
170 </src>
172 respectively.
174 If necessary, specify path to config file, e.g.  
175 <src lang="bash">
176 /home/m-operator/monikop/monikop /home/m-operator/monikop/monikop.config
177 </src>
180 *** Setup Sudo
182 On both Monikop's and Pokinom's host authorise m-operator to shut down computer.
183 Use =visudo= to change =/etc/sudoers=; add:
185 <src lang="conf">
186 m-operator ALL=(ALL) NOPASSWD: /sbin/halt -p
187 m-operator ALL=(ALL) NOPASSWD: /sbin/reboot
188 </src>
191 *** Automatic Login
193 On both Monikop's and Pokinom's host, change the line in
194 =/etc/inittab= that looks like
196 <src lang="conf">
197 1:2345:respawn:/sbin/getty 38400 tty1
198 </src>
200 into
202 <src lang="conf">
203 1:2345:respawn:/sbin/mingetty --autologin m-operator --noclear tty1
204 </src>
207 #Configure_Rsync_on_Sources
208 ** Configure Rsync on Sources
210 Install package rsync.
212 Example for =/etc/rsyncd.conf=:
214 <src lang="conf">
215 pid file=/var/run/rsyncd.pid
216 [data]
217     path = /mnt/hdd_0
218     use chroot = false
219     lock file = /var/lock/rsyncd
220     read only = yes
221     list = yes
222     transfer logging = false
223 </src>
225 In =/etc/default/rsync=, change the line
227 <src lang="conf">
228 RSYNC_ENABLE = false
229 </src>
233 <src lang="conf">
234 RSYNC_ENABLE = true
235 </src>
237 Start rsync server:
239 =# /etc/initd/rsync start=
241 or reboot.
244 On Windows, install
245 [[http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download][cwRsync]]. Click
246 Start, Programs, cwRsyncServer, rsyncd.conf; edit:
248 <src lang="conf">
249 use chroot = false
250 strict modes = false
251 hosts allow = *
252 logfile = rsyncd.log
253 [data]
254 #   /cygdrive/e/log stands for E:\log
255     path = /cygdrive/e/log
256     read only = false
257     transfer logging = false
258 </src>
260 Configure service RsyncServer: right-click My Computer; click Manage, Services
261 and Applications, Services, RsyncServer; set Startup Type to Automatic.
264 #Network_Setup
265 ** Network Setup
267 Depending on the amount of data to transfer, consider putting a
268 dedicated NIC for each Source into Monikop's machine.  In this case,
269 you should provide for non-overlapping subnets. [[http://jodies.de/ipcalc][IP-Calculator]] may be
270 helpful.
273 *** Monikop
275 **** Name the Sources
277 #etc_hosts
278 Example for =/etc/hosts=:
280 <src lang="conf">
281 127.0.0.1      localhost
282 192.168.200.10 data-producer1
283 192.168.200.20 data-producer2
284 192.168.200.30 data-producer3
285 192.168.200.50 data-producer4
286 192.168.178.1  monikop
287 </src>
290 **** Configure NICs
292 Example for =/etc/network/interfaces=:
293 <src lang="conf">
294 # The loopback network interface
295 auto lo
296 iface lo inet loopback
298 # Net of smaller Sources
299 allow-hotplug eth1
300 iface eth1 inet static
301    address 192.168.178.1
302    netmask 255.255.255.0
304 # Dedicated NIC for data-producer1
305 allow-hotplug eth2
306 iface eth2 inet static
307    address 192.168.200.9
308    netmask 255.255.255.248
310 # Dedicated NIC for data_producer2
311 allow-hotplug eth3
312 iface eth3 inet static
313    address 192.168.200.19
314    netmask 255.255.255.248
316 # Dedicated NIC for data_producer3
317 allow-hotplug eth4
318 iface eth4 inet static
319    address 192.168.200.29
320    netmask 255.255.255.248
322 # Dedicated NIC for data_producer4
323 allow-hotplug eth5
324 iface eth5 inet static
325    address 192.168.200.49
326    netmask 255.255.255.248
327 </src>
330 *** Data Sources
332 Use [[installation#etc_hosts][/etc/hosts]] as with Monikop. For Windows, it's =%SystemRoot%\system32\drivers\etc\hosts=.
335 **** Source's NIC
337 Example for =/etc/network/interfaces=:
339 <src lang="conf">
340 auto lo
341 iface lo inet loopback
343 # service (not relevant for Monikop)
344 allow-hotplug eth0
345 iface eth0 inet static
346    address 192.168.178.2
347    netmask 255.255.255.0
349 # Monikop's dedicated NIC
350 allow-hotplug eth1
351 iface eth1 inet static
352    address 192.168.200.10
353    netmask 255.255.255.248
354 </src>
356 For Windows, configure your network settings accordingly.
359 *** Pokinom
361 Pokinom's network settings don't need any special treatment. Just
362 integrate it into the office LAN Destination is connected to.
365 #Data_Destination
366 ** Data Destination
368 *** Rsync Server on Destination
370 Install package rsync.
372 Adapt =/etc/rsyncd.conf=, e.g.:
374 <src lang="conf">
375 gid = data_receiving_group
376 use chroot = yes
377 max connections = 0
378 pid file = /var/run/rsyncd.pid
380 [incoming]
381         path = /mnt/./raid_0
382         list = no
383         comment = Pokinom only; requires authentication
384         read only = no
385         incoming chmod = g+r,g+w
386         write only = yes
387         # Pokinom's IP:
388         hosts allow = 192.168.180.120
389         auth users = m-operator
390         secrets file = /etc/rsyncd.secrets
391 </src>
393 =/etc/rsyncd.secrets= contains Rsync's credentials which must
394 correspond to settings =$rsync_passwd= and =$rsync_username= in [[installation#pokinom.config][pokinom.config]]:
396 <src lang="conf">
397 m-operator:sEcReT
398 </src>
400 =/etc/rsyncd.secrets= must not be world-readable.
402 In =/etc/default/rsync=, change the line
404 <src lang="conf">
405 RSYNC_ENABLE = false
406 </src>
410 <src lang="conf">
411 RSYNC_ENABLE = true
412 </src>
414 Start rsync server:
416 =# /etc/initd/rsync start=
418 or reboot.
420 With the above, rsync puts the payload it receives into
421 =/mnt/raid_0/NEW_DATA/=. ("=NEW_DATA=" was set with
422 =$destination= in [[installation#pokinom.config][pokinom.config]].)
424 =NEW_DATA/= and everything inside belongs to user
425 nobody and group data_receiving_group.
427 If on Destination you can't do without Windows, install 
428 [[http://sourceforge.net/projects/sereds/files/cwRsync/4.0.3/cwRsyncServer_4.0.3_Installer.zip/download][cwRsync]],
429 configure its =rsyncd.conf= accordingly, and set service rsync to
430 automatic start.
432 ; TODO: net topology for Monikop, for Pokinom