How to prepare a Raspbian based AGILE SD image

From AGILE IoT Wiki
Jump to: navigation, search
  1. Download Raspbian lite (
  2. Burn to SD (e.g. with
  3. Modify the SD (note that you might have to eject and insert the SD card again to access it from your PC)
    1. Enable SSH by placing a file named ssh, without any extension, onto the boot partition of the SD card. (based on )
touch ssh
  1. At this point, put the SD card into your Raspberry Pi 3, and boot it by connecting the power. The following instructions should all be executed on the Pi. If the Pi is connected to your LAN with an Ethernet cable, in most cases you can log in with `ssh pi@raspberrypi.local`. Otherwise, you can connect a screen and keyboard to the Pi and log in directly.

 # Remove some bulk

 sudo apt-get purge libreoffice wolfram-engine sonic-pi scratch
 sudo apt-get autoremove

 # Change password from raspberry to agileiot

 # Install prerequisites

 sudo apt-get update
 sudo apt-get install -y git

 # Install docker
 sudo dpkg -i docker-ce_17.05.0~ce-0~debian-jessie_armhf.deb
 rm docker-ce_17.05.0~ce-0~debian-jessie_armhf.deb
 sudo apt-get install -f -y
 sudo usermod -aG docker $USER

 # Install docker-compose

 sudo curl -L -o /usr/local/bin/docker-compose
 sudo chmod +x /usr/local/bin/docker-compose
 ## Alternative method if the above doesn't work
 # apt-get install -qy python-pip --no-install-recommends
 # pip install pip --upgrade
 # sudo apt-get install python-setuptools 
 # pip install docker-compose

 # Change hostname to agilegw
 sudo sed -i 's/raspberrypi/agilegw/' /etc/hostname
 sudo sed -i 's/raspberrypi/agilegw/' /etc/hosts

 # Disable Bluetooth in the host, it will be running containerized
 sudo systemctl stop bluetooth.service
 sudo systemctl disable bluetooth.service

 # Enable the I2C bus on the RPi header
 sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/' /boot/config.txt
 #sudo dtparam i2c_arm=on # to enable also on the fly

 # Get AGILE
 git clone --recursive
 git clone --recursive
 cd agile-cli/
 cp agile.config.examples/agile.config.raspbian agile.config
 sudo ./agile install

 # reboot
 sudo reboot
 # downoad agile and make it start on boot
 agile start

 sudo shutdown now

Enabling Docker remote management (optional)

Edit /lib/systemd/system/docker.service , changing ExecStart as follows:

 ExecStart=/usr/bin/dockerd -H fd:// -H tcp://

Prepare image from PC

 sudo umount /dev/mmcblk0p1
 sudo umount /dev/mmcblk0p2
 git clone
 sudo PiShrink/ -i /dev/mmcblk0 agile-rpi23.img