Difference between revisions of "ICub laptop installation instructions for old releases"

From Wiki for iCub and Friends
Jump to: navigation, search
(Creation of the icub user)
 
(72 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
'''These instructions only apply for YARP<=2.3.23 and iCub<=1.1.13 software versions'''
 +
 +
''See [[ICub laptop installation instructions]] for new instructions''
 +
 +
 
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).
 
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.
+
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 ==
 
== Creation of the icub user ==
Line 8: Line 13:
  
 
   adduser icub --uid 1000
 
   adduser icub --uid 1000
 +
 +
in LINUX starting procedure, it is asked to create the first user. By default uid is set at 1000.
 +
to make sure it is done do:
 +
  id -u icub
 +
you should get 1000
 +
if NOT, manage the possible different number uid (int he case you have more than one user on your pc). In order to get it, use this following command to manage the uid of the users
 +
  usermod -u [UID number] [username]
 +
for example in our case: usermod -u 1000 icub
  
 
== Software Repository ==
 
== 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-64).
+
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:
 
For this to work you need:
Line 17: Line 30:
 
* install nfs server on the laptop:
 
* install nfs server on the laptop:
 
   sudo apt-get install nfs-kernel-server nfs-common portmap
 
   sudo apt-get install nfs-kernel-server nfs-common portmap
 +
 
* creates the directories that will be exported:
 
* creates the directories that will be exported:
  
   mkdir /exports/code-64
+
   mkdir -p /exports/code
   mkdir /exports/code-pc104
+
   mkdir -p /exports/code-pc104
  
 
Respectively for the laptop/other machines and the pc104.
 
Respectively for the laptop/other machines and the pc104.
Line 26: Line 40:
 
Set appropriate permissions to the icub user:
 
Set appropriate permissions to the icub user:
  
   sudo chown icub:icub -R /exports/code-pc-104
+
   sudo chown icub:icub -R /exports/code-pc104
   sudo chown icub:icub -R /exports/code-64
+
   sudo chown icub:icub -R /exports/code
  
* Now configure the nfs-server:
+
* Now configure the nfs-kernel-server:
  
Add these lines to /etc/exports:
+
Add these lines to /etc/exports:
  
   /exports/code-64 10.0.0.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)
+
   /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)
 
   /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.
 
You might need to restart the nfs server.
  
   /etc/init.d/nfs-sever restart  
+
   /etc/init.d/nfs-kernel-server restart  
  
 
Or just reboot the machine.
 
Or just reboot the machine.
  
* Now configure the laptop to mount /exports/code-64 to /usr/local/src/robot
+
* Now configure the laptop to mount /exports/code to /usr/local/src/robot
  
 
Edit /etc/fstab and add:
 
Edit /etc/fstab and add:
 
    
 
    
   /exports/code-64   /usr/local/src/robot  none bind
+
   /exports/code  /usr/local/src/robot  none bind
  
 
Reboot or type:
 
Reboot or type:
 
    
 
    
   sudo mount -a  
+
   sudo mount -a
  
 
== Configuration of the icub user ==
 
== Configuration of the icub user ==
  
* Install ssh key.
+
* Install the ssh keys for password-less login, '''on the laptop''':
  
Log in as icub.
+
Log in as icub and create an ssh key. Leave all choises to default just by pressing return button
  
   ssh -keygen - t dsa
+
   ssh-keygen -t rsa
   cp /home/icub/.ssh/id_rsa.pub /exports/code-pc104/pc104/hooks/keys/authorized_keys
+
give this key file to pc104
  cp /home/icub/.ssh/id_rsa.pub /home/icub/ssh
+
   ssh-copy-id -i /home/icub/.ssh/id_rsa.pub icub@pc104
  
* Configure bashrc. Add these lines in /home/icub/.bashrc:
+
Brief explanation: on the pc104 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. '''Important''': these instructions go before the line that states "[ -z "$PS1" ] && return":
  
 
   export ICUB_ROOT=/usr/local/src/robot/iCub
 
   export ICUB_ROOT=/usr/local/src/robot/iCub
 
   export ICUB_DIR=$ICUB_ROOT/main/build
 
   export ICUB_DIR=$ICUB_ROOT/main/build
   export YARP_ROOT=/usr/local/src/robot/yarp2
+
   export YARP_ROOT=/usr/local/src/robot/yarp
   export YARP_DIR=$YARP_ROOT
+
   export YARP_DIR=$YARP_ROOT/build
 
   export ICUB_ROBOTNAME=NAME_OF_YOUR_ROBOT (e.g. iCubAberystwyth01)
 
   export ICUB_ROBOTNAME=NAME_OF_YOUR_ROBOT (e.g. iCubAberystwyth01)
 
   export PATH=$PATH:$ICUB_DIR/bin:$YARP_DIR/bin
 
   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 ==
 
== Other configurations ==
 +
 +
* Install ssh-server package:
 +
  apt-get install openssh-server
 +
 +
* Install python-tk package:
 +
  apt-get install python-tk
  
 
* It is handy to enable icub user to the sudoers
 
* It is handy to enable icub user to the sudoers
edit /etc/sudoers and add
+
edit /etc/sudoers and add, '''note:''' useless if you are working on Ubuntu
 
   icub  ALL=(ALL) ALL
 
   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)  
