Ubuntu 16.04: Custom ROS Kinetic ISO using Ubuntu Desktop

Install Prerequisites in the build machine

sudo apt-get -y install uck syslinux syslinux-utils
  • UCK needs a working directory. By default it is ~/tmp

  • All UCK tools require root privileges for mounting and unmounting

  • When this is done, the root filesystem will be located in ~/tmp/remaster-root

Mount source ISO image

sudo uck-remaster-unpack-iso ubuntu-16.04.4-desktop-amd64.iso
sudo uck-remaster-unpack-rootfs

Change root to the image filesystem. Now you can install packages using apt-get

sudo uck-remaster-chroot-rootfs

Add Ubuntu repository list

cat | awk '$0' <<END > /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
END

Add ROS repository

# Accept software from packages.ros.org
sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# Setup repository keys
apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

Update repository list and upgrade linux packages

apt-get -y update
apt-get -y upgrade

Install ROS Kinetic Desktop Full package

apt-get -y install ros-kinetic-desktop-full

Setup environment variables

grep -q -F "source /opt/ros/kinetic/setup.bash" /etc/bash.bashrc || echo 'source /opt/ros/kinetic/setup.bash' | tee --append /etc/bash.bashrc

Change the environment of your current shell

source /etc/bash.bashrc

Install Aziro dependancies

apt-get install -y vim libopencv-dev ros-kinetic-opencv-candidate python-rosinstall python-rosinstall-generator python-wstool build-essential libconfig++-dev ros-kinetic-serial ros-kinetic-navigation ros-kinetic-yocs-cmd-vel-mux ros-kinetic-frontier-exploration ros-kinetic-rviz-visual-tools ros-kinetic-joy ros-kinetic-joy-teleop ros-kinetic-teleop-twist-joy ros-kinetic-urg-node ros-kinetic-usb-cam libopenni2-0 dh-make devscripts

Install some management tools

apt-get install -y openssh-server htop

Remove software that you don't need

apt-get remove libreoffice-core libreoffice-common thunderbird --purge -y
apt-get remove unity-lens-shopping --purge -y
apt-get autoremove --purge -y

Initialize rosdep

# Run this as root
rosdep init

Create Aziro User

adduser --gecos "Aziro" aziro
Password: aziro@zone

Add Aziro user into sudoers group

usermod -aG sudo aziro

Avoid password prompt when executing the sudo commands. Add the following line into /etc/sudoers

aziro ALL=(ALL:ALL) NOPASSWD: ALL

Disable APT updates.

cat | awk '$0' <<END > /etc/apt/preferences
Package: *
Pin: release *
Pin-Priority: -1
END

Clear terminal history and exit from the chroot

cat /dev/null > ~/.bash_history && history -c && exit

Now you can create the remastered ISO image. You MUST exit from the chroot before creating the ISO. Remastered ISO file can be found under ~/tmp/remaster-new-files

exit
sudo uck-remaster-pack-rootfs -c
sudo uck-remaster-pack-iso aziro-ubuntu-16.04.4-desktop-amd64-$(date '+%Y%m%d%H%M%S').iso -h -g -d "Aziro Ubuntu"

References: