Armbian installation

Create the image for the SD-card

We will first create an image for the SD-card based on the fantastic work of Armbian.

Switch to a Ubuntu 14.04 based machine and execute the following commands (switch to root)

apt-get -y -qq install git
git clone --depth 1 https://github.com/igorpecovnik/lib
cp lib/compile.sh .

Then start the process via

./compile.sh KERNEL_CONFIGURE=yes

The script will guide you through the installation. If you plan on installing Docker, Docker depends on the following kernel parameters

Generally Necessary:
- CONFIG_NAMESPACES
- CONFIG_NET_NS
- CONFIG_PID_NS
- CONFIG_IPC_NS
- CONFIG_UTS_NS
- CONFIG_DEVPTS_MULTIPLE_INSTANCES
- CONFIG_CGROUPS
- CONFIG_CGROUP_CPUACCT
- CONFIG_CGROUP_DEVICE
- CONFIG_CGROUP_FREEZER
- CONFIG_CGROUP_SCHED
- CONFIG_CPUSETS
- CONFIG_MEMCG
- CONFIG_MACVLAN
- CONFIG_VETH
- CONFIG_BRIDGE
- CONFIG_BRIDGE_NETFILTER
- CONFIG_NF_NAT_IPV4
- CONFIG_IP_NF_FILTER
- CONFIG_IP_NF_TARGET_MASQUERADE
- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE
- CONFIG_NETFILTER_XT_MATCH_CONNTRACK
- CONFIG_NF_NAT
- CONFIG_NF_NAT_NEEDED
- CONFIG_POSIX_MQUEUE
Optional Features:
- CONFIG_USER_NS
- CONFIG_SECCOMP
- CONFIG_MEMCG_KMEM
- CONFIG_MEMCG_SWAP
- CONFIG_MEMCG_SWAP_ENABLED
- CONFIG_RESOURCE_COUNTERS
- CONFIG_BLK_CGROUP
- CONFIG_IOSCHED_CFQ
- CONFIG_BLK_DEV_THROTTLING
- CONFIG_CGROUP_PERF
- CONFIG_CGROUP_HUGETLB
- CONFIG_NET_CLS_CGROUP
- CONFIG_NETPRIO_CGROUP
- CONFIG_CFS_BANDWIDTH
- CONFIG_FAIR_GROUP_SCHED
- CONFIG_RT_GROUP_SCHED
- CONFIG_EXT3_FS
- CONFIG_EXT3_FS_XATTR
- CONFIG_EXT3_FS_POSIX_ACL
- CONFIG_EXT3_FS_SECURITY
- CONFIG_EXT4_FS
- CONFIG_EXT4_FS_POSIX_ACL
- CONFIG_EXT4_FS_SECURITY
- Storage Drivers:
  - "aufs":
    - CONFIG_AUFS_FS
  - "btrfs":
    - CONFIG_BTRFS_FS
  - "devicemapper":
    - CONFIG_BLK_DEV_DM
    - CONFIG_DM_THIN_PROVISIONING
  - "overlay":
    - CONFIG_OVERLAY_FS
  - "zfs":
    - /dev/zfs
    - zfs command
    - zpool command

so you might enable them according to your needs. You can also check the Armbian instruction page for more information.

After the build process finishes, you'll have the images ready in the output/images folder as .zip files.

Copy to SD-card

Install unzip

sudo apt-get install unzip

and unzip the image file

unzip yourimage.zip -d ./

You can mount the image to view its contents in the following way. Used parted to determine the start of the partition

parted yourimage.raw

As follows:

GNU Parted 2.3
Using /yourimage.raw
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit b
(parted) print                                                            
Model:  (file)
Disk /yourimage.raw: 1181564928B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start     End          Size         Type     File system  Flags
 1      1048576B  1181564927B  1180516352B  primary  ext4

(parted) q 

And then mount it using the offset flag

mount -t ext4 -o loop,offset=1048576 ./yourimage.raw /mnt/test

Don't forget to unmount again

umount /mnt/test

Check where your SD-card is located via

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

in my case it was /dev/mmcblk0. Then copy the image to the sd-card via

sudo dd if=yourimage.raw of=/dev/mmcblk0 bs=512; sync

Login via root:1234 and you are prompted to change your password. SSH is automatically enabled, so you should be able to ssh into the machine using the root account. Update first

apt-get update
apt-get upgrade

Boot from SSD

The armbian image comes with a script that automatically moves rootfs to an SSD

nand-sata-install

Simply follow the instructions.

Docker

First create a new user and password

useradd
sudo visudo

Install additional dependencies

apt-get install curl apt-transport-https

And add the Hypriot repository, as well as backports as the newest Docker version depends on newer libraries.

curl https://packagecloud.io/gpg.key | sudo apt-key add -
sudo bash -c 'cat > /etc/apt/sources.list.d/Hypriot_Schatzkiste.list' << EOF
deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ wheezy main
deb http://http.debian.net/debian jessie-backports main
EOF

Make updates and install

sudo apt-get update
sudo apt-get -y install --no-install-recommends docker-hypriot
sudo apt-get -y install cgroupfs-mount bridge-utils

Add your current user to the Docker group so you don't have to type sudo before every docker command.

sudo usermod -aG docker $(whoami)

Clean and update

sudo apt-get clean
sudo apt-get update

Reboot the machine, and check the docker version.

docker version

which should resemble something like this

Client:
 Version:      1.10.0
 API version:  1.22
 Go version:   go1.4.3
 Git commit:   590d5108
 Built:        Thu Feb  4 20:37:07 2016
 OS/Arch:      linux/arm

Server:
 Version:      1.10.0
 API version:  1.22
 Go version:   go1.4.3
 Git commit:   590d5108
 Built:        Thu Feb  4 20:37:07 2016
 OS/Arch:      linux/arm

If you get an error about the docker daemon, that means that upstart couldn't start the docker daemon. You can check the status of the service via

sudo service docker status

and check the flog files for errors in

nano /var/log/docker.log

You can then install other libraries such as docker-compose.

sudo apt-get install docker-compose

And now you have a cubietruck with an up-to-date kernel and Docker installed! Don't forget to change default username and password.