Beta box is the physical server that hosts a lot of the Akshara internal services. Currently it hosts

OS setup

The box runs an Debian Squeeze AMD64 Xen kernel. dom0 is Xen 4.1. Setting up the box was a bit tricky as it had to be done over an IPMI console from the EMS box. The IPMI viewer is available from The IP address for the KVM console is

To establish a VPN to the Nettigritty internal network, you need to use Windows. Go to and start the VPN client there. You can also go to and get a console using a Java applet. Please contact Shivangi/Alok? for login details.

The VPN tunnel is almost unsable if typing is needed. Keys will repeat and it is impossible to use the arrow keys. This is why the IPMI client was used from the EMS box. This box has been sunsetted and if we need console access an alternative plan will have to be made. There are no options on the table right now.


The box has twin 500GB SATA disks. There are three volume groups (each 250GB in size)

  • base
  • raid
  • vms

The raid volume group is backed by software RAID-1. This is mounted on /srv and should be used for all critical data. The base volume group holds the OS and the home directories. The vms vg should be used for all the xen images.


The box has two NICs. The IPs available to us are The primary public IP is The two interfaces are setup as:

# The loopback network interface
auto lo
iface lo inet loopback

# Private interface
auto eth0
iface eth0 inet static
        up ip route add via     

# Public interface
# We also have static IPs
allow-hotplug eth1
iface eth1 inet static
        # dns-* options are implemented by the resolvconf package, if installed

Traffic on the internal IPs is unmetered and does not count against the monthly quota. Our available IPs can be allocated via virtual eth1 interfaces.


The attached file plist.txt contains the packages that aptitude will need to replicate this box. The list was created as

 $ aptitude search -F '%100p' '~i!~M' > plist.txt

To replicate the setup on a new box:

 # xargs aptitude --schedule-only install < plist.txt
 # aptitude install

Apt cacher

apt-cacher-ng is used to provide a caching proxy for all the apt needs of the VMs. No configuration is necessary. The proxy will be available on port 3142.


Edit /etc/xen/xend-config.sxp to bring up the vif bridge. Create images using xen-create-image from xen-tools. The invocations are listed within each VM section below.

After setting up the VM, there is some housekeeping to be done. The script below will take care of it

adduser --ingroup staff alok
vi /etc/hosts # Add an entry for dom0 (
cat > /etc/apt/apt.conf.d/02proxy
Acquire::http::Proxy "http://dom0:3142";
apt-get update && apt-get install sudo
for i in sudo adm www-data dialout fax modem cdrom floppy tape audio dip src video users
    adduser alok $i


To create:

# xen-create-image --ip= --gateway= --lvm=vms \
--dist=squeeze --memory 2Gb --netmask= --broadcast= --swap 128Mb \
--size 32Gb --mirror=http://localhost:3142/debian --passwd

Launch with a console as:

# xm create -c

Run the above mentioned housekeeping script. FIXME: Automate this.

Packages needed

libtext-csv-perl libtext-csv-xs-perl python-webpy postgresql-8.4 postgresql-8.4-postgis postgresql-contrib-8.4 \
postgis apache2 bash-completion libapache2-mod-wsgi python-jsonpickle

Postgres Setup new (on Ubuntu 12.04 LTS)

  1. Confirm that you are on Ubuntu 12.04 LTS
    $ cat /etc/issue
    Ubuntu 12.04.4 LTS \n \l
  1. Edit the pgdg.list file and add the appropriate lines
$ sudo vim /etc/apt/sources.list.d/pgdg.list

and add the this line.

deb precise-pgdg main
  1. Get the apt-repository keys and add them locally
    $ wget --quiet -O - | sudo apt-key add -
  1. Refersh the repository cache with the new package names
$ sudo apt-get update
  1. Install the postgres server, pgadmin3 (if required), postgis extensions and dblink extensions
$ sudo apt-get install postgresql-9.3
$ sudo apt-get install pgadmin3
$ sudo apt-get install postgresql-9.3-postgis-2.1
$ sudo apt-get install postgresql-contrib-9.3


