From the Canyon Edge -- :-Dustin

Friday, June 24, 2016

HOWTO: Host your own SNAP store!

SNAPs are the cross-distro, cross-cloud, cross-device Linux packaging format of the future.  And we're already hosting a fantastic catalog of SNAPs in the SNAP store provided by Canonical.  Developers are welcome to publish their software for distribution across hundreds millions of Ubuntu servers, desktops, and devices.

Several people have asked the inevitable open source software question, "SNAPs are awesome, but how can I stand up my own SNAP store?!?"

The answer is really quite simple...  SNAP stores are really just HTTP web servers!  Of course, you can get fancy with branding, and authentication, and certificates.  But if you just want to host SNAPs and enable downstream users to fetch and install software, well, it's pretty trivial.

In fact, Bret Barker has published an open source (Apache License) SNAP store on GitHub.  We're already looking at how to flesh out his proof-of-concept and bring it into snapcore itself.

Here's a little HOWTO install and use it.

First, I launched an instance in AWS.  Of course I could have launched an Ubuntu 16.04 LTS instance, but actually, I launched a Fedora 24 instance!  In fact, you could run your SNAP store on any OS that currently supports SNAPs, really, or even just fork this GitHub repo and install it stand alone..  See snapcraft.io.



Now, let's find and install a snapstore SNAP.  (Note that in this AWS instance of Fedora 24, I also had to 'sudo yum install squashfs-tools kernel-modules'.


At this point, you're running a SNAP store (webserver) on port 5000.


Now, let's reconfigure snapd to talk to our own SNAP store, and search for a SNAP.


Finally, let's install and inspect that SNAP.


How about that?  Easy enough!

Cheers,
Dustin

Monday, June 20, 2016

HOWTO: Classic, apt-based Ubuntu 16.04 LTS Server on the rpi2!

Classic Ubuntu 16.04 LTS, on an rpi2
Hopefully by now you're well aware of Ubuntu Core -- the snappiest way to run Ubuntu on a Raspberry Pi...

But have you ever wanted to run classic (apt/deb) Ubuntu Server on a RaspberryPi2?


Well, you're in luck!  Follow these instructions, and you'll be up in running in minutes!

First, download the released image (214MB):

$ wget http://cdimage.ubuntu.com/releases/16.04/release/ubuntu-16.04-preinstalled-server-armhf+raspi2.img.xz

Next, uncompress it:

$ unxz *xz

Now, write it to a microSD card using dd.  I'm using the card reader built into my Thinkpad, but you might use a USB adapter.  You'll need to figure out the block device of your card, and perhaps unmount it, if necessary.  Then, you can write the image to disk:

$ sudo dd if=ubuntu-16.04-preinstalled-server-armhf+raspi2.img of=/dev/mmcblk0 bs=32M
$ sync

Now, pop it into your rpi2, and power it on.

If it's connected to a USB mouse and an HDMI monitor, then you'll land in a console where you can login with the username 'ubuntu' and password 'ubuntu', and then you'll be forced to choose a new password.

Assuming it has an Ethernet connection, it should DHCP.  You might need to check your router to determine what IP address it got, or it sets it's hostname to 'ubuntu'.  In my case, I could automatically resolve it on my network, at ubuntu.canyonedge, with IP address 10.0.0.113, and ssh to it:

$ ssh ubuntu@ubuntu.canyonedge

Again, you can login on first boot with password 'ubuntu' and you're required to choose a new password.

On first boot, it will automatically resize the filesystem to use all of the available space on the MicroSD card -- much nicer than having to resize2fs yourself in some offline mode!

Now, you're off and running.  Have fun with sudo, apt, byobu, lxd, docker, and everything else you'd expect to find on a classic Ubuntu server ;-)  Heck, you'll even find the snap command, where you'll be able to install snap packages, right on top of your classic Ubuntu Server!  And if that doesn't just bake your noodle...

Cheers,
Dustin

Saturday, June 18, 2016

The Changelog Podcast -- Ubuntu Everywhere



I had the honor and privilege a couple of weeks ago, to participate in a recording of The Changelog, a podcast dedicated to Open Source technology: https://changelog.com/podcast/207

You can listen to it here.

These guys -- Jerod and Adam -- produce a fantastic show, and we covered a lot of ground!

Give it a listen, and follow the links at the bottom of their page (their site is hosted on Ubuntu, of course!) to learn more.

Cheers!
Dustin

Thursday, June 16, 2016

sudo purge-old-kernels: Recover some disk space!


If you have long-running Ubuntu systems (server or desktop), and you keep those systems up to date, you will, over time, accumulate a lot of Linux kernels.

Canonical's Ubuntu Kernel Team regularly (about once a month) provides kernel updates, patching security issues, fixing bugs, and enabling new hardware drivers.  The apt utility tries its best to remove unneeded packages, from time to time, but kernels are a little tricky, due to their version strings.

Over time, you might find your /boot directory filled with vmlinuz kernels, consuming a considerable amount of disk space.  Sometimes, sudo apt-get autoremove will clean these up.  However, it doesn't always work very well (especially if you install a version of Ubuntu that's not yet released).

What's the safest way to clean these up?  (This question has been asked numerous times, on the UbuntuForums.org and AskUbuntu.com.)

The definitive answer is:

sudo purge-old-kernels

You'll already have the purge-old-kernels command in Ubuntu 16.04 LTS (and later), as part of the byobu package.  In earlier releases of Ubuntu, you might need to install bikeshed, you can grab it directly from Launchpad or Github.

Here, for example, I'll save almost 700MB of disk space, by removing kernels I no longer need:

$ sudo purge-old-kernels 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-4.4.0-10-generic* linux-headers-4.4.0-12-generic* linux-headers-4.4.0-15-generic* linux-headers-4.4.0-16-generic*
  linux-headers-4.4.0-17-generic* linux-headers-4.4.0-18-generic* linux-image-4.4.0-10-generic* linux-image-4.4.0-12-generic*
  linux-image-4.4.0-15-generic* linux-image-4.4.0-16-generic* linux-image-4.4.0-17-generic* linux-image-4.4.0-18-generic*
  linux-image-extra-4.4.0-17-generic* linux-image-extra-4.4.0-18-generic*
0 upgraded, 0 newly installed, 14 to remove and 196 not upgraded.
After this operation, 696 MB disk space will be freed.
Do you want to continue? [Y/n] 

From the manpage:
purge-old-kernels will remove old kernel and header packages from the system, freeing disk space. It will never remove the currently running kernel. By default, it will keep at least the latest 2 kernels, but the user can override that value using the --keep parameter. Any additional parameters will be passed directly to apt-get(8).
Full disclosure: I'm the author of the purge-old-kernels utility.

Enjoy,
:-Dustin

Printfriendly