+
* '''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 lines in /etc/rc.local:
 +
  iptables -t nat -A POSTROUTING -o '''wlan0''' -j MASQUERADE
 +
  echo 1 > /proc/sys/net/ipv4/ip_forward
 +
where '''wlan0''' is the name of your system wireless communication so check if it is correct on the file /etc/udev/rules.d/70-persistent-net.rules you should get something like that:
 +
  # PCI device 0x14e4:0x4359 (wl)
 +
  SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c0:f8:da:76:23:8b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="'''wlan0'''"
 +
* '''Fix IP and Gateway'''
 +
On the same file as prior you should see another PCI device, it is the ethernet port, it looks like that
 +
  # PCI device 0x8086:0x1502 (e1000e)
 +
  SUBSYSTEM=="net", ACTION=="add",DRIVERS=="?*", ATTR{address}=="5c:26:0a:5d:77:2d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="'''eth0'''"
 +
where '''eth0''' is the number given by the system for the PCI board, use this number to set the file /etc/network/interfaces by removing everything and copy those lines
 +
  allow-hotplug eth0
 +
  iface eth0 inet static
 +
  address 10.0.0.1
 +
        netmask 255.255.255.0
 +
        gateway 10.0.0.1
 +
  #dns config - example for IIT configuration
 +
  #dns-search humanoids.iit.it
 +
        dns-nameservers 8.8.8.8
 +
  auto eth0
 +
* '''Clock synchronization''':
 +
Download the ntp package
 +
  sudo apt-get install ntp
 +
Your Laptop has to be the clock of the connection with the pc104 in case of no internet access so replace those lines from the file /etc/ntp.conf
 +
  server 0.ubuntu.pool.ntp.org
 +
  server 1.ubuntu.pool.ntp.org
 +
  server 2.ubuntu.pool.ntp.org
 +
  server 3.ubuntu.pool.ntp.org
 +
or comment them by adding a # in front each lines and add those lines instead
 +
  server 127.127.1.1
 +
  fudge 127.127.1.1 stratum 8 refid NIST
 +
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|Clock synchronization]].
 +
 
 +
* If your network does not have a dns it is a good idea to add the pc104 to /etc/hosts by adding the line:
 +
  10.0.0.10    pc104
  
Add these line in /etc/rc.local:
+
(note that in the past the pc104 ip address was 10.0.0.2. This it has been recently changed)
  
  iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
+
== Installation of the pc104 ==
  echo 1 > /proc/sys/net/ipv4/ip_forward
+
 
 +
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 installation ==
+
== 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.
 
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.
 
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 extra steps described in this page: [[Compilation_on_the_pc104]]

Latest revision as of 11:51, 22 October 2014

These instructions only apply for YARP<=2.3.23 and iCub<=1.1.13 software versions

See ICub laptop installation instructions for new instructions


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

in LINUX starting procedure, it is asked to create the first user. By default uid is set at 1000. to make sure it is done do:

 id -u icub

you should get 1000 if NOT, manage the possible different number uid (int he case you have more than one user on your pc). In order to get it, use this following command to manage the uid of the users

 usermod -u [UID number] [username]

for example in our case: usermod -u 1000 icub

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 -p /exports/code
 mkdir -p /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-pc104
  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

Configuration of the icub user

  • Install the ssh keys for password-less login, on the laptop:

Log in as icub and create an ssh key. Leave all choises to default just by pressing return button

 ssh-keygen -t rsa

give this key file to pc104

 ssh-copy-id -i /home/icub/.ssh/id_rsa.pub icub@pc104

Brief explanation: on the pc104 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. Important: these instructions go before the line that states "[ -z "$PS1" ] && return":
 export ICUB_ROOT=/usr/local/src/robot/iCub
 export ICUB_DIR=$ICUB_ROOT/main/build
 export YARP_ROOT=/usr/local/src/robot/yarp
 export YARP_DIR=$YARP_ROOT/build
 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 package:
 apt-get install openssh-server
  • Install python-tk package:
 apt-get install python-tk
  • It is handy to enable icub user to the sudoers

edit /etc/sudoers and add, note: useless if you are working on Ubuntu

 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 lines in /etc/rc.local:

 iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
 echo 1 > /proc/sys/net/ipv4/ip_forward

where wlan0 is the name of your system wireless communication so check if it is correct on the file /etc/udev/rules.d/70-persistent-net.rules you should get something like that:

 # PCI device 0x14e4:0x4359 (wl)
 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="c0:f8:da:76:23:8b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="wlan0"
  • Fix IP and Gateway

On the same file as prior you should see another PCI device, it is the ethernet port, it looks like that

 # PCI device 0x8086:0x1502 (e1000e)
 SUBSYSTEM=="net", ACTION=="add",DRIVERS=="?*", ATTR{address}=="5c:26:0a:5d:77:2d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

where eth0 is the number given by the system for the PCI board, use this number to set the file /etc/network/interfaces by removing everything and copy those lines

 allow-hotplug eth0
 iface eth0 inet static
 address 10.0.0.1
       netmask 255.255.255.0
       gateway 10.0.0.1
 #dns config - example for IIT configuration
 #dns-search humanoids.iit.it
       dns-nameservers 8.8.8.8
 auto eth0
  • Clock synchronization:

Download the ntp package

 sudo apt-get install ntp

Your Laptop has to be the clock of the connection with the pc104 in case of no internet access so replace those lines from the file /etc/ntp.conf

 server 0.ubuntu.pool.ntp.org
 server 1.ubuntu.pool.ntp.org
 server 2.ubuntu.pool.ntp.org
 server 3.ubuntu.pool.ntp.org

or comment them by adding a # in front each lines and add those lines instead

 server 127.127.1.1
 fudge 127.127.1.1 stratum 8 refid NIST

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 by adding the line:
 10.0.0.10    pc104

(note that in the past the pc104 ip address was 10.0.0.2. This it has been recently changed)

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 extra steps described in this page: Compilation_on_the_pc104