home.


Tagged: unix-debian


Installing Docker in Debian (testing/Jessie)

You need to be running a 3.8 kernel or above, hence the need for Jessie and the installation of that kernel.

You need to install golang, and specially 1.2 or above else you’ll get ipv6 errors, too. Get it from golang.org

You also need to have lxc and aufs-tools

apt-get install lxc aufs-tools

Then you need to setup your GOPATH environmental variable, create the docker directory in the src directory and clone docker into that.

export GOPATH=/your/go/directory
cd $GOPAth
mkdir -p src/github.com/dotcloud/
cd src/github.com/dotcloud
git clone https://github.com/dotcloud/docker

Then cd into the docker directory to use golang to pull all the dependencies and install docker into your GOPATH’s bin directory

cd docker
go get -v github.com/dotcloud/docker/...
go install -v github.com/dotcloud/docker/...

(The three dots mean do this for all the packages under said directory)

You should be able to run docker via

$GOPATH/bin/docker

Before you can run a docker image you need to mount cgroups. Put this in your /etc/fstab

none        /cgroup        cgroup        defaults    0    0

And then run

mkdir /cgroup && mount -a

You also need to enable ipv4 forwarding else your container won’t be able to talk to the outside world.

sysctl -w net.ipv4.ip_forward=1

Finally you need to run docker as a daemon, and as root, too.

$GOPATH/bin/docker -d &
2013/10/19 23:15:48 WARNING: cgroup mountpoint not found for memory
2013/10/19 23:15:48 Listening for HTTP on /var/run/docker.sock (unix)

Now you can issue a pull request to get the base 120MB ubuntu container from the internet.

$GOPATH/bin/docker pull ubuntu

After it’s downloaded it all, you can now use that container.

$GOPATH/bin/docker run ubuntu echo 'omg'

This should product something like

2013/10/19 23:22:55 POST /v1.6/containers/create
2013/10/19 23:22:55 POST /v1.6/containers/3fe0676d7e00/attach?stderr=1&stdout=1&stream=1
2013/10/19 23:22:55 POST /v1.6/containers/3fe0676d7e00/start
omg
2013/10/19 23:22:55 GET /v1.6/containers/3fe0676d7e00/json
unix unix-debian docker

Debian: Setting up Postgresql 9.1 on Debian Squeeze

First add the squeeze backports to /etc/apt/sources.list:

    deb http://backports.debian.org/debian-backports squeeze-backports main

Then issue:

    apt-get update
    apt-get -t squeeze-backports install postgresql-9.1

Then login as the postgres user and start up psql:

    su - postgres
    psql

Now create a new user with a new password and create a database as that user:

    create user myuser password 'mypassword'
    create database mydatabase owner myuser;
    \q

Now you’ve exited psql, log out of the postgres unix user, and attach the the postgres program remotely:

    <ctrl-d>
    psql -h localhost -U myuser -d mydatabase

Now it’ll ask you to enter in the password ‘myuser’. You can now start issuing sql commands. Or \? to see help for psql commands.

unix unix-debian postgresql

Debian: Stopping a service from starting at startup

To remove a service, apache2 in this case, from running at all runlevels:

 update-rc.d -f apache2 remove

This will remove the apache2 file (located in /etc/init.d/) symlink from all the /etc/rcX.d/ directories.

To simply stop a service:

 service apache2 stop

You can replace stop with start to start it.

unix unix-debian unix-debian-services

Installing the 32bit multiarch compatibility

To use a program compiled for 32 bit, the Android development tools for example, you need the ia32 compatibility package if you’re using 64 bit.

First add i386 to your list of architectures, update apt-get then install ia32

 dpkg --add-architecture i386
 apt-get update
 apt-get install ia32-libs

If you need to install a 32 bit version of something, issue the command as normal but with :i386 appended:

 apt-get install libncurses5:i386
unix unix-debian-ia32 unix-debian

Page 1 of 1