Installing surfer on funtoo
2012-04-28Surfer is a program for visualizing algebraic surfaces. Since I need it for my algebraic geometry class, I wanted it to compile and install on my funtoo machines, however the usual configure, make, make install procedure failed and I needed two additional steps to make it work. Here is how I installed it locally, with the sources in /usr/local/src and the binaries installed to /usr/local/bin.
First we need to fetch the sources:
cd /usr/local/src # if it doesn't exist, create it
wget http://data.imaginary2008.de/software/surfer/surfer.tar.bz2
mkdir surfer
cd surfer
tar -xf ../surfer.tar.bz2
Next we first need to install surf, which is a project on which surfer is
based. Luckily the sources come with surfer, so we just need to extract them
and install them:
tar -xf surf-for-surfer.tar.gz
cd surf
sh configure --disable-gui
make && make install
cd ..
Now comes the part where I needed to add some tweaks. First we run ./configure as usual, however when you try to run make you will get the
following:
cd . && /bin/sh /usr/local/src/surfer/missing --run automake-1.10 --gnu Makefile
aclocal.m4:16: warning: this file was generated for autoconf 2.61.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.
configure.in:6: version mismatch. This is Automake 1.10.3,
configure.in:6: but the definition used by this AM_INIT_AUTOMAKE
configure.in:6: comes from Automake 1.10.1. You should recreate
configure.in:6: aclocal.m4 with aclocal and run automake again.
Makefile.am:6: `pg_DATA' is used but `pgdir' is undefined
make: *** [Makefile.in] Error 1
To fix the first issue, just type aclocal and you're good to go. However,
the second issue needs a small addition to Makefile.am: just before the line
that says pg_DATA = gallery.tar add pgdir = $(pkgdatadir). Now we can run
"make && make install" as usual.
Finally we can invoke the program via surfer and enjoy some algebraic
surfaces, for example this beautiful smooth algebraic set for the polynomial x^2-yz+xz-x.

Bridging and firewalling KVM guests on debian with shorewall
2011-12-27This post is mainly for documentation purposes, since this is a task one does not have to do on a daily basis and it always takes some time to get back into the matter. The scenario is a debian kvm host, running libvirt for kvm virtual machines and shorewall for firewalling. The ip address of the guest shall be 192.0.43.10 (example.org).
First we want to configure the network interface eth0 as bridge, which we'll call vmbr0. For this we edit the /etc/network/interfaces so it contains the following:
iface eth0 inet manual
auto vmbr0
iface vmbr0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_fd 0
up route add -host 192.0.43.10 dev vmbr0
down route del -host 192.0.43.10 dev vmbr0
Now we can assign our virtual machine the device vmbr0 as bridge, for example via <source bridge='vmbr0'/> in the respective xml-file in /etc/libvirt/qemu/ or via virt-manager. Next we need to configure shorewall; for this we copy an example from /usr/share/doc/shorewall/examples/ into /etc/shorewall/ and change every entry from eth0 to vmbr0, so vmbr0 is associated with the zone net. Now we can edit the rules file to something like this:
# the virtual machine shall have unrestricted access
ACCEPT net:192.0.43.10 net
# sshing and pinging shall be allowed from everywhere
SSH(ACCEPT) net net:192.0.43.10
Ping(ACCEPT) net net:192.0.43.10
# we want http to only be accessible from our /16 subnet
ACCEPT net:192.0.0.0/16 net:192.0.43.10 tcp 80
ACCEPT net:192.0.0.0/16 net:192.0.43.10 tcp 443
# reject everything that's not explicitly allowed
REJECT net net:192.0.43.10
And this was all. Not very hard to do, but if you don't add guests very often, it's easy to forget how to setup a bridge in debian or in which order shorewall matches the rules, namely going through them in order and apply one as soon as it matches.