Thursday, April 17, 2008

Installing VMware Server on Ubuntu 7.10

If you're thinking about virtualizing your IT environment but you don't necessarily have a lot of budget/money to do it with, here are a few tips that may help you on your way.

Most of us already know about VMware's offering of VMware Server for free. This, coupled with some great open-sourced operating systems can make for some pretty efficient hypervisors.

I recently had to install a few VMware Server hosts using Ubuntu 7.10 Gutsy as the base host system. We chose Ubuntu because: the distribution CD is relatively small (~510Mb), it is simple to install and it provides the basic functionality needed. Furthermore, it uses the Debian packaging system which means you have access to potentially hundreds of additional packages (such as webmin) - should you choose to install them.

The process is pretty simple:

Step 1: Install your new system using the Ubuntu Server CD.

Step 2: Answer through the normal set of questions.

The actual Ubuntu installation procedure is a bit beyond the scope of this post, but suffice it to say that you should provide a nice big partition for where your VMs will reside. We like to put them in /home/vm)

When prompted to configure your server, select the options you want. We selected "OpenSSH server" and "Samba File Server" (we work in a mixed Linux/Windows environment here). Generally, it is a good idea to keep these selections to a minimum to save resources.

Once the install has finished, reboot.

Step 3: Next, install some packages that are necessary for VMware but that the base installer doesn't install by default, namely:

sudo apt-get install linux-headers-`uname -r` libx11-6 libx11-dev libxrender1 libxt6 libxtst6 libxext6 psmisc build-essential iceauth xinetd.

Note, you need to do this as a sudo user.

