Do I need a base OS to install Xen or can I just install Xen as the core OS?
Before you can install Xen, you must first install an operating system such as RedHat/Centos, Ubuntu, BSD, Solaris, or Windows in the normal way.
I read that some people have tried installing Xen over Ubuntu but it didn't really work.
I've read people's accounts of having installed Xen on Ubuntu, so I believe it can be done without excessive difficulty.
to install an OS like CentOS as the base and install Xen within it, what are the terminal commands to install it?
To install Xen:
yum install kernel-xen xen
See http://www.howtoforge.com/centos_5.0_xen for getting the machine to boot Xen
You should note that CentOS' upstream source (RedHat) have dropped Xen and support KVM.
To install KVM and then install some management tools for it:
yum install kvm
yum install virt-manager libvirt libvirt-python python-virtinst libvirt-client
how do I install other OSes as VPS
With KVM, you can run a command like
virt-install \
--name=guest1-rhel5-64 \
--disk path=/var/lib/libvirt/images/guest1-rhel5-64,size=8 \
--nonsparse --vnc \
--vcpus=2 --ram=2048 \
--location=http://example1.com/installation_tree/RHEL5.6-Server-x86_64/os \
--network bridge=br0 \
--os-type=linux \
--os-variant=rhel5.4
(see the man page for installing from CD or from an ISO image created using dd)
Or you can run the GUI tool virt_manager and follow the wizard for "creating a new virtual system".
Virtualisation
See the comments for a discussion of various Virtualisation systems. With respect to the first part of the above question, I think of them as falling into three groups:
Hypervisors which you can install without first having installed a conventional operating system. For example VMWare ESXi
Hypervisors which are installed after you have installed a conventional operating system but which (to some extent) replace the normal operating system kernel. When you boot the computer, it boots the hypervisor first. For example Xen (and Hyper V if I understand correctly)
Hypervisors which are added to an operating system as a module. These essentially extend the existing kernel using existing published kernel facilities rather than replacing (key parts of) the kernel. For example KVM.
The above is a simplification and reflects my own opinion and limited understanding. Virtualisation is a complicated subject (viz Paravirtualisation, Intel VD-x, AMD V, ...) - consult Wikipedia, Google and other sources for a better understanding of Virtualisation.