Xen + Joomla How To
(You can download a pdf of this from tothelasttribe.com/resources)
I was asked to teach a computer class at a local private middle school. We decided to teach the students an introductory course to Joomla! (A free, open-source Content Management System). I was to have six 50 minute sessions with each class.
To be able to teach Joomla! the best way, the students needed a way to have their own personalized instance of Joomla! that they could work with. Because there were almost 75 students, I divided the students into groups of three, and had an instance for each of them (roughly 28 instances). To achieve this, I could either try to run enough instances on my own web-hosting server, (not the best idea), or I could try to run 28 Xen virtual machines on the local school server. Since the schools local server had 2x quad-core processors, with 16gb of ram and enough disk space for a datacenter, I decided to run it on the schools’ local server.
The local server was running Fedora Core 7 32bit, with PAE enabled, so as to allow the 32bit OS access to the full 16GB of ram. I decided to go ahead and run each instance in a Xen domain. If you are not familiar with XEN, check out http://en.wikipedia.org/wiki/Xen (It’s basically a free software hypervisor). As a side note, when I refer to xen domains, I am referring to “virtual machines.” (That’s just the term Xen uses to describe guest VM’s on the host). Also, commands that I ran are in bold.
-First off, I downloaded the free Joomla! Xen VM from Jumpbox. I extracted the files to /srv/xen.
-I then opened up the JumpBox.xen Config file and changed 3 things:
—The memory for the domain instance to ‘256’
—The name of the domain instance to ‘joomla-a2’ (my name scheme, eg ‘joomla-a3, joomla-a4’, etc)
—The password for VNC authentication
-I then deleted all the other unnecessary files that came with the Jumpbox (VM Image files for other Hypervisors
-In a shell, I created the domain, using the config file that I had just edited (‘xm new –c JumpBox.xen’)
-I then started the domain, using the domain’s name, which I specified in the config file—I also started it with the switch ‘–c,’ which opened up a vnc authentication windows (xm start –c joomla-a2)
-After authenticating, I had VNC access to the domain
-Which, after bootup, I configured the joomla! install to have a static IP, so that I would have an easy way to keep track of each group’s joomla! instance
-I then went ahead and shutdown the domain, using the domain name (‘xm shutdown joomla-a2’)
-Now that I knew the config worked, I went back to the file manager and tar’ed up the domains folder, keeping the original folder/file structures
-I opened up a shell and created 27 folders, each named according to the domain it would have in them
– I then copied the tar into each of the folders and extracted it
-For each instance, I edited the config file as stated above, and created the domain as described above
-After each domain had been created, I started starting them up and configuring them from VNC
-Here I ran into two issues:
First off, I found out that I had to specify the memory that Dom0 (Dom0 = Host Operating System) should take up, otherwise it quickly uses all your free memory and you don’t have any left for your virtual machines. Since the server had 16GB, I gave Dom0 7GB. I specified this in the grub.conf file and added the parameter ‘dom0_mem=7340032’ to the kernel option so that it gets set when the kernel loads. (I had to reboot the server for this to take affect)
The second issue I ran into was when I tried starting up the 5th domain: I ran into an error message, “Error: Device 0 (vif) could not be connected. Backend device not found.” After doing some searching around, I figured out that this might have been because I’d run out of loopback devices, so I needed to increase the number allowed by adding ‘max_loop=32‘ to the module options when loading.
-After fixing that error, I continued starting them up one by one
-After they were all configured, I used Xen’s built-in “Top” to see how we were doing resource-wise. (‘xm top’)
-For teaching the students, I gave each group the IP address of one of the Joomla! instances, of which was theirs to work on for the remainder of the class
-After the class, I needed to clean up the domains:
-To remove them, I first shut each of them down from a shell (‘xm stop joomla-a2’, ‘xm stop joomla-a3’, etc)
-Then I ran the ‘delete’ command on each of the domains (‘xm delete joomla-a2’, ‘xm delete joomla-a23’, etc)
-I changed the grub.conf back to the original setting (removed the kernel parameter specifying the amount of memory Dom0 is allocated)
-Rebooted the server to allow the kernel settings to take effect.
If you have any questions, comments, or corrections, you can email me at Josh@tothelasttribe.com
Josh Brower
To The Last Tribe Computer Consulting
1 thought on “Xen + Joomla! How To”