Have you been following the news surround Ubuntu release of JeOS? Want to try it out, but not sure where to start? Build an Apt-proxy, quick simple and very helpful.
The power behind JeOS, Just Enough Operating System, is that you only get the minimal packages you need to get the job done. Current versions of JeOS, 7.10 and 8.04 are both designed to work on the VMware Server and VMware ESX platform. For help setting up VMware server on Gutsy Gibbon check out this step by step guide, part 1 (Gutsy Server Install) and part 2 (VMware Server Install).
Once you have VMware server setup and running you are ready to build your first virtual machine. There are a ton of great guides out there for all aspects of this process, but since we are working with JeOS, you need to take a few precautions that normally you could skip.
Currently Hardy JeOS doesn’t include (or I couldn’t get it to work) SCSI drivers, so you need to use an IDE drive when you make your virtual machine.
If you need more detailed instructions on how to setup the virtual machine, I’m going to refer you to this article, published by linux-mag.com, Their article “How to Develop Virtual Appliances Using Ubuntu JeOS | Linux Magazine“. Note: this article refers to JeOS 7.10, which is close enough to 8.04 at this level.
Steps to build the VMware Virtual Machine:
- Create a New Virtual Machine
- Choose “custom configuration” (this allows the choice of IDE down the road)
- Choose “Ubuntu” from the version menu.
- Enter a name for your virtual machine, I recommend “apt-proxy”.
- Choose a single processors, assuming you have more then 1 core on your virtual server
- Note sure about the private setting, but I assume since we want to access this VM from other VMs private wouldn’t be helpful
- Enter the amount of ram you are willing to assign to this task, between 256 and 1024 (I recommend 512 initially)
- Choose “Bridge Networking“, unless you have setup and understand how to configure a virtual network.
- Choose IDE, as SCSI drivers are not function, as far as I can tell.
- Enter a large number, remember it will allocate the space as it needs it, I tend to default to 100 gig just to be safe.
- Enter a location for the disk image, and then click Finish
Here is the copy of my VMX file, (slightly modfied for easier online reading)
#!/usr/bin/vmware
config.version = "8"
virtualHW.version = "4"
memsize = "1024"
ide0:0.present = "TRUE"
ide0:0.fileName = "apt-proxy.vmdk"
ide0:0.writeThrough = "TRUE"
ide1:0.present = "TRUE"
ide1:0.fileName = "/var/lib/vmware/cd-isos/jeos-8.04-beta-jeos-i386.iso"
ide1:0.deviceType = "cdrom-image"
Ethernet0.present = "TRUE"
displayName = "apt-proxy"
guestOS = "ubuntu"
ide0:0.redo = ""
ide1:0.startConnected = "TRUE"
ethernet0.addressType = "generated"
uuid.location = "56 4d 87 fb ab e8 1d ca-c1 96 63 8d b9 96 b0 bc"
uuid.bios = "56 4d 87 fb ab e8 1d ca-c1 96 63 8d b9 96 b0 bc"
ethernet0.generatedAddress = "00:0c:29:96:b0:bc"
ethernet0.generatedAddressOffset = "0"
Next step, download a CD Iso of Ubuntu JeOS. Depending on if you are logged onto your host locally or remotely doesn’t make much difference, but my suggested method is just to use wget directly into a CD repository directory, or wait you don’t have one yet do you? Ok, lets build a folder to store CD Iso images.
**assuming you are either logged in locally or ssh’d into the host system**
Move to the VMware directory, assuming you used the standard location:
cd /var/lib/vmware/
Make a directory, “cd-isos”
sudo mkdir "cd-isos"
Move to the “cd-isos” directory
cd "cd-isos"
Download the latest beta release of Ubuntu Hardy 8.04 JeOS iso image.
wget http://cdimage.ubuntu.com/jeos/releases/8.04/beta/jeos-8.04-beta-jeos-i386.iso
Now, I highly recommend using the bit torrent if you have understand how to use a bit torrent client, as it helps everyone out, by sharing the burden of iso downloads.
Now, using the VMware Server Console, set the removable media, cd, to the image you just downloaded.
Your ready to boot.
If all goes well you should see something pretty similar to this:

Continue along with the Ubuntu install, I recommend using the 3rd option, “Install a command-line system”
The installation of Ubuntu JeOS, is quick and painless as with most Ubuntu installs. I have encountered difficulty near the end, due to package / language issues, but by simply bumping down past the package install and installing grub I was able to get the installation to finish without a problem.
Reboot, and be prepared to see a very fast, lean, booting Ubuntu server.
Now with the server booted, login, using the username and password you provided during setup.
The first set is to update the system, with the following command:
sudo apt-get update
But wait, what happened? yes, there is a strange bug where the sources.list file is empty, except for the CD rom. To correct the problem do the following hack:
sudo rm /etc/apt/sources.list
sudo cp /etc/apt/sources.list.apt-setup /etc/apt/sources.list
now run update again
sudo apt-get update
followed by upgrade
sudo apt-get upgrade
Now we have an update to date Ubuntu JeOS system. Feel free to stop here, make a snapshot of the system, duplicate the system, go in another direction or wander off for coffee. But if you are still following along time to install Apt-proxy, allowing other future virtual machines take advantage of a local repository cache on the virtual server, saving you hours of downloads and gigabytes of unneeded transfer.
sudo apt-get install apt-proxy
That was simple, now to configure it for our needs. I prefer nano, but as this is a minimal install it isn’t included, so we shall use VI
sudo vi /etc/apt-proxy/apt-proxy-v2.conf
Make the changes to the file to match your needs, here is an example apt-proxy-v2.conf file copied from https://help.ubuntu.com/community/AptProxy
[DEFAULT]
;; All times are in seconds, but you can add a suffix
;; for minutes(m), hours(h) or days(d)
address = 127.0.0.1
port = 9999
cache_dir = /var/cache/apt-proxy
;; Control files (Packages/Sources/Contents) refresh rate
min_refresh_delay = 1s
complete_clientless_downloads = 1
;; Debugging settings.
debug = all:4 db:0
timeout = 30
passive_ftp = on
;;--------------------------------------------------------------
;; Cache housekeeping
cleanup_freq = 1d
max_age = 120d
max_versions = 3
;;---------------------------------------------------------------
;; Backend servers
;;
;; Place each server in its own [section]
[ubuntu]
; Ubuntu archive
backends =
http://archive.ubuntu.com/ubuntu
http://us.archive.ubuntu.com/ubuntu
[ubuntu-security]
; Ubuntu security updates
backends = http://security.ubuntu.com/ubuntu
[debian]
; Backend servers, in order of preference
backends =
http://ftp.us.debian.org/debian
http://ftp.de.debian.org/debian
http://ftp2.de.debian.org/debian
ftp://ftp.uk.debian.org/debian
[security]
; Debian security archive
backends =
http://security.debian.org/debian-security
[openoffice]
; OpenOffice.org packages
backends =
http://ftp.freenet.de/pub/debian-openoffice
http://ftp.sh.cvut.cz/MIRRORS/OpenOffice.deb
http://borft.student.utwente.nl/debian
[apt-proxy]
; Apt-proxy new versions
backends = http://apt-proxy.sourceforge.net/apt-proxy
Once you are done editing your file, go ahead and save it.
Next we need to reboot the apt-proxy to take notice of the changes:
sudo /etc/init.d/apt-proxy restart
If all goes well you are ready to use it. Unsure of your IP address, run ifconfig on the VM to find out.
Ok, so you have a repository cache up and running, how do you use it. Simple, replace the current sources.list file on ANY ubuntu or debian machine with one with the url replaced, for example: http://archives.ubuntu.com/ becomes http://192.168.0.123:9999/ so on my systems, running hardy, the sources.list file looks like this:
deb http://192.168.0.123:9999/ubuntu/ hardy main restricted
deb-src http://192.168.0.123:9999/ubuntu/ hardy restricted main multiverse universe
#
deb http://192.168.0.123:9999/ubuntu/ hardy-updates main restricted
deb-src http://192.168.0.123:9999/ubuntu/ hardy-updates restricted main multiverse universe
#
deb http://192.168.0.123:9999/ubuntu/ hardy universe
deb http://192.168.0.123:9999/ubuntu/ hardy-updates universe
#
deb http://192.168.0.123:9999/ubuntu/ hardy multiverse
deb http://192.168.0.123:9999/ubuntu/ hardy-updates multiverse
#
deb http://192.168.0.123:9999/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://192.168.0.123:9999/ubuntu/ hardy-backports main restricted universe multiverse
#
#
# deb http://archive.canonical.com/ubuntu/ hardy partner
# deb-src http://archive.canonical.com/ubuntu/ hardy partner
#
deb http://192.168.0.123:9999/ubuntu/ hardy-security main restricted
deb-src http://192.168.0.123:9999/ubuntu/ hardy-security restricted main multiverse universe
deb http://192.168.0.123:9999/ubuntu/ hardy-security universe
deb http://192.168.0.123:9999/ubuntu/ hardy-security multiverse
#
#ubulette
#deb http://ppa.launchpad.net/fta/ubuntu hardy main
#deb-src http://ppa.launchpad.net/fta/ubuntu hardy main
#
deb http://192.168.0.123:9999/ubuntu/ hardy-proposed restricted main multiverse universe
deb-src http://192.168.0.123:9999/ubuntu/ hardy-proposed restricted main multiverse universe
The best thing to do now, is drop that sources.list on a apache server, which is accessible from inside any virtual machine.
And run these commands to take advantage of the repository on another ubuntu system:
cd /etc/apt/
sudo rm sources.list
sudo wget http://192.168.0.105/apt/sources.list
sudo apt-get update
sudo apt-get upgrade
Now you can easily and quickly update any machine, real or virtual using a local repository cache, thanks to Ubuntu JeOS and Apt-proxy.
Here is the desired result:
bradmkjr@bradmkjr-laptop:~$ sudo apt-get update
[sudo] password for bradmkjr:
Get:1 http://192.168.0.123 hardy Release.gpg [191B]
Ign http://192.168.0.123 hardy/main Translation-en_US
Ign http://192.168.0.123 hardy/restricted Translation-en_US
Ign http://192.168.0.123 hardy/universe Translation-en_US
Ign http://192.168.0.123 hardy/multiverse Translation-en_US
Hit http://192.168.0.123 hardy-updates Release.gpg
Ign http://192.168.0.123 hardy-updates/main Translation-en_US
Ign http://192.168.0.123 hardy-updates/restricted Translation-en_US
Ign http://192.168.0.123 hardy-updates/universe Translation-en_US
Ign http://192.168.0.123 hardy-updates/multiverse Translation-en_US
....
For more information on Apt-Proxy check out the site: http://apt-proxy.sourceforge.net/
There are other repository caching tools out there, but I found this to be the easiest and quickest to implement, and the best part, it unlike some tools which try to mirror the whole repository, this only request packages “AS NEEDED” by the other machines, so there is no wasted local storage.
If there is a demand, I may try and release this as a very small sample prebuilt virtual machine on the VMware Appliance Site in the coming weeks.
Good Luck.
No related posts
March 25th, 2008 at 5:46 pm
Beautiful & Great Post!!!
May 10th, 2008 at 7:53 am
[…] a local apt-proxy mirror, for more information about apt-proxy read this post: Howto: Build your 1st Ubuntu JeOS Hardy VM, Apt-proxy sudo ubuntu-vm-builder kvm hardy –mirror […]