(Incidentally, if you don't install these packages, you will probably get an error like this if you try to install VMware Server:)

The correct version of one or more libraries needed to run VMware Server may be

missing. This is the output of ldd /usr/bin/vmware:
linux-gate.so.1 => (0xffffe000)
libm.so.6 => /lib32/libm.so.6 (0xf7f93000)
libdl.so.2 => /lib32/libdl.so.2 (0xf7f8f000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf7f76000)
libX11.so.6 => not found
libXtst.so.6 => not found
libXext.so.6 => not found
libXt.so.6 => not found
libICE.so.6 => not found
libSM.so.6 => not found
libXrender.so.1 => not found
libz.so.1 => /usr/lib32/libz.so.1 (0xf7f60000)
libc.so.6 => /lib32/libc.so.6 (0xf7e16000)
/lib/ld-linux.so.2 (0xf7fc6000)



Now you're ready to install VMWare.

Step 4: Obtaining VMware Server.

Go to http://www.vmware.com/download/server/ and download the latest version of
the VMware Server install package. The way I did this was to browse to the appropriate page on VMware's site using another computer (my workstation), register and accept license agreements then when it came time to actually download the file, I copied the link onto my clipboard and pasted it into my ssh session with my new server.

At the time of writing, this is what I executed:

wget http://download3.vmware.com/software/vmserver/VMware-server-1.0.5-80187.tar.gz

Similarly for the management interface and client packages:

wget http://download3.vmware.com/software/vmserver/VMware-mui-1.0.5-80187.tar.gz

wget http://download3.vmware.com/software/vmserver/VMware-server-linux-client-1.0.5-80187.zip


Once you have the files, untar/gunzip them using the following command:

tar -xvzf ./VMware-server-1.0.x-xxxxx.tar.gz
tar -xvzf ./VMware-mui-1.0.x-xxxxx.tar.gz

where xxxxx represents the proper version numbers.

Two new directories called vmware-server-distrib and vmware-mui-distrib will be created.

Step 5: Installing VMware

Change directories to vmware-server-distrib. Run the vmware-install.pl script. In our case, we answered the default for most questions except where we wanted the VMs to reside. We entered "/home/vm" for this but it is up to you where you want to put them on your system.

Step 6: Installing the VMware Management UI.

The VMware Management UI is a good way to get an overall view of the VMware server host. It presents you with helpful averages of CPU and memory usage per VM. We use it to guage approximately how many VMs a given physical server can handle.

To install it, change to your vmware-mui-distrib directory and run the vmware-installer.pl script. When you do this, you *may* get a message indicating that VMware is not installed. This error is in fact a misnomer - as it just means you have some missing libraries, AND it also may mean that your "sh" is pointing to something called "dash" instead of the more full fledged "bash".

To resolve these problems, try any or all of the following:

Needed packages not installed
sudo apt-get install libx11-6 libxtst6 libXt6 libXrender1 libXi6 libstdc++5 libssl0.9.7 libcrypto++5.2c2a

Incorrectly linked Library
ln -s /usr/lib/libdb-4.3.so
/usr/lib/libdb.so.3

Incorrectly pointed sh command
Determine if it is the case by doing an "ls -l /bin/sh" ... if it shows that sh is actually pointing to a program called "dash", remove the link and relink it to bash. (You may safely do this, then reverse it back to dash after running the install script).

Then correct the problem by:

rm /bin/sh
ln -s /bin/bash /bin/sh

One more note...
In our case, we decided to use a single user on our server host for all VMs. All VMs were then owned and write permissible for this single user. Depending on your environement, this approach may be feasible, or it may not. The advantage is simplicity, the disadvantage is privacy and flexibility. You decide.

Conclusion and Verification
If you've done the above steps correctly, you now have a functional VMware Server host machine. To verify:

1. Try installing and connecting with a VMware Server Console client. You should be able to create new virtual machines.

2. Try connecting to the management console, by pointing your browser to https://servername:8333.

If you've found this article useful or you have any compliments, constructive criticisms etc., please feel free to leave a comment!

Thursday, April 10, 2008

Installing webmin on Ubuntu 7.10

Recently, I've discovered a very neat tool for administering some of my linux servers. It is called webmin, and it may be one of the more complete web based system administration tools I have seen for linux.

Admittedly, I was a bit apprehensive at first trusting a web interface to do administration. After all, I am not one to shy away from the command line. But the more I used the webmin console, the more I could really see the benefit of using such a tool. In particular, I found the custom commands, and scheduled monitoring two particularly useful features.

I had been configuring small single-application virtual machines lately with Ubuntu, and found webmin to be a very robust tool in which to write custom commands to administer the various function of that server. With webmin, it made each VM more like a virtual appliance -- something we just turn on and off -- rather than something we had to learn oodles of commands to maintain.

Now installatin of webmin on Ubuntu isn't quite as straight forward as just saying "apt-get install webmin", so I've written a small HOWTO guide on how to install on Ubuntu. If you find this useful, please do leave a comment. It's nice to know what people find useful, and what things people don't.

Step 1: Get the latest webmin debian package from webmin's site. Since the bare bones Ubuntu Server won't have a graphical browser, the easiest way to do this is to find the download link via another machine, then use wget to download it onto your server. For me, this was a close sourceforge mirror from which to obtain it. Therefore, I issued a command like this:

wget http://internap.dl.sourceforge.net/sourceforge/webadmin/webmin_1.410_all.deb

This was the response:

--12:57:12-- http://internap.dl.sourceforge.net/sourceforge/webadmin/webmin_1.410_all.deb
=> `webmin_1.410_all.deb'
Resolving internap.dl.sourceforge.net... 74.201.26.4
Connecting to internap.dl.sourceforge.net|74.201.26.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13,140,062 (13M) [text/plain]

100%[====================================================================================================>] 13,140,062 417.00K/s ETA 00:00

12:57:44 (416.17 KB/s) - `webmin_1.410_all.deb' saved [13140062/13140062]

Step 2: Next, install the appropriate libraries (as a sudo user) to get webmin to run:

sudo apt-get install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl libmd5-perl openssl
This was the response:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
ca-certificates
The following NEW packages will be installed:
libauthen-pam-perl libio-pty-perl libmd5-perl libnet-ssleay-perl openssl
0 upgraded, 5 newly installed, 0 to remove and 39 not upgraded.
Need to get 1138kB of archives.
After unpacking 3555kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com gutsy/universe libauthen-pam-perl 0.16-1 [32.2kB]
Get:2 http://ca.archive.ubuntu.com gutsy/universe libio-pty-perl 1:1.07-1 [42.3kB]
Get:3 http://ca.archive.ubuntu.com gutsy/universe libmd5-perl 2.03-1 [5680B]
Get:4 http://ca.archive.ubuntu.com gutsy/main libnet-ssleay-perl 1.30-1 [186kB]
Get:5 http://ca.archive.ubuntu.com gutsy-updates/main openssl 0.9.8e-5ubuntu3.1 [872kB]
Fetched 1138kB in 9s (117kB/s)
Selecting previously deselected package libauthen-pam-perl.
(Reading database ... 33264 files and directories currently installed.)
Unpacking libauthen-pam-perl (from .../libauthen-pam-perl_0.16-1_i386.deb) ...
Selecting previously deselected package libio-pty-perl.
Unpacking libio-pty-perl (from .../libio-pty-perl_1%3a1.07-1_i386.deb) ...
Selecting previously deselected package libmd5-perl.
Unpacking libmd5-perl (from .../libmd5-perl_2.03-1_all.deb) ...
Selecting previously deselected package libnet-ssleay-perl.
Unpacking libnet-ssleay-perl (from .../libnet-ssleay-perl_1.30-1_i386.deb) ...
Selecting previously deselected package openssl.
Unpacking openssl (from .../openssl_0.9.8e-5ubuntu3.1_i386.deb) ...
Creating directory /etc/ssl
Setting up libauthen-pam-perl (0.16-1) ...
Setting up libio-pty-perl (1:1.07-1) ...
Setting up libmd5-perl (2.03-1) ...
Setting up libnet-ssleay-perl (1.30-1) ...
Setting up openssl (0.9.8e-5ubuntu3.1) ...


Step 3: Install the webmin package as root using dpkg.

sudo dpkg -i webmin_1.410_all.deb
This was the response:

Selecting previously deselected package webmin.
(Reading database ... 33791 files and directories currently installed.)
Unpacking webmin (from webmin_1.410_all.deb) ...
Setting up webmin (1.410) ...
Webmin install complete. You can now login to https://myserver:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.

Step 4: You're done! Login to the server using your web browser and point it to the address it indicates.