Tuesday 22 July 2014

Using docker on Linux Mint Debian Edition


Installing Docker on LMDE takes a few steps and will require that we add a third-party repository.

Note: We will be logged in as root to issue these commands. Also, I am by no means an expert on this, I am learning this as I go on.

So, with that out of the way let's add the key for the get.docker.io repository;

# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Next add the repository to your apt sources;

# echo "deb http://get.docker.io/ubuntu docker main" > /etc/apt/sources.list.d/docker.list

Update apt;

# apt-get update

Install docker;

# apt-get install lxc-docker

Verify that it has worked by downloading and running the ubuntu container;

# docker run -i -t ubuntu /bin/bash
Unable to find image 'ubuntu' locally
Pulling repository ubuntu
e54ca5efa2e9: Download complete
511136ea3c5a: Download complete
d7ac5e4f1812: Download complete
2f4b4d6a4a06: Download complete
83ff768040a0: Download complete
6c37f792ddac: Download complete
root@46ec4b13f756:/#

Congratulations you are sitting in bash inside your ubuntu container. Type 'exit' or use ctrl-d to exit.

Note: It is important to understand that once you exit a container it ceases to run unless you specifically tell it not to (see below). It is not like a normal virtual machine that keeps on running in the background until you shut it down. To exit a container and have it remain running, use ctrl-p followed by crtl-q.

You probably dont want to be the root user every time you use docker. In that case simply add your user to the docker group;

# usermod -a -G docker myusername

You can list all the running containers with the 'docker ps' command. Add '-a to see the stopped ones as well.

Note: The containers that you create are kept in '/var/lib/docker/containers'

That's the basics of docker. The next thing to learn more about is using docker files to build containers.

Wednesday 2 July 2014

Libvirt/qemu/kvm as non-root user

Prerequisites:

A server with KVM

I'm going to use the qemu user that is created when you install KVM but you could use any user you like.

First, your user should belong to the kvm group:

grep kvm /etc/group kvm:x:36:qemu

Create a libvirtd group and add your user to it

groupadd libvirt
usermod -a -G libvirt qemu


Create a new policykit config to allow access to libvirtd using your user account via ssh

vi /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla

Add the following content:

[Remote libvirt SSH access]
Identity=unix-group:libvirt
Identity=unix-user:qemu
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes


Restart libvirt

service libvirtd restart

Tuesday 1 July 2014

Configuring a Printer With CUPS Web Admin

I couldn't get the printer admin applet in Mint to add a new printer. It just kept saying "Failed to add printer" every time.

Then I discovered that CUPS has a web admin page:

http://localhost:631

When it ask for a username & password just enter any user with sudo privileges and you are in.