Installing HAiku on a Debian GNU/Linux OS

Haiku-on-Linux-HowTo.txt

How to install Haiku on Debian GNU/Linux OS

v0.3 last updated 2007-03-01


Julien Montavont montavontj(at)dpt(dash)info(dot)u(dash)strasbg(dot)fr

Guillaume Schreiner schreiner(at)clarinet(dot)u(dash)strasbg(dot)fr

Benoit Le Texier benoit(dot)letexier(at)enst(dash)bretagne(dot)fr

In this document, we will explain how to install Haiku on Debian GNU/Linux OS. Haiku is a web interface for Home Agent.

1. Configure your Home Agent and IPsec

- Retrieve and install MIPL2 from http://mobile-ipv6.org/software/

- Install the IPsec tools:

 # apt-get install ipsec-tools

2. Retrieve the source code of Haiku

- Install svn:

 # apt-get install subversion

- Get an account on jules.nautilus6.org and request to be a member of the haweb group

- Retrieve the source code of haiku:

 # svn checkout svn+ssh://username@jules.nautilus6.org/subvroot/haweb/trunk

3. Install the required packets

- Install at least the version 5.0 of mysql-server:

 # apt-get install mysql-server-5.0

Note: If you run a Debian stable, you can include the following repository into your /etc/apt/sources.list that includes a backport of mysql-server-5.0 packet:

 deb http://packages.dotdeb.org stable all
 deb-src http://packages.dotdeb.org stable all

- Get all stuff to run rubyonrails:

 # apt-get install ruby irb libopenssl-ruby1.8
 # apt-get install rake -t testing
 # apt-get install rails 
 # apt-get install libmysql-ruby1.8

Note: If you run a Debian stable, you have to include the testing repositories into /etc/apt/sources.list as rails is not available into stable release. In addition, set apt to get packets into stable release first:

 # echo "APT::Default-Release \"stable\";" >> /etc/apt/apt.conf

4. Configure the database

- Import the database structure into your database:

 # cd haweb/db/
 # cat structure.sql | mysql -u root -p

- Set login/password to enable haiku to access to the database

 # cp haweb/config/database.example haweb/config/database.yml

- Edit haweb/config/database.yml to set your login and password used to access to your database. Note that only root can access to the database by default.

5. Configure the web server

- Install apache2

 # apt-get install apache2

- Activate the mod_write module for apache2 (mod_env is already included into apache2 with Debian):

 # a2enmod rewrite

- Create the SSL certificate for https:

 # apache2-ssl-certificate

- Configure apache2 to listen on both 80 and 443 ports:

 # echo "Listen 443" >> /etc/apache2/ports.conf

- Add the followings into /etc/apache2/sites-available/default (between ServerAdmin and DocumentRoot lines):

 RewriteEngine On
 RewriteCond %{SERVER_PORT} !^443$
 RewriteRule ^(.*)$ https://name.domain [L,R]

- Load SSL module for apache2:

 # a2enmod ssl

- Download FastCGI for apache2 and eventually load it:

 # apt-get install libapache2-mod-fcgid
 # a2enmod fcgid

- Configure the virtual host:

 # touch /etc/apache2/sites-available/haiku-ssl

- Edit this file as follows:

 NameVirtualHost *:443
 <VirtualHost *:443>

 SSLEngine On
 SSLCertificateFile path/to/your/certificate

 SetEnv RAILS_ENV production
 ServerName your-hostname 

 DocumentRoot path/to/haweb/directory/public/ 
 ErrorLog path/to/haweb/directory/log/apache.log 

 <Directory path/to/haweb/directory/public/>
      Options ExecCGI FollowSymLinks 
      AddHandler cgi-script .cgi 
      AllowOverride all     
      Order allow,deny 
      Allow from all  
 </Directory> 

 </VirtualHost>

INFO: SSLCertificateFile value could be (for example and by default): /etc/apache2/ssl/apache.pem

- Create the symbolic link:

 # ln -s /etc/apache2/sites-available/haiku-ssl \
         /etc/apache2/sites-enabled/haiku-ssl

- Reload the service

 # /etc/init.d/apache2 force-reload

- Install sudo:

 # apt-get install sudo