login to the db using psql

klpproduction# create role klpproduction login superuser

for klpwww db

klpwww# create role web superuser login
klpwww# create role klp superuser createdb login;
===  ===

Postgres setup (old - kept only for legacy reasons)Edit /etc/postgresql/8.4/main/postgresql.conf and point data_directory to /srv/postgresql/8.4/main. Copy everything in /var/lib/postgresql/8.4/main to /srv/postgresql/8.4/main chown & chgrp -R postgres postgresql/ (inside the /srv folder) Chmod 700 main (inside /srv/postgresql/8.4/ folder)

Create the klp user who will own the DBs

$ sudo -u postgres createuser -S -D -R -E -P klp

Similarly, create a web user who will have just enough privileges to read the data. Setup ident auth for your user for the above two users in pg_ident.conf if you wish to. Changes to the pg_hba.conf:

# Database administrative login by UNIX sockets
local   all         postgres                     ident
# "local" is for Unix domain socket connections only
local   all         all                               ident map=akmap

Fix the encoding problem that arises if locale is not setup right.

$ sudo -u postgres pg_dropcluster --stop 8.4 main
$ sudo -u postgres pg_createcluster --start -e UTF-8 8.4 main

If this does not work / corrupts the postgres installation follow - notes from comments here or rebuilding the template as here

To export the Share your story data,

$ pg_dump -U klp -d klpwww -t tb_sys_data -t tb_sys_qans -t tb_sys_images -f sys.dmp

This can be imported into the new DB using pg_restore.


To create:

# xen-create-image --ip= --gateway= --lvm=vms \
--dist=squeeze --memory 256Mb --netmask= --broadcast= --swap 128Mb \
--size 2Gb --mirror=http://localhost:3142/debian --passwd

Launch with a console as:

# xm create -c

Run the above mentioned housekeeping script. FIXME: Automate this. xen-tools can help.

There's an [ITP] for Debian but it's blocked by cgit's static linking of libgit. Until then, use the unofficial packages from Install lighttpd to serve as the web frontend. The lighty config is:

$HTTP["host"] == "" {
    alias.url = (
        "/static/" => "/usr/share/cgit/",
        "/" => "/usr/lib/cgi-bin/cgit.cgi",
    url.rewrite-once = (
        "^/static/.*$" => "$0",
        "^/([^?/]+/[^?]*)?(?:\?(.*))?$" => "/?url=$1&$2",
    cgi.assign = (
        "/usr/lib/cgi-bin/cgit.cgi" => "",

CGit reads its configuration from /etc/cgitrc


# xen-create-image --ip= --gateway= --lvm=vms \
--dist=squeeze --memory 256Mb --netmask= --broadcast= --swap 128Mb \
--size 2Gb --mirror=http://localhost:3142/debian --passwd

Launch with a console as:

# xm create -c

Run the above mentioned housekeeping script. FIXME: Automate this.

Install apache2 to serve as the web-frontend and trac. The apache2 config is:

<VirtualHost *:80>

    CustomLog /srv/trac/logs/access_log common
    ErrorLog /srv/trac/logs/error_log

    WSGIScriptAlias / /srv/trac/cgi-bin/trac.wsgi

    <Directory /srv/trac/cgi-bin>
        WSGIApplicationGroup %{GLOBAL}
        Order allow,deny
        Allow from all

    <Location /login>
        AuthType Basic
        AuthName "KLP Trac"
        AuthUserFile /home/trac/klp/conf/trac.htpasswd
        Require valid-user

    # Private URLs
    <Location /wiki/KLPProblems>
        Order deny,allow
        Deny from all
        Allow from
    <Location /wiki/RebuildPositionPaper>
        Order deny,allow
        Deny from all
        Allow from

Adding a note on BetaBackup

Last modified 5 years ago Last modified on 02/11/14 23:55:49

Attachments (1)

Download all attachments as: .zip