UbuntuCore is the rolling release of Ubuntu.
It is self updating and completely built out of snap packages (including kernel, boot loader and root file system) which provides transactional updates, manual and automatic roll-back and a high level of system security to all parts of the system.
Once installed you have a secure zero maintenance OS that you can easily turn into a powerful appliance by simply adding a few application snaps to it.
The raspberry Pi3 comes with WLAN and ethernet hardware on board, which makes it a great candidate to turn it into a WiFi AccessPoint. But why stop here ? With UbuntuCore we can go further and install a WebRTC solution (like spreedme) for making in-house video calls or an UPNP media server to serve our music and video collections, an OpenHAB home automation device … or we can actually turn it into a personal cloud using the nextcloud snap.
The instructions below walk you through a basic install of UbuntuCore, setting up a WLAN AP, adding an external USB disk to hold data for nextcloud and installing the nexcloud snap.
You need a Raspberry Pi3 and an SD card.
Create an account at https://login.ubuntu.com/ and upload your public ssh key (~/.ssh/id_rsa.pub) in the “SSH Keys” section. This is where your UbuntuCore image will pull the ssh credentials from to provide you login access to the system (by default UbuntuCore does not create a local console login, only remote logins using this ssh key will be allowed).
Download the image from:
…or if you are brave and like to live on the edge you can use a daily build of the edge channel (…bugs included 😉) at:
Write the image to SD:
Put your SD card into your PC’s SD card reader …
Make sure it did not get auto mounted (in case it did, do not use the filemanager to unmount but unmount it using the commandline (in the example below my USB card reader shows the SD as /dev/sdb to the system)):
ogra@pc~$ mount | grep /dev/sdb # check if anything is mounted ... ogra@pc~$ sudo umount /dev/sdb1 # unmount the partition ogra@pc~$ sudo umount /dev/sdb2 ogra@pc~$
Use the following command to write the image to the card:
ogra@pc~$ xzcat /path/to/ubuntu-core-16-pi3.img.xz | sudo dd of=/dev/sdb bs=8M ogra@pc~$
Plug the SD into your pi3, plug an ethernet cable and either a serial cable or a monitor and keyboard in and power up the board. Eventually you will se a “Please press enter” message on the screen, hitting Enter will start the installer.
Going through the installer …
Configure eth0 as default interface (the WLAN driver is broken in the current pi3 installer. Simply ignore the wlan0 device at this point):
Give your login.ubuntu.com account info so the system can set up your ssh login:
The last screen of the installer will tell you the ssh credentials to use:
Ssh into the board, set a hostname and call sudo reboot (to work around the WLAN breakage):
ogra@pc:~$ ssh firstname.lastname@example.org ... It's a brave new world here in Snappy Ubuntu Core! This machine does not use apt-get or deb packages. Please see 'snap --help' for app installation and transactional updates. ogra@localhost:~$ sudo hostnamectl set-hostname pi3 ogra@localhost:~$ sudo reboot
Now that we have installed our basic system, we are ready to add some nice application snaps to turn it into a shiny WiFi AP with a personal cloud to use from our phone and desktop systems.
Install and set up your personal WiFi Accesspoint:
ogra@pi3:~$ snap install wifi-ap ogra@pi3:~$ sudo wifi-ap.setup-wizard Automatically selected only available wireless network interface wlan0 Which SSID you want to use for the access point: UbuntuCore Do you want to protect your network with a WPA2 password instead of staying open for everyone? (y/n) y Please enter the WPA2 passphrase: 1234567890 Insert the Access Point IP address: 192.168.1.1 How many host do you want your DHCP pool to hold to? (1-253) 50 Do you want to enable connection sharing? (y/n) y Which network interface you want to use for connection sharing? Available are sit0, eth0: eth0 Do you want to enable the AP now? (y/n) y In order to get the AP correctly enabled you have to restart the backend service: $ systemctl restart snap.wifi-ap.backend 2017/04/29 10:54:56 wifi.address=192.168.1.1 2017/04/29 10:54:56 wifi.netmask=ffffff00 2017/04/29 10:54:56 share.disabled=false 2017/04/29 10:54:56 wifi.ssid=Snappy 2017/04/29 10:54:56 wifi.security=wpa2 2017/04/29 10:54:56 wifi.security-passphrase=1234567890 2017/04/29 10:54:56 disabled=false 2017/04/29 10:54:56 dhcp.range-start=192.168.1.2 2017/04/29 10:54:56 dhcp.range-stop=192.168.1.51 2017/04/29 10:54:56 share.network-interface=eth0 Configuration applied succesfully ogra@pi3:~$
Set up an USB key as permanently mounted disk:
Plug your USB Disk/Key into the Pi3 and immediately call the dmesg command afterwards so you can see the name of the device and its partitions … (in my case the device name is /dev/sda and there is a vfat partition on the device called /dev/sda1)
Now create /etc/systemd/system/media-usbdisk.mount with the following content:
[Unit] Description=Mount USB Disk [Mount] What=/dev/sda1 Where=/media/usbdisk Options=defaults [Install] WantedBy=multi-user.target
And enable it:
ogra@pi3:~$ sudo systemctl daemon-reload ogra@pi3:~$ sudo systemctl enable media-usbdisk.mount ogra@pi3:~$ sudo systemctl start media-usbdisk.mount ogra@pi3:~$
Install the nextcloud snap:
ogra@pi3:~$ snap install nextcloud ogra@pi3:~$
Allow nextcloud to access devices in /media:
ogra@pi3:~$ snap connect nextcloud:removable-media ogra@pi3:~$
Wait a bit, nextclouds auto setup takes a few minutes (make some tea or coffee) …
Turn on https:
ogra@pi3:~$ sudo nextcloud.enable-https self-signed Generating key and self-signed certificate... done Restarting apache... done ogra@pi3:~$
Now you can connect to your new WiFi AP SSID and point your browser to https://192.168.1.1/ afterwards.
Add an exception for the self signed security cert (note that nextcloud.enable-https also accepts Let’s Encrypt certs in case you own one, just call “sudo nextcloud.enable-https -h” to get all info) and configure nextcloud via the web UI.
In the nextcloud UI install the “External Storage Support” from the app section and create a new local Storage pointing to the /media/usbdisk dir so your users can store thier files on the external disk.