In this tutorial I create a disk, download a kernel, preseed file and install Ubuntu using the preseed file. This has proven very popular since you can't install a paravirtualized domain using an install disk. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a Ubuntu mirror locally then downloading my files and editing them.
This tutorial was originally written for CentOS and has been adapted for Fedora 20.
Note: This tutorial is designed so you can copy and paste the text inside the boxes. I don't actually type any of this in and neither should you.
1. Getting the network info
This line gets the Network UUID for xenbr0. If you're using a different bridge you will want to insert it here. Get a list of XCP networks with xe network-list. This network is connected to the outside interface. This tutorial requires there to be a DHCP server on this network answering requests and providing network access to the Internet.
Here we create the VM from the RHEL6 template, create a network interface and add it to our network from step one. Additional settings are for configuring the install repository and specifying the kickstart file from my site. The last setting turns off VNC so we can watch the install via a text console (very important in my environment). Even if you can't see all the text below just highlight and paste. The text is there even if it's not visible.
The VM installs without any interaction from the user at this point. It is however, nice to watch it using xenconsole. Once it's done installing it will shutdown.
Now that yourFedora VM is running you can login. The password was automatically set by the kickstart file.
Username: root
Password: password
Reset the root users password and change the network settings to static IP using system-config-network. If you want to keep the IP assignment dynamic note the ip address.
5. Shutting down the VM and re-enabling VNC
If you're going to use XVP or some other method of connecting to the VMs direct VNC connection you'll need to enable it.
Be aware that you may not have enough space on the Control Domain's disk to export it. A good solution (and shorter than explaining how to add disks to the control domain) is to mount an nfs volume and export it there.
mount nfsserver:/share /media/share
xe vm-export uuid=$VMUUID filename=/media/share/Fedora20-base.xva
This would mount the NFS share on nfsserver to /media/share. The exported disk would be saved on the NFS share.
Notes: Since it's more likely that you will want to do a Fedora desktop install than for the other Operating Systems I've written tutorials for I've put together a list of packages for your custom kickstart file (extracted from the Fedora-20-comps.xml file.)
admin-tools
authoring-and-publishing
base
base-x
books
cloud-infrastructure
clustering
design-suite
development-libs
development-tools
dial-up
directory-server
dns-server
dogtag
eclipse
editors
education
electronic-lab
engineering-and-scientific
fedora-packager
font-design
fonts
ftp-server
games
gnome-desktop
gnome-software-development
graphical-internet
graphics
haskell
input-methods
java
java-development
kde-desktop
kde-software-development
legacy-fonts
legacy-network-server
legacy-software-development
libreoffice-development
lxde-desktop
mail-server
medical
meego-netbook
milkymist
mingw32
mysql
network-server
news-server
ocaml
office
perl
printing
robotics-suite
ruby
server-cfg
smb-server
sound-and-video
sql-server
sugar-desktop
system-tools
text-internet
virtualization
virtualization-hypervisor
web-development
web-server
window-managers
xfce-desktop
xfce-software-development
x-software-development
To insert any of these package groups into your own custom kickstart file precede the group name with an @ and insert it in the Package section.
# Packages
%packages --excludedocs
@ base
man
man-pages
sendmail
yum-presto
%end
Then to use your kickstart file save it to a webserver somewhere. Follow the installation instructions but refer to your kickstart file (ks=<URL> in Step 2.
Note: This is not totally automated yet. I need to fix several things.
Install Type
Non-interactive
Network boot
Commandline
Paravirtualized
Prerequisites
XCP/Xenserver
Access to Internet
Working DHCP server
Working DNS name resolution
Introduction
In this tutorial I create a disk, download a kernel, preseed file and install Debian Wheezy using the preseed file. This has proven very popular since you can't install a paravirtualized domain using an install disk. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a Ubuntu mirror locally then downloading my files and editing them.
Note: This tutorial is designed so you can copy and paste the text inside the boxes. I don't actually type any of this in and neither should you.
1. Getting the network info
This line gets the Network UUID for xenbr0. If you're using a different bridge you will want to insert it here. Get a list of XCP networks with xe network-list. This network is connected to the outside interface. This tutorial requires there to be a DHCP server on this network answering requests and providing network access to the Internet.
Here we create a new template from the Debian Squeeze template. Then we create the VM from the new Debian template, create a network interface and add it to our network from step one. Additional settings are for configuring the install repository and specifying thepreseed file from my site. The last setting turns off VNC so we can watch the install via a text console (very important in my environment). Even if you can't see all the text below just highlight and paste. The text is there even if it's not visible.
The VM installs without any interaction from the user at this point. It is however, nice to watch it using xenconsole. Once it's done installing it will shutdown.
Be aware that you may not have enough space on the Control Domain's disk to export it. A good solution (and shorter than explaining how to add disks to the control domain) is to mount an nfs volume and export it there.
mount nfsserver:/share /media/share xe vm-export uuid=$VMUUID filename=/media/share/DebianWheezy-base.xva
This would mount the NFS share on nfsserver to /media/share. The exported disk would be saved on the NFS share.
Note: This has not really been tested yet. I wanted to get it up here so people can start using it and I can work on it.
Install Type
Non-interactive
Network boot
Commandline
Paravirtualized
Prerequisites
XCP/Xenserver
Access to Internet
Working DHCP server
Working DNS name resolution
Introduction
In this tutorial I create a disk, download a kernel, preseed file and install Kali LInux using the preseed file. This has proven very popular since you can't install a paravirtualized domain using an install disk. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a Ubuntu mirror locally then downloading my files and editing them.
Note: This tutorial is designed so you can copy and paste the text inside the boxes. I don't actually type any of this in and neither should you.
1. Getting the network info
This line gets the Network UUID for xenbr0. If you're using a different bridge you will want to insert it here. Get a list of XCP networks with xe network-list. This network is connected to the outside interface. This tutorial requires there to be a DHCP server on this network answering requests and providing network access to the Internet.
Here we create a new template from the Debian Squeeze template. Then we create the VM from the new Debian template, create a network interface and add it to our network from step one. Additional settings are for configuring the install repository and specifying thepreseed file from my site. The last setting turns off VNC so we can watch the install via a text console (very important in my environment). Even if you can't see all the text below just highlight and paste. The text is there even if it's not visible.
The VM installs without any interaction from the user at this point. It is however, nice to watch it using xenconsole. Once it's done installing it will shutdown.
Be aware that you may not have enough space on the Control Domain's disk to export it. A good solution (and shorter than explaining how to add disks to the control domain) is to mount an nfs volume and export it there.
mount nfsserver:/share /media/share
xe vm-export uuid=$VMUUID filename=/media/share/Kali-Linux-base.xva
This would mount the NFS share on nfsserver to /media/share. The exported disk would be saved on the NFS share.
This tutorial was written in the spirit of my CentOS 6 virtual machine (64 bit) installation on Xen howto. In that tutorial I created a disk, downloaded a kernel, kickstart file plus a xen config file which installed CentOS using the kickstart file. This has proven very popular since you can't install a paravirtualized domain using an install disk. This has been a very nice installation howto because you don't have to download any install CD/DVDs and you could create VMs using nothing more than a commandline login. It's also very nice because it can be mirrored locally if you're doing a bunch of them just by rsyncing a CentOS mirror locally then downloading my files and editing them.
I now use Xenserver and it's a very different animal indeed. However, I still needed a system of creating CentOS Virtual Machines in that same manner. I didn't want to download a CentOS install DVD or need a graphical login to install the OS thus this tutorial was born.
Update: June 2nd, 2014 - I changed most of the tgtadm long format options to short format due to my not being able to remember the long format. For some reason --lld didn't seem like a valid option. I did however keep --lun and --backing-store.
Creating an iSCSI target on Xen Cloud Platform 1.1
Premise: I have two pools – The first has one host in it that acts as a router, firewall and Host for a couple of special VMs for (DNS, DHCP, NFS, Web) the hosts in a second pool. I've added iSCSI SAN to it's lists of jobs using a software iSCSI target in the 8 steps below.
1. Install tgt from CentOS repos
yum --enablerepo=base install scsi-target-utils
2. Start the tgt service
service tgtd start
chkconfig tgtd on
3. Preparing for LVM
I'm using a separate hard drive - /dev/sdb and creating one partition which will be used as my LVM Physical Volume. We'll then add it to the Volume Group and carve it up into Logical Volumes. This way I can just add another hard drive to the Volume Group when we want more capacity and the rest of the tutorial stays the same. The bold letters are what I input, I accepted the defaults everywhere else.
There's been a flurry of activity around The Man, The Myth, The Legend in the Xen Howtos section and for good reason - CentOS6 was released. It all started as a simple update to my installation tutorials but ultimately I spent half a week on it. There were some issues with how I was doing things because CentOS5 used the old Xen kernel and CentOS6 uses the new libvirt kernel. As of RHEL5/CentOS6 Xen Host (dom0) support is no longer in the kernel. However, Xen Guests (DomU) is and is handled by libvirt. Last week the last bits of Xen Dom0 support were merged into Linux Kernel 3.0. This means that going forward all Linux distributions will have Xen Dom0 ability unless the distributors remove it.
I've written and tested two xen tutorials this week.
During the process of writing these tutorials I shrunk the size of the Disk Image. I did this because I like nice small VM disk images (and sparse too) so I can duplicate them and move them around easily. It's fairly easy to resize a disk image so I updated all four tutorials on how to resize Dom0 Disk Images and Logical Volumes as well as DomU Logical Volumes and partitions. I attempted to make it clearer too what the scenario was so people would know what the tutorial was trying to accomplish.
Note: I lost my original xen config files so I've created new ones here. I no longer have a xen system so I can't test them. Please let me know if the tutorial still works or not -Grant
Introduction
A lot of this tutorial was stolen from my CentOS 5 Installation which in turn was stolen from the CentOS wiki. I've shortened and updated it for installing a CentOS 6 DomU. I just copy and paste all the indented lines into a root terminal and voila! a CentOS VM.
1. Creating an Virtual Disk Image
The first step is to create an disk image that will act as the VM hard drive. The following command will create a 4 GB sparse disk image named /srv/xen/centos6.img. A sparse file is created in such a way that the disk image doesn't actually take up the whole 4GB until you fill it up. If you'd like a larger (11GB) disk image substitute seek=10240 into the following line. I make my VMs nice and small so I can move them around easier. Making a disk image larger or adding a second drive later is easier than making it smaller or taking a drive away.
2. Preparing the Xen configuration file for installation
Xen uses one configuration file per VM. We will start out with a config to do the install and replace it later with a config for normal operation. Now we download the install kernel, ramdisk and xen config file.
A kickstart file holds instructions for automatic installation and is referenced in my xen config above. My example kickstart file is very minimal but is enough to get a working CentOS 6 VM.