XEN Notes
Saturday, 28 March 2009
Building VM's with XEN on my server, example commands below...
XEN Commands
start
xm create /etc/xen/xen01.mybox.com.cfg
start on boot
ln -s /etc/xen/xen01.mybox.com.cfg /etc/xen/auto --force
list running xen machines (dom0 is host)
xm list
list all virtual images created by xen-create-image
xen-list-images
shutdown
xm shutdown xen01.mybox.com
shutdown immediately (as if you pulled the plug out)
xm destroy xen01.mybox.com
login
xm console xen01.mybox.com
to log in on that virtual machine (type CTRL+] if you are at the console,
or CTRL+5 if you're using PuTTY to go back to dom0),
or use an SSH client to connect to it (192.168.1.2).
ctrl+] to get back to host
show kernel
file /bin/ls
help
xm help
XEN VM Creation Examples
xen-create-image --hostname=xen01.mybox.com --size=10Gb --noswap --ip=192.168.1.2 --memory=256Mb --arch=i386 --role=udev
(debian lenny, 10gb hdd, no swap, 256mb ram, 32-bit kernel)
xen-create-image --hostname=xen01.mybox.com --size=10Gb --swap=128Mb --ip=192.168.1.2 --memory=256Mb --arch=amd64 --role=udev
(debian lenny, 10gb hdd, 128mb swap, 256mb ram, 64-bit kernel)
xen-create-image --hostname=xen01.mybox.com --size=10Gb --noswap --ip=192.168.1.2 --memory=256Mb --arch=i386 --dist fedora-core-8 --install-method rinse --role=udev
(fedora core 8, 10gb hdd, no swap, 256mb ram, 32-bit kernel)
XEN Customizations
Make VM use both processor cores...
nano /etc/xen/xen01.mybox.com.cfg
...and add this to the config
vcpus = '2'
Store vm's in /home/xen
mkdir /home/xen
nano /etc/xen-tools/xen-tools.conf
...find dir = ...
...and change to
dir = /home/xen
Installing VMWare Server on Ubuntu
Tuesday, 23 September 2008
First install the pre-requisites;
sudo aptitude install linux-headers-`uname -r` build-essential
sudo aptitude install xinetd
Download VMWare Server .tar.gz file from here.
Remember to signup for a Serial Number, you'll need that during the install
Download the latest vmware-any-any-update patch here,
Now extract VMWare Server and terminal into it's directory, run,
cd vmware-server-distrib
sudo perl vmware-install.pl
When asked Before running VMware Server for the first time, you need to configure it by invoking the following command: "/usr/bin/vmware-config.pl". Do you want this program to invoke the command for you now? [yes] enter NO and patch VMWare with that file.
Extract the files within that patch and Terminal into it's directory,
cd vmware-any-any-update115
sudo ./runme.pl
It should prompt you to run vmware-config.pl, this time say YES and continue with the install.
Afterwards start vmware with,
vmware
You might get a load of errors like this,If you get compile errors, do this;
/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib32/libcairo.so.2)
/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib32/libstdc++.so.6)
/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib32/libcairo.so.2)
/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib32/libstdc++.so.6)
/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib32/libcairo.so.2)
/usr/lib/vmware/bin/vmware: /usr/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib32/libstdc++.so.6)
That's because one part of the vmware package was compiled with a different version of gcc than the one you're running now, to fix that do:
sudo cp /lib/libgcc_s.so.1 /usr/lib/vmware/lib/libgcc_s.so.1/
sudo cp /usr/lib/libpng12.so.0 /usr/lib/vmware/lib/libpng12.so.0/
Now you should be able to start VMWare Server
(tested and working on Ubuntu Hardy 8.04 64-bit)
Acrobat Reader for Ubuntu Hardy
Monday, 22 September 2008
After reading this article, it's pretty easy to install Adobe's PDF reader on Ubuntu Hardy 8.04
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
This will add the medibuntu repository & and it's keyring to your system.
Now run,
sudo apt-get install acroread
After the 75mb download you'll now have Acrobat Reader 8.12 installed on your linux machine.
Accessible in => Applications / Office / Adobe Reader 8
Adding Acrobat as the Default for PDF's
Now to make Acrobat Reader the default for PDF files, find one on your machine.
- Right-click Properties
- Click the Open-With tab
- Click Add
- Scroll Down the list of applications to see if Acrobat Reader is available, if not,
- Click Use a Custom Command
- And type in acroread
- Click Add
Close that dialog, now every time you double-click on a PDF it'll open in Adobe's PDF reader and not the standard one.
Good stuff,
Using Jigdo
Saturday, 26 July 2008
Trashed my Fedora 9 install with their latest kernel update 2.6.25, it really is unstable. So now downloading Fedora 8 Unity, hopefully that'll make it a little more stable. One thing though, unlike other distributions who use ftp or torrent downloads, the Unity project use Jigdo to handle their iso downloads.
This can be added to your Ubuntu install with,
sudo aptitude install jigdo-file
Then start the program,
sudo jigdo-lite
Now I copy & paste the jigdo repository link into Terminal from here, hit enter and it shows a list of possible iso files to download, select 64-bit and off it goes.
I'll burn that to dvd and get it on the box soon, can't believe fedora 9 was that unstable!
Virtual Machines in Linux
Sunday, 20 July 2008
Download VirtualBox
Download VirtualBox, binary link will redirect you to Sun's site.
Installing
For me, I needed to install libqt3-mt before I could successfully install the 64bit package,
sudo aptitude install libqt3-mt
Now Install your download with...
sudo dpkg -i virtualbox_1.6.2-31466_Ubuntu_hardy_amd64.deb
Further note, you may need to recompile the VirtualBox kernel module if a previous install failed or you didn't have the necessary dependencies first time; this is done by:
sudo /etc/init.d/vboxdrv setup
Permissions
- Goto System / Administration / Users and Groups
- Click 'Unlock'
- Enter your password and click to 'Authenticate'
- Click 'Manage Groups'
- Find the 'vboxusers' group and click properties for it
- Make sure there's a checkbox next to your name within that group, so you are part of the 'vboxusers' group
You will have to reboot your machine for the change to take effect.
USB Support
By default USB support is disabled, to enable it;
sudo nano /etc/init.d/mountdevsubfs.sh
Inside you'll find a block looking like;
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount --rbind /dev/bus/usb /proc/bus/usb
Edit it to look like;
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount --rbind /dev/bus/usb /proc/bus/usb
(basically uncomment the last four lines)
Save changes and close the file (CTRL+X and Y)
Create a VM
Applications / System Tools / Sun xVM VirtualBox
Scroll down and click 'I Agree' on the licence agreement, then fill in the registration information to use VirtualBox, first time.
The rest is pretty self-explanatory if you've used other VM packages like OSX Parallels or Microsoft Virtual Machine.
- Click 'New'
- Enter a name for your VM, choose the target platform you're going to use it for
- Choose Base Memory
- Create a new Virtual Disk Image, click 'New'
- Click 'Fixed Size' (for simplicity), 8GB should be enough for starters, you can choose 'Dynamic' which will grow or shrink the disk image based on usage
- Click 'OK' then 'Finish' to build the Virtual Disk Image
- Once the image has been created (may take 5+ minutes) it will show the new disk image in a listbox for selection, make sure it's selected and click 'Next' then 'Finish'
You now have a virtual machine ready for whichever ISO or CD-ROM install you wish to place on it. You can hit Machine / Settings / CD-ROM to select an ISO image to boot from so you can install from a disk image.
Note: Even if you're running on a 64bit machine, the virtual machines will still operate under a 686 (32bit) platform.
All the best,
(originally based on a guide from Ubuntu Geek)
Fedora 9 wifi + flash on 64bit
Monday, 14 July 2008
After getting back from vacation in Vegas I decided I needed to sort my laptop out once and for all. So partitioned the drive in two, one with Vista Ultimate and one with Fedora 9.
On top of this I really wanted the Fedora partition to be encrypted and using LVM so I can resize later, glad I did that.
However in all I had two problems along the way,
Fedora 9 Wifi doesn't support TKIP
The first thing which I couldn't fix was the Wifi. I was using WPA+TKIP which is available in the network configuration panel, all good but everytime I tried to connect it'd popup the password entry screen again; really annoying.
Thankfully I found the reason to this, Fedora 9 does not support TKIP even though it's available in the control panel; switching to WPA+AES clears that problem.
Just wish they documented that better ;-)
32-bit Flash on a 64-bit build
Adobe released the Flash 9 libraries to the linux community but only as 32-bit binaries, I installed Fedora using the 64-bit build so with some tweaking managed to fix that too.
In Terminal do:
su -c 'rpm -Uvh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm'
su -c 'yum install flash-plugin'
Now specifically for 64-bit Fedora builds do:
su -c "yum -y install nspluginwrapper.{i386,x86_64} pulseaudio-libs.i386 libflashsupport.i386"
su -c 'mozilla-plugin-config -i -g -v'
Afterwards close & reopen Firefox and you should now have Flash 9 running on your Fedora 9 64-bit desktop.
'Thin' Rails Server + Fedora Cleanup
Wednesday, 27 February 2008
Thin
Thanks to Thomas Glasgow, I've been told of a new lighter Mongrel web server called THIN. It's more-so a cut-down version of the Mongrel Web Server, with the added power of an Event machine and Rack parser.
Haven't tested it out, but intend to try it out on one of my apps, install it with...
sudo gem install thin
Thin - Rake Task
With the above I found a startup script similar to Monrel's .yml config file.
namespace :thin do
namespace :cluster do
desc 'Start thin cluster'
task :start => :environment do
`cd #{RAILS_ROOT}`
port_range = RAILS_ENV == 'development' ? 3 : 8
(ENV['SIZE'] ? ENV['SIZE'].to_i : 4).times do |i|
Thread.new do
port = ENV['PORT'] ? ENV['PORT'].to_i + i : ("#{port_range}
%03d" % i)
str = "thin start -d -p#{port} -Ptmp/pids/thin-#{port}.pid"
str += " -e#{RAILS_ENV}"
puts "Starting server on port #{port}..."
`#{str}`
end
end
end
desc 'Stop all thin clusters'
task :stop => :environment do
`cd #{RAILS_ROOT}`
Dir.new("#{RAILS_ROOT}/tmp/pids").each do |file|
Thread.new do
if file.starts_with?("thin-")
str = "thin stop -Ptmp/pids/#{file}"
puts "Stopping server on port #{file[/\d+/]}..."
`#{str}`
end
end
end
end
end
end
copy and paste it into a .rake task in your apps /lib/tasks directory.
then fire with...
rake thin:cluster:start
rake thin:cluster:stop
and...
rake thin:cluster:start RAILS_ENV=production SIZE=10 PORT=8000
- SIZE = cluster size (2 is usually enough)
- RAILS_ENV = environment (production, development or test)
- PORT = port range to start from (for 2 clusters it'll be 8000 and 8001)
Thanks to Stephen Celis for this.
Fedora Package Errors and Cleanups
Lately i've run into some problems with my Fedora package manager, inconsistent files and dropped repositories. However I think I've managed to cleanup this problem by first cleaning up my package managers metadata, db cache and doing a general tidyup with...
sudo yum clean all
sudo yum clean metadata
sudo yum clean dbcache
Then giving the once-over of my RPM repository,
sudo rpm -vv --initdb
This looked ok, but I wanted to make sure so I rebuilt my RPM repository,
sudo rm -f /var/lib/rpm/__db*
sudo rpmdb -vv --rebuilddb
Now looking a little better,
Want to install Beryl + Compiz to get the 3D effects and cubed desktop next.
Update on Beryl
After hunting around I found that Beryl has been dropped in favour of Compiz, so don't go hunting for it because you won't find it.
Flash 9 + Quicktime on Fedora 8
Thursday, 21 February 2008
Flash 9
sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
mkdir -p /usr/lib/mozilla/plugins
sudo yum install nspluginwrapper.{i386,x86_64} pulseaudio-lib.i386
sudo yum install flash-plugin
mozilla-plugin-config -i -g -v
After that you should have the 64-bit edition of Flash 9 running in Firefox, the 32-bit edition is much easier.
Quicktime
sudo yum install mplayer mplayer-gui mplayer-skins mplayer-fonts mplayerplug-in mencoder
sudo /usr/bin/mozilla-plugin-config -i -f
Re-open Firefox and you should get some new video plugins enabled.
Fedora 8 on my HP dv2742se
Wednesday, 20 February 2008

My excellent fiancee came back from her dad's bowling trip with a nice new Intel Core 2 Duo laptop for little ole' me, ain't she great.
Anyway I decided to put two fingers to Vista, install Fedora 8 and see how things went. Well I can tell you, things are pretty damn good.
Here's how,
Install Fedora
First download your 64-bit image from the fedora site at...
Click [get fedora] and select the 64-bit build because the new Intel core 2 duo chip is a 64-bit chip (the previous 'core duo' chip wasn't).
Burn the 4gb image to DVD and boot from it, install, check Office / Web / etc. so you get everything and give it 30 minutes to install and you to go thru the install process.
After Installing
First off you'll notice the touchpad is a bit over-reactive and the WIFI doesn't work, this we'll fix.
For this you'll need a network cable to hook up directly to your router, a standard CAT5 network cable will do, nothing too posh.
Getting Wifi and everything else
Once hooked up, boot up with the ROOT account so you've got admin rights OR boot in normally, open Terminal (Applications / System / Terminal) and type...
sudo wget http://dnmouse.webs.com/scripts/dangermouse
sh dangermouse
A dialog will popup, this is the best bit and will hopefully fix all your problems, choose...
- flash plugin
- dvd-playback
- madwifi
- webcam drivers
- java
- touchpad
- lightscribe
and any others you want and hit OK, after the lengthly install and a reboot you should have wifi working and drivers for your touchpad, webcam, java, etc.
For this I really have to thank DangerMouse and his work at http://dnmouse.webs.com/, really well done!
Touchpad
Now lets fix that over-reactive touchpad, click System / Preferences / Hardware / Touchpad. Select [Tapping] tab and untick tapping, bingo, that's done.
DVD Playback Slow
Uh-oh, you're video might be slow when playing DVD's (which the DangerMouse script just enabled!). Select System / Desktop Effects, and disable Desktop Effects, ok it's not the best of fixes but should sort it out.
Otherwise try re-installing your ffmpeg drivers and other builds, in Terminal...
sudo yum remove ffmpeg
sudo yum install ffmpeg mjpegtools libquicktime
The others are just incase.
System Beep
Really easy to get rid of, System / Preferences / Hardware / Sound. Select the [System Beep] tab and untick [Enable System Beep].
Rails ?
Real easy,
sudo yum install ruby ruby-devel rubygem-rails rubygem-mongrel lighttpd lighttpd-fastcgi
Then,
sudo gem update --system
sudo gem install rails
sudo gem install rake
Interrogate Hardware
To see what USB devices you have on your system...
su root
lsusb -v | less
Good for finding what model of webcam you've got.
Tweaks
You might agree, but I didn't much like the big lettering in the default view, so i changed the font size down to 8 (system / preferences / appearance / look & feel / fonts).
Knocking the font sizes down a bit made it look a bit more professional, along with inverting the colours to green-on-black is much easier on the eyes.
The default editor in Fedora 8 is gEdit (listed as Text Editor), in this it has many plugins to make your life eaiser (edit / preferences / plugins), with some tweaking you can quickly turn it from a basic tool to something very powerful.
Afterwards
Get yourself a coffee or cocoa, you now have a very fast, very powerful 64-bit O/S with firewall and wifi to keep you going for many years to come.
Enjoy, you're sitting on the future ;-)









