Docker mit WSL auf Windows einrichten

Insbesondere bei der Einrichtung lokaler Entwicklungsumgebungen in der Linux-basierten Web-Welt eignet sich Docker hervorragend zur Entwicklung. Wer seine apache oder nginx-basierten Container baut oder vorkonfigurierte Varianten nutzt, wird schnell feststellen, dass diese nicht allzu performant laufen. Zumindest bei der einfachen Nutzung von Docker-Desktop unter Windows ohne WSL Integration. Da kann ein Seitenaufruf schon mal mehrere Minuten dauern, zumindest bei entsprechendem applikationsseitigem Workload.

Installation von WSL – Windows-Subsystem für Linux

Abhilfe schafft hier WSL, das Windows-Subsystem für Linux (siehe https://de.wikipedia.org/wiki/Windows-Subsystem_f%C3%BCr_Linux). Dieses steht seit Windows 10 (Version 1903) in der Version WSL 2 zur Verfügung. Im Grunde stellt Windows hiermit eine Kompatibilitätsschicht zur Verfügung, mit deren Hilfe Linux-Executables ausgeführt werden können. So lässt sich eine Linux-Distribution wie Ubuntu mehr oder weniger nativ in Windows ausführen. Mehr Details zu den technischen Hintergründen von WSL kann man im o.g. Wikipedia-Artikel oder direkt bei Microsoft unter folgendem Link erfahren: https://docs.microsoft.com/de-de/windows/wsl/about

Docker und WSL unter Windows

Docker wiederum unterstützt die WSL2-Integration von Windows, sprich die Docker-Container inklusive möglicher Mounts oder Volumes kann innerhalb der Linux-Distribution abgelegt werden, die wiederum nativ als Windows-App laufen wird.

Unser Vorgehen sieht also so aus:

  1. Aktivierung der WSL Komponenten unter Windows
  2. Installation einer alternativen Linux-Distribution unter Windows (optional)
  3. Installation von Docker-Desktop und Aktivierung von WSL2
  4. Ausführen eines Containers mit deutlich gestiegener Geschwindigkeit
  5. Fertig

Das Ganze ist fairly easy. Linux-Kenntnisse sind nicht wirklich erforderlich, der ganze Vorgang dauert im Grunde auch nur ein paar Minuten, allerdings nimmt das Herunterladen und Installieren der Software je nach Internetleitung und Rechnerleistung zusätzlich Zeit in Anspruch.

Achtung: Der Vorgang erfordert den zwischenzeitlichen Neustart des Rechners, man sollte also entsprechend darauf eingestellt sein!

Aktivierung der WSL Komponenten unter Windows

Der einfachste Weg hierfür führt über die Power-Shell, die aber in jedem Fall mit Administrator-Rechten ausgeführt werden muss. Dafür einfach die Windows-Taste drücken, dann „Powershell“ eintippen und mit der rechten Maustaste auf das PowerShell Symbol im Menu klicken und „Als Administrator ausführen“ auswählen.

Anschließend wird in der PowerShell folgender Befehl ausgeführt:

wsl –-install

Nach erfolgreicher Installation sieht das Ganze so aus:

Der Installationsvorgang von WSL meldet ja schon, dass ein Neustart erforderlich ist. Dieser müsste dann jetzt einmal durchgeführt werden. Nach dem Neustart startet Ubuntu in einer Konsole automatisch und setzt den Installationsprozess fort. Nach ggf. ein paar Minuten Wartezeit sollen Benutzername und Passwort vergeben werden. Das Passwort ist wichtig, um später ggf. Software innerhalb der Disitribution nachzuinstallieren. Daher nicht einfach irgendwas vergeben (das habe ich nun schon ein paar Mal im Netz gelesen). Passwort als im Idealfall via Password Manager generieren und speichern 😉

Nach der Installation müssen Benutzername und Passwort festgelegt werden.

Installation einer alternativen Linux-Distribution unter Windows

Stand heute (Juli 2022) steht bei der Installation von WSL via PowerShell nur Ubuntu 20.04 zur Verfügung. Diese Distribution wird auch standardmäßig mitinstalliert. Man hat zwar die Möglichkeit andere Distributionen zu installieren (Kommando „wsl -l -o“ listet die verfügbaren auf), allerdings ist Ubuntu 22.04 LTS aktuell keine davon.

Da ich gerne auf aktuellere Paketquellen zugreifen möchte (unter anderem um bsw. > php-8.X zu installieren), werde ich Ubuntu 22.04 als meine Standard-Distribution nachinstallieren. Dieser Vorgang ist allerdings optional. Wer mit Ubuntu 20.04 zurecht kommt, kann direkt zum nächsten Schritt weiter (Installation von Docker-Desktop und Aktivierung von WSL2)

Installation von Ubuntu 22.04 via Microsoft App Store

Die Installation ist relativ simpel, sie kann direkt via App Store erfolgen. Einfach nach Ubuntu suchen und die passende Version finden, anschließend auswählen und via „Herunterladen“ installieren.

Linux-Distribution initial öffnen

Nachdem die Linux-Distribution heruntergeladen wurde, erscheint im App-Store der Button „Öffnen“ – alternativ ist Ubuntu 22.04 jetzt natürlich auch über das Startmenu wie jede andere App zu öffnen. Wichtig beim ersten Öffnen ist allerdings, dass die Einrichtung stattfindet – in der unter anderem Benutzername und Passwort festgelegt werden. Bei den anderen Optionen können einfach die Standardeinstellungen übernommen werden.

Nach der Installation lässt sich Ubuntu öffnen.

Nach dem Öffnen findet erst einmal die Einrichtung statt, das kann auch schon mal ein paar Minuten dauern. Die Konfiguration und Vergabe von Benutzername und Passwort erfolgen danach geführt. Als Sprache habe ich „Deutsch“ ausgewählt, ansonsten die Standardeinstellungen übernommen.

Neue Linux-Distribution Ubuntu 22.04 als Standard WSL-Distribution konfigurieren

Nach der Installation kann überprüft werden, ob die Installation erfolgreich war. Dazu wird wieder in einer Powershell der Befehl

wsl -l -v

eingegeben. Dieser listet die installierten Linux-Distributionen auf:

Das Sternchen zeigt an, welche Distribution die Standardversion ist. „VERSION“ steht in diesem Fall für die WSL Version – in diesem Fall die Version 2, was genau der entspricht, die wir brauchen. Ich setze jetzt Ubuntu 22.04 als Standard-Distribution mit dem folgenden Befehl:

wsl –-set-default Ubuntu-22.04

Die Ausgabe ist leise, d.h. es erfolgt keine Meldung:

Wir verifizieren im Anschluss mit dem vorherigen Befehl, um zu überprüfen ob der Vorgang erfolgreich war:

wsl -l -v

Nicht mehr benötigte WSL Distribution deinstallieren

Damit ich nur noch auf die Ubuntu Version 22.04 zugreife und nicht versehentlich in der 20.04 lande, deinstalliere ich schlussendlich noch die 20.04er Version mit dem folgenden Kommando:

wsl –-unregister Ubuntu

Danach sieht das Ganze bei mir so aus:

Dieser Schritt ist allerdings nicht zwingend erforderlich, es ist überhaupt kein Problem, dass beide Distributionen parallel installiert sind (oder noch viele weitere).

Installation von Docker-Desktop und Aktivierung von WSL2

Jetzt wird einfach Docker für Windows installiert – dazu einfach auf https://www.docker.com/get-started/ runterladen und installieren. Bei der Installation ist „Use WSL 2 instead of Hyper-V (recommendend)“ schon vorausgewählt und sollte keinesfalls abgewählt werden.

Nach erfolgreicher Installation wird man aufgefordert, sich aus- und wieder einzuloggen. Ausgelogged wird man von Docker nach Betätigung des Buttons automatisch. Sobald man sich wieder einlogged, sollte Docker Desktop automatisch starten. Das Service Agreement muss noch akzeptiert werden.

WSL-Integration in Docker Desktop aktivieren

Nachdem Docker Desktop erfolgreich gestartet wurde, muss die WSL Integration für die Linux-Distribution noch aktiviert werden. Dazu via Zahnrad in die Einstellungen und unter General erst einmal sicherstellen, dass „Use the WSL 2 based engine“ aktiviert ist:

Danach unter „Resources > WSL Integration“ sicherstellen, dass diese für alle erforderlichen Distros aktiviert ist:

Ausführen eines Containers mit deutlich gestiegener Geschwindigkeit

So – fertig. Nun können Docker Container via WSL 2 benutzt werden. Wichtig dabei ist, dass die Installation und vor Allem das Mounten von Dateien oder Containern innerhalb der Linux-Distribution stattfinden sollten.

Das ist so wie so viel praktischer, weil die Handhabung, Installation usw. innerhalb einer nativen Linux-Umgebung (zumindest IMHO) viel einfacher ist und relevante Entwicklungswerkzeuge (wie bsw. composer) viel einfacher installiert und operiert werden können.

Zum Ausführen eines Containers öffne ich also zunächst die Ubuntu App (bsw. via Startmenu) und navigiere in einen geeigneten Ordner. Gestartet wird die Linux-Distribution immer im Home-Verzeichnis des Users, also in meinem Fall /home/simon/.

Ich lege dazu neue Verzeichnisse an und navigiere hinein:

mkdir projects
cd projects
mkdir demo
cd demo

Anschließend starte / installiere ich meine Container wie gewohnt, bsw. so:

docker run –name nginx-demo -p  8080:80 nginx

Docker muss nicht installiert warden, es steht ja durch die WSL Integration innerhalb der Linux-Distribution schon zur Verfügung. Docker lädt den Container automatisch runter und startet ihn:

Et voila – das hat funktioniert. Ich kann nun auf den Container via http mit meinem Windows-Browser zugreifen:

Das Ganze jetzt mit einer deutlich erhöhten Geschwindigkeit. Den Status meiner Docker Container und alles weitere kann ich wie gewohnt weiter über Docker Desktop sehen/machen:

Fertig

Als Nächstes stehen wir natürlich vor der Hürde, dass i.d.R. Verzeichnisse in die Container eingehangen werden müssen und an den Dateien gearbeitet werden muss. Git Operationen und alles andere kann ja einfach via Linux-Kommdandozeile durchgeführt werden. Für eine IDE klappt das so einfach natürlich nicht. Es gibt die unterschiedlichsten Wege das zu bewerkstelligen, der aus meiner Sicht einfachste und komfortabelste wäre eine IDE, die WSL unterstützt. Ich nutze dazu Visual Studio Code, welches eine eigene WSL Extension hat, mit der problemlos auf die Dateien innerhalb der Linux-Distro zugegriffen werden kann. Dazu einfach die WSL Extension in VS Code installieren und fertig 😉

Google’s eingerückte Suchergebnisse

In der letzten Zeit werde ich immer wieder nach eingerückten Ergebnissen gefragt. Auch wenn es dieses Feature ja nun wirklich schon ewig gibt, scheint noch längst nicht jeder zu wissen, was es damit eigentlich auf sich hat, daher hier mal eine kurze Erklärung:

Prinzipiell von eingerückten Ergebnissen zu sprechen ist eventuell sogar etwas irreführend. Ich spreche in diesem Zusammenhang lieber von gruppierten Ergebnissen, denn genau das ist es was da passiert: Google gruppiert Ergebnisse derselben Domain. Im Klartext heisst das, dass im Falle einer gruppierten Darstellung eigentlich zwei vollwertige Seiten von einer Domain zu einem Keyword in den Top-Ten platziert sind – es ranken also zwei verschiedene URLs zum gleichen Keyword. Die Position in der SERP bestimmt dabei die höchste Position, die einer der beiden URLs erreicht hat, der zweite URL wird dann direkt darunter eingerückt (gruppiert), unabhängig davon welche Position er eigentlich hat. Das heisst, wenn domain.com für Keyword “abz” auf Position 1 rankt und domain.com/unterseite für Keyword “abz” auf Position 6 rankt, dann wird domain.com/unterseite an zweiter Stelle als eingerücktes Ergebnis präsentiert, obwohl es eigentlich auf Position 6 stehen würde – die Suchergebnisse werden in dem Fall eben gruppiert. Veranschaulichen kann man das sehr schön an einem Beispiel. Suchen wir bei Google einmal nach “typo3”:

Google Suche Typo3 erste Seite 10 Ergebnisse
Google Suche für Keyword "typo3"

Wie wir sehr gut sehen kann werden an oberster Stelle gleich zwei Ergebnisse der Domain typo3.org präsentiert – hier werden Ergebnisse gruppiert. Um nun heruaszufinden an welcher Stelle das eingerückte Ergebnis typo3.org/download/ wirklich steht können wir mit dem Google-Paramter num herumspielen (dazu einfach &num=9) an den URL bei der Google-Suche anhängen. Angefangen bei 9 können wir den Parameter nun solange herunterzählen, bis Google das Ergebnis nicht mehr eingerückt darstellt. Im Beispiel ist das bei num=5. Link: http://www.google.de/#hl=de&source=hp&q=typo3&fp=1&cad=b&num=5

Google Suche Typo3 erste Seite 5 Ergebnisse

Wie wir sehen können ist das eingerückte Ergebnis unter typo3.org verschwunden. Wir sehen also, dass der URL typo3.org/download/ eigentlich an Position 6 gerankt ist, er wird auf Grund des doppelten Vorkommens der Domain typo3.org mit dem vorherigen Ergebnis gruppiert. Im Klartext heisst das aber auch, dass man mit einer zweiten Seite die eventuell nur auf Position 10 ist deutlich weiter oben angezeigt werden kann und man sich dadurch eine deutlich gesteigerte Präsenz in der SERP des jeweiligen Suchbegriffs sichern würde.

Die eigentliche Frage ist aber nun, was man mit dieser Information anfangen kann. Gruppierte Ergebnisse sind vor allem was die CTR angeht nicht zu unterschätzen. Wenn man beispielsweise für ein bestimmtes Keyword nur auf Position zwei oder drei steht, weil eventuell starke Autoritäts-Domains darüber platziert sind, an denen man nur mit ungleich hohen Kosten vorbei kommen würde, kann man unter Umständen darüber nachdenken eine zweite Seite der Domain in die Top-Ten zu bringen und sich durch die optische Überlegenheit trotz niedriger Position deutlich mehr Klicks abzuholen (das muss natürlich je nach Wettbewerbsumfeld individuell betrachtet werden, es gilt ja immer noch das Prinzip der Wirtschaftlichkeit – aber oftmals hat man zu einem bestimmten Suchbegriff ja schon eine zweite Seite die sich in den SERPs irgendwo zwischen Position 11 und 30 herumtreibt). Auch für den Fall dass die gruppierten Ergebnisse eines Konkurrenten für das eigene Keyword schon immer gestört haben, ergeben sich durch diese Erkenntnis sicherlich neue Möglichkeiten. Aber dazu sage ich nun mal nichts mehr 😉

Purpose Inc to host charity Poker Tournament @PubCon Las Vegas

SEO Charity Poker Event PubCon Las Vegas by Purpose Inc

PubCon Las Vegas is coming up next week. We’re actually flying down there on saturday. During the conference there will be a charitable Texas Hold’Em Poker Tournament I’d like to attend. In order to register as a player, people have been asked to write about a charity, which I find is a fabulous idea. I’m happy to spread the word about a rather small organisation from my hometown Kempen, Germany. They’re called “Arbol de la Esperanza e.V.” – with their effort up to 30 kids in Quito, Ecuador can get off the streets and live a better life with education, health care, food and most importantly someone who cares about them. Most of those kids ran away from home to live on the streets – because their parents beat the crap out of them. Once on the street the way those kids go is pretty much predictable.

Here is a little text you can find on their website, which I find describes the situation pretty good (freely translated by me from http://www.arbol-de-la-esperanza.de/index.php?option=com_content&task=view&id=48&Itemid=89):

“Two kids – let’s call them Paul (12 years) and Andres (8 years) – are lying in their beds talking about the things their dad, respectively step-dad used to smuther them with. Things like a leatherbelt, a bullwhip or a cane come up. The scars on the head from the blunt side of a knife come to light, when barber Pauls is once again doing their hair a bit too short. Hender (15 years) is still speechless about his father sexually abusing him when he was 8 years old. Roberto (14 years) wants quiteness in the room he shares with three other kids. He’s going to have an important test the next day. Since he’s seen the inside of school for the first time at the age of 12, he’s only in third grade. He’s still got a lot to learn!”

Back when I was in school we used to ran our feet of on St. Martin’s Day to collect money for the organization (the school still does every year). Alltogether we made around 9000 Euros a year – which is a hell of a lot money for one evening begging people to give money for a good cause. We went whole day and night from house to house – it was cold, exhausting and so much worth it! Those guys give theses kids a new perspective and the chance for living a peaceful live with the care and freedom they deserve. Thanks for doing such a great job!

radius search with google maps and mysql

Let’s say you’re building a wepapp and you want to give your users the ability to do a radius search for something (e.g. gas stations) in a specific location. On top of that you want your users to provide your app with new gas stations anywhere. First of all you obviously need some kind of form users can post new gas stations to. This step is easy: get the latitude and longitude of the gas station and save it with all other relevant information (e.g. name, address etc.) to your database. The way to do this is Google Maps. Get an api key from Google for your domain and you’re good to go. Now, whenever a user submits a new gas station, you get the coordinates by giving Google the address your user submitted. Here’s how you do that:

$handle = fopen("http://maps.google.com/maps/geo?q=".urlencode($q)."&sensor=false&oe=utf8&gl=en&output=csv&key=".$api_key,"r");
$data = fgetcsv($handle);

where $q is your query (the address of the gas station)  and $api_key your Google Maps Api-Key. Now you have in $data[1] your latitude and in $data[2] your longitude. Additionally Google provides you with an accuracy for your search in $data[0]. I strongly recommend using this detail. For more information go to the Maps Api Reference. That’s it, you now got your coordinates and should save them to your database.

radius search with mysql

Now comes the search part. It’s not tricky at all, a little math will do the thing. First of all you need a search form. When the form is submitted you should begin with once again querying Google maps for the coordinates your user submitted in the search form. This step is easy, since it is the same as above (and this time you should really consider using the accuracy Google gives you back!!!).

Now that you have the coordinates of the searchers position, you query your database for any gas stations in the circumference of the given coordinates. I’ll do it within a range of ten kilometers, but this is of course at your choice (better: at your user’s choice). Let’s say you have a table called `stations`, with a primary key called `id` and the station’s `name`, additionaly the coordinates are saved in `latitude` and `longitude`. Here’s how you do your query:

SELECT
`id`,
`name`,
ACOS( SIN( RADIANS( `latitude` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `latitude` ) )
* COS( RADIANS( $fLat )) * COS( RADIANS( `longitude` ) - RADIANS( $fLon )) ) * 6380 AS `distance`
FROM `stations`
WHERE
ACOS( SIN( RADIANS( `latitude` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `latitude` ) )
* COS( RADIANS( $fLat )) * COS( RADIANS( `longitude` ) - RADIANS( $fLon )) ) * 6380 < 10
ORDER BY `distance`

where $fLat is the searchers latitude and $fLon the searchers longitude. The ten in the where clause is the range you want to search within. Remember: This search is based on kilometers. If you want to search in miles, you need to change the 6380 (whoch is our earths radius) to its respective value in miles. That’s it! You now got your result set with all stations in the ambit of ten kilometers.

c++ xml parser

I am currently developing a new project that works a lot with xml files. So I was in need of a fast, leightweight xml parser. I knew of one I already looked at some time ago. Xerxes XML-Parser is a very powerful tool and everything, but it is not leightweight. (Xerxe’s project has 53 MB overall, which is A LOT!)

So I looked for something different on the net. Et voila, I found a small, simple, cross-platform, free and fast c++ XML Parser. It really works damn fast and is very easy to use. The author did a really nice work!

Linux is what you want it to be, nothing else

I know that this topic has been discussed all over the internet for a few years now, especially since ubuntu became that popular. There are a lot of great comments and thoughts out there on what linux is and what it isnt, and especially on what it tries to be. But some weeks ago I got a comment on my post “setting up a bridged network for virtualbox on ubuntu linux” which I can’t leave uncommented:

Appreciate the effort and answers but ….
this is exactly the type of thing that will keep linux/ubuntu from ever achieving a significant portion of the mqarket. As long as users have to spend a day searching and patching every application that was not built into the OS distribution then the OS will never make it to the mainstream and it will remain in the realm of hakers, nerds and others that have more time than money.

First of all I am a little bit offended by that. I actually have loads of money and no time at all, if I do something with my linux boxes, then because I choose to do so (some people might call that a hobby). I only have the time to write this comment, since I’m home sick and can’t go to work. And second of all: The Commenter is just so plain wrong, that I can’t say nothing to it (it’s definitely a duty call)! He may be right in one thing though: gnu/linux (any of its various distributions) will never achieve a significant portion of the market. (But hey: who knows!?) But the question here is: who said linux ever wanted to do such a thing. As far as I remember no one ever claimed that portion for linux! Why is that? Well, this is an easy one: nobody is even able to claim a significant portion of the market, because linux itsself leaves you the freedom of choice, so linux will certainly claim for nothing (eventhough it could for a lot!). It’s as simple as that: Take it or leave it!

The one thing people still don’t understand is that linux won’t replace windows, it’s an alternative! The magic about it, is that it does what you want it to do and becomes what you want it to become. There are just so many scenarios in which a running gnu/linux does just plain different things. And the most important things about gnu/linux are the evaluation it takes, the freedom it spreads and the people behind it. But it won’t just replace windows! It’s different. I won’t count the various advantages of linux and disadvantages of windows (in my point of view, for the gamer it’s quite the opposite), but as the author of the comment above pointed out: if all “hackers” and “nerds” are using it, it’s gotta have something. I know there are various scopes with various arguments for and against an operating system, so there is no universal answere. Also there is still a lot left to say, but I’m sick and tired of everyone comparing linux to windows and other systems. The discussion is old and boring. Besides: there is no need for any kind of discussion. Any user, if it’s windows, mac, *nix or whatsoever doesn’t need to justify his choice of OS, because it’s his choice, and not a one someone else should make for him!

Decide for yourself, but never complain about what linux is and what it isn’t, because in the end it’s just what you want it to be!

Installing apache, mysql and php on gentoo

Just right now I’m setting up my new home server for various things. It’ll do all of my ranking stuff of course, since it’s very easy for me to get a new ip once G is blocking me. Right now most of the scripts are coded in python, but some essentials are still running on php (though not for long), so i need a running lamp (besides torrentflux and so on…). The last time i set up a clean server on gentoo is quite a few years back now. Eventhough it was a lot of fun and always a good chance to learn some things, I must admit it’s gotten quite easy now. It took me quite some time getting the new php5 running with apache a few years ago. Now theres nothing really special you need to do. Just fire up portage and install it. Before you do, you might wanna edit a few files though. First of all make sure you add mysql and apache2 to your global use flags in /etc/make.conf, then you’ll have to think about some apache options. First of all how will the server process run on your system? Since I’ve loads of RAM and don’t really have any traffic except some requests of my one, no virtual hosts, no nothing, I’ll go with a forked apache. For further information refer to the apache manual. For an forked MPM version of apache just do a quick:

#echo "APACHE2_MPMS="prefork" >> /etc/make.conf

There’s one thing left to do: Define what modules you want your apache to run with. As always gentoo provides a very easy way to do that. If you want to know what modules you can install just do a quick

#emerge --pretend --verbose --oneshot apache

to see all available modules. You’ll at least want those to be installed, since they are kind of needed 🙂

#echo "APACHE2_MODULES="alias auth_basic auth_digest
rewrite authz_host dir mime" >> /etc/make.conf

Not all of them are mandatory, but you’ll at least need to install authz_host, dir and mime for your apache to run. Now you’re ready to go, just fire up portage with a quick

#emerge apache

Now just install php by firing up portage again, but remember to set the use flags you’ll need by updating your /etc/portage/package.use, since there are quite some options… As always you can see available use flags by executing an pretended oneshot emerge of php! When you’re done, just install php by

#echo "dev-lang/php apache2 bzip2 curl exif ftp gd iconv mysql
mysqli nls pcre session simplexml soap spell spl sqlite ssl
tokenizer truetype unicode xml xmlrpc" >> /etc/portage/package.use

#emerge php

and you’re good to go! Just start your apache with the according init script and everything should work out of the box. You’ll probably want your apache to start automatically too, by adding it to your default runlevel:

#/etc/init.d/apache start

#rc-update add apache default

But just remember: This is a very basic installation of lamp on your system, it’ll work as it is, but you might wanna tune your settings. As always just refer to the man pages and online documentations!

Integrate phpBB with a full featured photo album

So heres the deal: I wanted to set up phpbb for a group of ~40 people who went to summer vacation together. I also wanted them to be able to upload photos of the trip to some kind of photo album. There is a whole bunch of software out there, that would have filled my needs, but only as a standalone version, which means that my users would have needed to create two seperate accounts, one for phpBB and the other one for the photo album software. That’d clearly suck, so i went searching for a nice phpBB photo album mod. There are a lot of these too, but I didn’t really found any of theme nearly as good as all those standalone packages. After a while I stumbled upon phpBB3 Gallery2 Integration which does what the title says: it integrates phpBB3 (and older versions) with the wonderful Open-Source Project Gallery. Gallery offers a full featured photo album software completely written in php/mysql. It offers a wide range of plugins and is highly configurable. Gallery is set up quickly if you want to test it. So after setting up Gallery and testing it for a while I decided to use the Integration package which will turn off Registration and User-Management of Gallery and will synchronize each phpBB user with your new photo album software, so you’ll only have one login for two very nice pieces of software. I gotta say though, the installation can be a bit tricky, especially when your Gallery is already filled with content and when you use Gallery’s url rewriting package. If you’re familiar with modding your phpBB, the integration will take you about 2 to 3 hours. If youre not familiar with modding, then you’ll most likely need quite more time, especially if youre a newbie to html,php and stuff. Eventhough it’s a lot of work for one integration package, it’s really worth the time, because afterwards you’ll have a lot of fun with your new phpBB with an integrated full featured photo album! The guys over at nukedgallery.net even offer payed support and payed installation, so if you’re too lazy or too much of a newbie, there’s hope for you too!

Don’t forget to backp first! 😉

setting up a bridged network for virtualbox on ubuntu linux (Host Interface)

In order for this to run, you will most likely need a wired network connection, since most wireless-adapters won’t support bridged networking! This description is intended to be used with VirtualBox >= 1.4.0, since earlier versions handle the virtual networking differently due to kernel changes in 2.6.18 and later.

First of all, you’ll have to check the permissions on the device /dev/net/tun . The user running VirtualBox with bridged networking needs to have access to this device. The easiest way to do this is by chown’ing the group vboxusers to it:

sudo chown :vboxusers /dev/net/tun
sudo chmod 0660 /dev/net/tun

You will also have to install the package bridge-utils and uml-utilities:

sudo apt-get install bridge-utils uml-utilities

Now we will create 2 scripts which are executed when the virtual machine starts/stops. I will create those scripts in my home dir. Here is the start script, I called it starttun.sh:

#!/bin/bash
brctl addbr br0
ifconfig eth0 0.0.0.0
brctl addif br0 eth0

#if you have a dhcp-server uncomment this line:
#dhclient3 br0

#If you have a static IP uncomment the following lines and
#change the IP accordingly to your subnet:
#ifconfig br0 192.168.178.5 up
#route add default gw 192.168.178.1

#Now we will create the tap device for the vm,!
# change your username accordingly
tunctl -t tap0 -u simon

#Now add the tap-device to the bridge:
ifconfig tap0 up
brctl addif br0 tap0

Now you’ll have to create the stop script, i called it stoptun.sh 😉

#!/bin/bash
#bring the interfaces down
ifconfig tap0 down
ifconfig br0 down
brctl delif br0 tap0
brctl delbr br0

#now setup your network-interface again
#for dhcp uncomment the following line
#dhclient3 eth0

#For a static IP uncomment the following lines and change them accordingly:
#ifconfig eth0 192.168.178.5
#route add default gw 192.168.178.1 dev eth0

Finally you’ll have to make the scripts executable:

sudo chmod ug+x starttun.sh
sudo chmod ug+x stoptun.sh

It’s time to set up VirtualBox to use the interface. For this go to the SetUp of your Virtual Machine under Network and tell VirtualBox to start/stop thescripts, when the VM is started/stopped. To do this, select “Host Interface” under Attached To. As Interface Name you use “tap0” and for the startscript you use:

“gksudo /home/YOURHOMEDIR/starttun.sh”

For the stopscript accordingly:

“gksudo /home/YOURHOMEDIR/stoptun.sh”

Note: If you use KDE, you’ll have to use kdesu instead of gksudo