- Edit /etc/sudoers to add your web daemon to the sudoers to run the setkey command without asking a password. Your file should be similar to:

 # User alias specification
 User_Alias      WWW = www-data

 # Cmnd alias specification 

 Cmnd_Alias      SETKEY = /usr/sbin/setkey 

 # User privilege specification
 root    ALL=(ALL) ALL
 WWW     ALL=NOPASSWD:SETKEY

6. Install and configure sendmail

 #apt-get install sendmail-bin

7. Configure Haiku

- Edit haweb/config/environments/user_environment.rb to set parameters related to the mailing feature

- Edit the file haweb/config/environment.rb and change the variable HA_FILES_ROOT to the place where you want to keep the information about the SA of the Mobile Nodes: -> HA_FILES_ROOT = "/usr/local/etc/ploup/"

Note: The directory HA_FILES_ROOT has to be writable by the web daemon. The easiest is to change the owner or the group of the directory.

- Install a script that will automatically load the SAD when the Home Agent boot. For example, you can use the followings:

 #!/bin/bash
 # Set security associations for every nodes already registered

 for node_dir in /usr/local/etc/ploup/*
 do
   if [ ${node_dir} != "/usr/local/etc/ploup/blocked_mns" ]
   then 
      setkey -f ${node_dir}/add
   fi
 done

8. Install the Live CD Creation process

On the live-cd generation machine

- Create a user called 'op-ha' on the server that you want to generate the live-cds. You can also use the same machine that is hosting the web interface.

 # useradd op-ha
   -> answer some questions

- Generate the structure:

 # su op-ha
 # mkdir ~/bin
 # mkdir ~/public_html
 # mkdir ~/config
 # mkdir ~/live-cd

- Copy the image of the live cd in ~/live-cd/

 # cd ~/live-cd/
 # wget http://demo.nautilus6.org/live-cd/n6-livecd_master_v0.1.tar.bz2
 # tar xjvf n6-livecd_master_v0.1.tar.bz2

- create a file called 'index.html' in '~/public_html' and add this type of content:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>

 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
 <meta http-equiv="refresh" content="0; url=<url_to_HAiku>" />
    <title>Redirection</title>
 <meta name="robots" content="noindex,follow" />
 </head>
 <body>
 <p><a href="<url_to_HAiku>">Redirection</a></p>
 </body>
 </html>

- Add/modify an Apache server on this machine (to permit to access to the live-cd ISO files)

 Alias /live-cd/ "/home/op-ha/public_html/"
  <Directory /home/op-ha/public_html/>
   AllowOverride all
   Order allow,deny
   Allow from all
 </Directory>

On the web interface machine (HA)

- First, we have to simplify the connection with the live-cd machine using some ssh-tools:

 # su 
 # ssh-keygen -t rsa
    -> For the passphrase, simply type enter

 # cat ~/.ssh/id_rsa.pub |  \
         ssh op-ha@<live-cd_machine> "cat - >>.ssh/authorized_keys"
 # exit

- Copy the file haweb/script/ha_bindings/create_n6_iso.sh to the 'bin' dir inside home dir of this new user:

 # scp haweb/script/ha_bindings/create_n6_iso.sh  \
       op-ha@<live-cd_generator_machine>:~/bin

- Modify the file haweb/script/ha_bindings/order_cd.sh, the following parameters:

 SERVER="<live_cd_machine>"
 HAIKU_TMP="path/to/your/haweb/tmp/directory" 

- Add a cron job that will order a live CD creation every 10 minutes (if needed). Add these lines in your '/etc/crontab':

 # Order Live CD every 10 minutes
 */10 * * * *   root    \
         <Path_to>/haweb/script/ha_bindings/order_cd.sh > /dev/null 2>&1

- Reload the cron daemon to take in account the modifications:

 # /etc/init.d/cron reload

- Modify the file 'haweb/app/views/live_cds/list.rhtml' to add the correct download address (about L58):

 <a href="https://<live_cd_machine>/live-cd/<%= live_cd.path %>
       ....Download</a>... 

- Change the group owner of the haweb/tmp directory to www-data and enable the writing right for the group on this directory

 # chgrp www-data haweb/tmp
 # chmod 771 haweb/tmp

- Enjoy ;)

 Nautilus6
 WIDE
Powered by PmWiki