Apart from Ubuntu's server and desktop versions, Ubuntu also features a version called Ubuntu JeOS (pronounced "juice"), which was released in late 2007 and stands for Just Enough Operating System. Ubuntu Server JeOS is specifically developed to make it easy to create virtual appliances. That means its kernel is stripped down to contain only those options a virtual appliance needs. Because of this, Ubuntu Server JeOS runs far more efficiently...
than any normal edition of Ubuntu Server.
Ubuntu JeOS offers a stripped-down operating system on top of which you can roll out an already-configured application, from a ready-to-go MySQL server to a Secure Shell (SSH) server. This article outlines how to set up Ubuntu JeOS as an SSH server.
Configuring JeOS as an appliance
To install a virtual machine using JeOS, start by downloading it. To do so, browse to this Ubuntu download page and get the most current release of Ubuntu Server JeOS. Next, install it in either VMware ESX, VMware Server or in a KVM environment. Other virtualization platforms may work but are not supported by JeOS. The installation itself is straightforward; you may install JeOS as you would a normal edition of Ubuntu Server. Once that's done, you can set up your appliance in it. Configure it to roll it out to the virtual appliance users in any way you want.
The interesting part of configuring JeOS as an appliance comes once the installation has been completed and your application has been implemented. When a user first starts the JeOS virtual appliance, you should run a set-up program that allows the user to configure the appliance according to his needs. The example below shows how you can do so to perform an initial configuration of the SSH server. It is also a blueprint of how you can do this for any other application.
- To start the initial configuration, it's a good idea to create a script in /etc/bash.bashrc. The following code will tell you if a check file is already present. This check file is created after successful configuration of the appliance. If the check file is present, no work needs to be done. If it's not, this script code makes sure that a configuration script is launched.
Listing 1: To launch the initial configuration, add some bash code to /etc/bash.bashrc.
if [ ! -e /etc/opt/sshserver/config_done ]; then /opt/sshserver/bin/config sudo touch /etc/opt/sshserver/config_done fi
- As you can see, the script from Listing 1 calls up a configuration script titled /opt/sshserrver/bin/config. Change the name of this script and its directory to match the application you want to configure. Listing 2 gives an example of the contents of this configuration script. This very simple script ensures the SSH server is reconfigured. Change the script to match the requirements of your application.
Listing 2: Create a configuration script that performs the initial configuration of your application, (The # lines appear as comments in the code output.)
#Perform the reinstall of openssh so that the key is regenerated
echo "Removing the openssh-server and installing it again."
echo "This makes sure that your SSH-keys are generated for your server."
sudo apt-get --purge -y remove openssh-server
sudo apt-get install -y openssh-server
#Add any other configuration lines that you need
This completes the example application configuration. Your JeOS virtual appliance is now ready for use.
Ubuntu JeOS makes it easy to roll an appliance out to specific users. By doing this, you can easily enable particular services, which may be useful for setting up remote sites or providing a demo environment to your customer. Ubuntu JeOS has the advantage of being tuned for optimal performance. There is no functionality you don't use, and this results in excellent performance.
About the author: Sander van Vugt is an author and independent technical trainer, specializing in Linux. Vugt is also a technical consultant for high-availability clustering and performance optimization and an expert on SUSE Linux Enterprise Desktop 10 (SLED 10) administration.