To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit c02246fe authored by beuchatp's avatar beuchatp

Improved the wiki descriptions for the installation and network configuration on Raspberry Pi

parent 6e08283c
# Raspberry Pi Installation
On this page:
- [Install ROS](#install-ros)
- [Install the python USB package](#install-the-python-USB-package)
- [Install the apache web server](#install-the-apache-web-server)
- [Install php](#install-php)
- [Clone the ``dfall-system`` repository](#clone-the-dfall-system-repository)
- [Allow git and catkin make over the web interface](#allow-git-and-catkin-make-over-the-web-interface)
- [Add the ``www-data`` user to the ``plugdev`` group](#add-the-www-data-user-to-the-plugdev-group)
- [Copy across the ``99 crazy rules``](#copy-across-the-99-crazy-rules)
- [Make the ``www-data`` user the owner of the ``/var/www/`` folder](#make-the-www-data-user-the-owner-of-the-var-www-folder)
- [Copy across the website](#copy-across-the-website)
- [Useful commands](#useful-commands)
## Install ROS
Download the appropriate installation script
Download the appropriate installation script using the following command:
```
dfall_install_ros_melodic_keys.sh
```
Change the permissions of the file to make it executable using the command:
```
dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh
chmod +x dfall_install_ros_melodic_keys.sh
```
Change the permissions of the file to make it executable using the command
Run the installation script using the command:
```
chmod +x dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh
./dfall_install_ros_melodic_keys.sh
```
Run the installation script using the command
This file only has two commands that are tedious to write out, but if you are patient then you can skip the above three commands and enter the following two commands:
```
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
```
./dfall_install_ros_melodic_ubuntu18_raspberry_pi.sh
```
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
```
The first command sets up the computer to accept software from ``packages.ros.org``, and the second command sets up the keys.
## Install the apache web server
Now install ROS Melodic using the following command:
```
sudo apt install apache2
sudo apt -y install ros-melodic-ros-base
```
Note, we install "ROS-Base: (Bare Bones)" because ubuntu server is a "headless" operating system, and hence does not require the graphical desktop feature of the "Desktop-Full" ROS installation.
## Install php
Initialise and update rosdep using the following commands:
```
sudo apt install php
sudo rosdep init
rosdep update
```
``rosdep`` enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.
## Permanently Disable IPv6
Taken from: https://www.configserverfirewall.com/ubuntu-linux/ubuntu-disable-ipv6/
Open the ``/etc/sysctl.conf`` file for editing:
If desired add the ROS environment setup to the ``.bashrc`` using the following command:
```
sudo nano /etc/sysctl.conf
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
```
Add the following lines at the end of the ``sysctl.conf`` file:
## Install the python USB package
This is needed to connected to the Crazyradio USB dongle.
Install the python package management system ``python-pip`` using the following command:
```
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
sudo apt -y install python-pip
```
To make the change take effect, enter the command:
Install the python USB package ``pyusb`` using the following command:
```
sysctl -p
sudo pip install pyusb
```
Then, enter the following command to check the IPv6 status:
## Install the apache web server
The apache web server can be installed with the following command:
```
less /proc/sys/net/ipv6/conf/all/disable_ipv6
sudo apt install apache2
```
If the output is 1 then IPv6 is disabled, otherwise, if the output 0 then IPv6 is enabled.
To re enable IPv6 addresses, simply remove the above changes made to the ``sysctl.conf`` file and then enter the ``sysctl -p`` command.
## Install php
Php can be installed with the following command:
```
sudo apt install php
```
## Clone the ``dfall-system`` repository
Create a shared folder
The web interface allows the user to upload certain files to the ``dfall-system`` repository and also to perform ``git`` and ``catkin_make`` actions on the repository. Hence the ``www-data`` requires write access to folder where the ``dfall-system`` repository is cloned. We choose to clone the repository into the base location ``/home/www-share`` as this is a natural location for data that can have accessed share between ``www-data`` and other users of the ubuntu server installation, namely the ``ubuntu`` user.
Create a shared folder using the follow sequence of commands:
```
cd /home
sudo mkdir www-share
......@@ -72,25 +112,40 @@ sudo -u www-data mkdir dfall
sudo -u www-data chmod 775 dfall
```
Clone the repository:
<br>
NOTE: very important here is that the repository is cloned as ``the www-data`` user.
Clone the repository as ``the www-data`` user using the following command
```
cd /home/www-share/dfall
sudo -u www-data git clone https://gitlab.ethz.ch/dfall/dfall-system
```
Add the necessary line to the ``/etc/sudoers`` file that allows the ``www-data`` user to execute ``git pull`` commands:
## Allow git and catkin make over the web interface
Open the ``/etc/sudoers`` file for editing:
```
sudo nano /etc/sudoers
```
Add the following line to the ``/etc/sudoers`` file that allows the ``www-data`` user to execute ``git pull`` commands:
```
www-data ALL=(www-data) /usr/bin/git pull
```
Note, this is line is most naturally included under the ``User privilege specification`` comment in the ``/etc/sudoers``, i.e.:
```
# User privilege specification
root ALL=(ALL) ALL
git ALL=(www-data) ALL
```
Add the ``www-data`` user to the ``plugdev`` group
<br>
NOTE: this is the group nominated in the ``udev rules`` for the CrazyRadio (see the ``install`` folder. This allows a CrazyRadio node that is launched by the web interface to access the CrazyRadio USB dongle.
## Add the ``www-data`` user to the ``plugdev`` group
Add the ``www-data`` user to the ``plugdev`` group using the following command:
```
sudo usermod -a -G plugdev www-data
```
NOTE: this is the group nominated in the ``udev rules`` for the CrazyRadio (see the ``install`` folder). This allows a CrazyRadio node that is launched by the web interface to access the CrazyRadio USB dongle.
To confirm the group allocation, view the ``group`` file using the command:
```
......@@ -104,12 +159,19 @@ deluser www-data plugdev
where the syntax here is: ``deluser <username> <groupname>``
## Copy across the 99.crazy.rules
## Copy across the ``99 crazy rules``
The following commands copy the rules necessary for using the Crazyradio:
```
sudo cp /home/www-share/dfall/dfall-system/install/99-crazyflie.rules /etc/udev/rules.d
sudo cp /home/www-share/dfall/dfall-system/install/99-crazyradio.rules /etc/udev/rules.d
```
## Make the ``www-data`` user the owner of the ``/var/www/`` folder
This is required so that the web interface can be update by calling a php script that deletes all the contents of the ``/var/www/`` folder and copies the web interface files from the ``dfall-system`` repository that was cloned to above the location ``/home/www-share/dfall``.
This is required so that the web interface can be updated by calling a php script that deletes all the contents of the ``/var/www/html/`` folder and copies the web interface files from the ``dfall-system`` repository that was cloned above to the location ``/home/www-share/dfall``.
Enter the following commands:
```
......@@ -118,14 +180,17 @@ sudo chgrp -R www-data /var/www
sudo chmod -R g+w /var/www
```
## Copy across the website
Enter the following command:
Use the following command to copy all the web interface files from the ``dfall-system`` repository (cloned above) to the ``/var/www/html`` folder from which the web interface is hosted:
```
sudo -u www-data cp -R /home/www-share/dfall/dfall-system/web_interface/html/* /var/www/html/
```
## Useful commands
The apache web server can be ``{stop,start,restart,reload}`` using the ``systemctl`` command as follows:
......
......@@ -136,7 +136,6 @@ https://www.raspberrypi-spy.co.uk/2014/08/how-to-reset-a-forgotten-raspberry-pi-
### Upgrade all software
This may be started automatically, and when you try the commands:
```
sudo apt update
sudo apt list --upgradable
......@@ -144,20 +143,17 @@ sudo apt upgrade
```
you may get the error:
```
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?
```
The answer is yes, another process is using ``dpkg`` and hence it is locked, and it is likely that the process is the automatic daily apt upgrade service. To list all the automatic timers managed by the system, enter the command:
```
systemctl list-timers
```
On the list you are like to see ``apt-daily.timer`` and ``apt-daily-upgrade.timer``. Alternatively, to check if the timers, and the services they trigger, are active, enter the following commands:
```
systemctl is-active apt-daily.timer
systemctl is-active apt-daily.service
......@@ -166,7 +162,6 @@ systemctl is-active apt-daily-upgrade.service
```
If the services are active, then it is recommended to allow time for them to complete, and then disable the services and timers with the following commands:
```
sudo systemctl disable apt-daily.service
sudo systemctl disable apt-daily.timer
......
# Raspberry Pi Installation
On this page:
- [Enable responding to broadcast pings](#enable-responding-to-broadcast-pings)
- [Permanently disable IPv6](#permanently-disable-ipv6)
- [Setup the ethernet network connection](#setup-the-ethernet-network-connection), with the following configurations detailed on this page:
- [Default configuration of a fresh Ubuntu install](#default-configuration-of-a-fresh-ubuntu-install)
- [Configuration when using a desktop environment](#configuration-when-using-a-desktop-environment)
- [Configuration for a fixed IP address](#configuration-for-a-fixed-ip-address)
- [Configuration for a dynamic IP address](#configuration-for-a-dynamic-ip-address)
- [Useful commands for debugging network discrepancies](#useful-commands-for-debugging-network-discrepancies)
## ENABLE RESPONDING TO BROADCAST PINGS
Taken from: https://www.theurbanpenguin.com/broadcast-icmp-in-linux-and-how-to-initiate-and-protect/
This makes it significantly easier to discover the IP address of the RaspberryPi when it is connected to a network, especially so if the [dynamic IP address](#configuration-for-a-dynamic-ip-address) network configuration is chosen.
Open the ``/etc/sysctl.conf`` file for editing:
```
sudo nano /etc/sysctl.conf
```
Add the following lines at the end of the ``sysctl.conf`` file:
```
net.ipv4.icmp_echo_ignore_all=0
net.ipv4.icmp_echo_ignore_broadcasts=0
```
To make the change take effect, enter the command:
```
sysctl -p
```
Then, enter the following command to check the "ignore broadcast" status:
```
less /proc/sys/net/ipv4/icmp/echo_ignore_broadcasts
```
If the output is 1 then broadcast pings are ignore, otherwise, if the output 0 then broadcast pings will be reponded to.
To again ignore broadcast pings, simply remove the above changes made to the ``sysctl.conf`` file and then enter the ``sysctl -p`` command.
## PERMANENTLY DISABLE IPv6
Taken from: https://www.configserverfirewall.com/ubuntu-linux/ubuntu-disable-ipv6/
It is not necessary to disable IPv6, but some forums mention that having IPv6 can cause unexpected network behaviour under certain circumstancs.
Open the ``/etc/sysctl.conf`` file for editing:
```
sudo nano /etc/sysctl.conf
```
Add the following lines at the end of the ``sysctl.conf`` file:
```
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
```
To make the change take effect, enter the command:
```
sysctl -p
```
Then, enter the following command to check the IPv6 status:
```
less /proc/sys/net/ipv6/conf/all/disable_ipv6
```
If the output is 1 then IPv6 is disabled, otherwise, if the output 0 then IPv6 is enabled.
To re enable IPv6 addresses, simply remove the above changes made to the ``sysctl.conf`` file and then enter the ``sysctl -p`` command.
## SETUP THE ETHERNET NETWORK CONNECTION
The networking is handled by ``netplan`` and hence network specifications are contained in the ``/etc/netplan`` folder. A comprehensive set of example configurations are available here:
<br>
https://netplan.io/examples
<br>
The following configurations are detailed on this page:
- [Default configuration of a fresh Ubuntu install](#default-configuration-of-a-fresh-ubuntu-install)
- [Configuration when using a desktop environment](#configuration-when-using-a-desktop-environment)
- [Configuration for a fixed IP address](#configuration-for-a-fixed-ip-address)
- [Configuration for a dynamic IP address](#configuration-for-a-dynamic-ip-address)
- [Useful commands for debugging network discrepancies](#useful-commands-for-debugging-network-discrepancies)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment