ICub laptop installation instructions for old releases

From Wiki for iCub and Friends
Revision as of 10:47, 14 January 2011 by Lorenzo (talk | contribs) (Code compilation)
Jump to: navigation, search

This page contains guidelines for installation of the iCub server so that it matches the requirements of the Linux on the pc104 (open call configuration).

We assume you have installed a working Debian or Ubuntu on the laptop. You can freely decide to install 32 bit or 64 bit, the code compiles on both architectures. Be aware that if you plan to share the repository with other machines, all machines need to have the same architecture (32 versus 64 bits, same versions of the libraries). A possibility would be to share the same code directory and different builds.

Creation of the icub user

You need to create the icub user. For nfs (see later) to work this user has to have the id 1000.

 adduser icub --uid 1000

Software Repository

The laptop hosts two directories and export them using nfs. One of these directories is mounted by the pc104 (/exports/code-pc104), the other is mounted by the other machines on the network and by the laptop iteself (/exports/code) (in the past this directory was named code-64, but the 64 bit suffix is no longer important).

For this to work you need:

  • install nfs server on the laptop:
 sudo apt-get install nfs-kernel-server nfs-common portmap
  • creates the directories that will be exported:
 mkdir /exports/code
 mkdir /exports/code-pc104

Respectively for the laptop/other machines and the pc104.

Set appropriate permissions to the icub user:

  sudo chown icub:icub -R /exports/code-pc-104
  sudo chown icub:icub -R /exports/code
  • Now configure the nfs-kernel-server:
Add these lines to /etc/exports:
 /exports/code 10.0.0.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)
 /exports/code-pc104 10.0.0.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)

You might need to restart the nfs server.

 /etc/init.d/nfs-kernel-server restart 

Or just reboot the machine.

  • Now configure the laptop to mount /exports/code to /usr/local/src/robot

Edit /etc/fstab and add:

 /exports/code   /usr/local/src/robot  none bind

Reboot or type:

 sudo mount -a

pc104 startup script direectory

During boot the pc104 executes a set of scripts; these scripts are stored inside a directory called 'hooks' that you need to create:

 mkdir /exports/code-pc104/pc104/hooks/

for now you can leave this directory empty, the compilation instructions for the pc104 contains steps for instaling the startup scripts.

Configuration of the icub user

  • Install the ssh keys for password-less login (on both the pc104 and the laptop):

Log in as icub.

 ssh -keygen - t dsa
 mkdir /home/code-pc104/hooks/keys
 cp /home/icub/.ssh/id_rsa.pub /exports/code-pc104/pc104/hooks/keys/authorized_keys 
 cp /home/icub/.ssh/id_rsa.pub /home/icub/.ssh/authorized_keys 

Brief explanation: on the pc105 one of the startup scripts will install the file authorized_keys to pc104:/home/icub/.ssh directory.

  • Configure bashrc. Add these lines in /home/icub/.bashrc:
 export ICUB_ROOT=/usr/local/src/robot/iCub
 export ICUB_DIR=$ICUB_ROOT/main/build
 export YARP_ROOT=/usr/local/src/robot/yarp2
 export YARP_DIR=$YARP_ROOT
 export ICUB_ROBOTNAME=NAME_OF_YOUR_ROBOT (e.g. iCubAberystwyth01)
 export PATH=$PATH:$ICUB_DIR/bin:$YARP_DIR/bin
  • Configure your system to source bashrc in non-interactive sessions. There is no clear consensus on how to do this. A possibility is to add them to /etc/environment or /home/icub/.profile (see also the page Debugging_problems_with_yarprun)

Other configurations

  • Install ssh-server:
 apt-get install ssh-server
  • It is handy to enable icub user to the sudoers

edit /etc/sudoers and add

 icub  ALL=(ALL) ALL
  • Enable NAT and port forwarding so that the pc104 (and other machines on the network) have internet access (using wlan0 as external network interface)

Add these line in /etc/rc.local:

 iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
 echo 1 > /proc/sys/net/ipv4/ip_forward
  • Clock synchronization. The internal clock of the pc104 resets every time the pc104 is restarted. It is important you configure your local network so that the pc104 has the correct time. In general it is a good idea if all the machines on the iCub network have synchronized clock. This page explains how to do this: Clock synchronization.
  • If your network does not have a dns it is a good idea to add the pc104 to /etc/hosts

Installation of the pc104

You have to use one of the Linux images we provide. This page contains some information about the Linux on the pc104, and important instructions for installing the startup scripts: The_Linux_on_the_pc104.

Code compilation

Now you can install YARP and the iCub software both on the laptop and on the pc104. Instructions are very similar, so we report only quick informations about the pc104.

Boot the pc104, login as icub. Checkout the code on /usr/local/src/robot. At the end you should have yarp and iCub directories. Compile following the instructions on the Manual.

In addition to the normal procedure, for compilation on the pc104 you have to follow the additional steps described in this page: Compilation_on_the_pc104