Telephone +44(0)1524 64544
Email: info@shadowcat.co.uk

Plat-forms server setup

Debian, VMWare, perl and lots of cursing

Sun Jan 16 20:00:00 2011

Digg! submit to reddit Delicious RSS Feed Readers

Tomorrow I fly to Neurnberg for the plat-forms competition. The (really quite cool) idea of the competition is to test out commercial viability of different web development platforms by getting together multiple teams for each platform and having them put together an application in 2 days. This year the represented platforms are Perl, Java, Ruby and PHP - sadly only two teams applied for Python so they aren't present this time around.

However, despite a disappointing absence of whitespace worshippers in snakeskin suits, it looks like it'll be a hell of a blast, and I'm really rather looking forwards to seeing how everybody's code takes shape over the course of the contest.

As part of our preparation, I've been installing up a VMWare Server 2 host that we'll be using for staging (and final delivery of the code). Quite how I ended up being volunteered for this task I'm not entirely ... oh, yes, I'm the one with the spare laptop1.

VMware Server 1, I got along fine with. I used to run it on my laptop to get a Debian VM for development purposes - though for reasons of battery life I've since moved to cygwin (with a brief stop off in colinux land on the way).

VMware Server 2, on the other hand ... um, guys? Guys?! What the flying fornication have you done to your product2? It now has a web interface instead of the GUI thing. Except the web interface mostly seems to be a way to serve 'loading' graphics. Oh, and the console is sort of a browser plugin except that just launches a desktop app which you can find and fire up yourself if you're willing to dig into the firefox plugin directory.

Oh, and best of all - it no longer supports non-server Windows OSen. It installs on non-server Windows OSen. It just doesn't appear to actually work.

So rather than just whacking it onto the windows that came on the thinkpad and then ignoring windows afterwards like I used to do with Server 1, it was time to break out a real OS - in my case, the latest snapshot of Debian 6 (hey, it's RC, it should be fine, right ...).

At which point I discover that it doesn't correctly handle kernels later than 2.6.25 or so out of the box, and descend into a twisty maze of forum posts, all with slightly different patches. I believe my mood after about an hour of trying patches that didn't work can be summed up as:

AAAAAAUUUUUUUGGGGGGGGHHHHHHHH

However, you will be happy to hear, there is a working patch out there - along with instructions - on a rise security article. Hosted on a server that appears to be dead (this may be temporary, hence the link). For those of you who don't want to dig through the google cache, I hereby present a summary thereof:

  • Get the patch from the original site or from my mirror of the patch

  • cd into /usr/local/src/vmware-server-distrib or whever you unpacked your VMWare tarball

  • run:

    cd lib/modules/source/
    for in in vmci vmmon vmnet vsock; do tar xf $i.tar; rm $i.tar; done
    cd ../../..
    patch -p1 <wherever.you.put.the.patch
    cd lib/modules/source/
    for in in vmci vmmon vmnet vsock; do tar cf $i.tar $i-only; done
    cd ../../..
    
  • and now you should be able to:

    perl vmware-install.pl # possibly with more sudo
    

Of course, this doesn't actually install the kernel modules. In order to do that, you want to do:

apt-get install linux-headers-$(uname -r)

which, interestingly, will pull in gcc-4.3 - that's because that's what the kernel was built with. Then you can run

CC=gcc-4.3 perl vmware-config.pl

and, at least in theory, all should work. It did for me, anyway (against 2.6.32-5-686 for reference).

That being done, I threw a Debian 6 install into a VM (some grumbling elided3), then switched it over to unstable - so my /etc/apt/sources.list ended up as:

deb http://ftp.uk.debian.org/debian/ sid main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ sid main contrib non-free

and updated everything:

apt-get update
apt-get dist-upgrade

then snapped on build tools, apache and postgresql -

apt-get install build-essential libapache2-mod-fastcgi postgresql-9.0

and then sat down to figure out what I was going to do about perl.

The OS came with 5.10.1, which will happily run everything we want - but a 5.12 seemed wise given the number of bugs fixed between then and now. Of course, I could just perlbrew one up in my home directory but I'll likely be doing my development on this machine and we'll need another user for QA so ... wait, why am I complicating this?

cd /usr/local/src
curl -L http://search.cpan.org/CPAN/authors/id/J/JE/JESSE/perl-5.12.2.tar.gz \
    | tar xzf -
cd perl-5.12.2
sh Configure -Dprefix=/usr/local/perl-5.12.2 -des
make test && make install

Next, I tweak my rsync based minicpan script and pull a mirror into /usr/local/cpan-mirror/mirror and then it's time to bootstrap some modules:

curl -L cpanmin.us | perl - -L /home/matthewt/perl5 \
    --mirror file:///usr/local/cpan-mirror/mirror --mirror-only \
    App::cpanminus local::lib \
    Catalyst::Devel DBIx::Class::Schema::Loader

This gives me - cpanminus - for installing everything CPAN from now on - local::lib - for making 'perl Makefile.PL' also install into the right place if I turn out to need it - the Catalyst development tools - and a recent DBIx::Class plus the tools to generate code from a db schema should we get handed one for whatever reason.

Finally, just to make sure they build, since I don't feel like fighting this later:

apt-get install libpq-dev libxml2-dev libxslt-dev
cpanm -L /home/matthewt/perl5 \
    --mirror file:///usr/local/cpan-mirror/mirror --mirror-only \
    DBD::Pg XML::LibXML XML::LibXSLT

and, I think, we're done.

There's bound to be a bunch of extra stuff I'm going to want of course, but this should do for a start. Plus it's sunday and I'm now officially sick of doing systems installation.

I'll write up another post later telling you how it went - meantime, hope some of this was of vague interest to people.

-- mst, out.


  1. By which I mean "I've borrowed a Shadowcat one nobody needed right now." ↩

  2. I am going to resist making an unnecessarily snarky comment about how, fundamentally, Server 2 exists to make people think they should buy the non-free-as-in-beer versions and actually nobody's supposed to run it all, but tl;dr - mstcat2 ↩

  3. Notably - the arrow keys didn't pass in through the console. Fortunately one can pretty much install Debian fine with just tab, enter and space. The only touch and go bit was making sure it didn't install all of gnome, but happily that option had the cursor over it so I could just hit space. Then install openssh-server from console, login from my normal laptop, and away. ↩