One of our regular reader asks:

I’m using CentOS Linux 5 server. How do I set up Xen on Linux ? How do I install guest VPS oses such as Fedora or Windows 2000 or Debian Linux inside XEN?

Xen is a free open source software virtual machine monitor for Intel / PowerPC architectures. It is software that runs on a host operating system and allows several guest operating systems to be run on top of the host on the same computer hardware at the same time (just like VMWare software). Luckily Installing and managing XEN is quite easy under CentOS 5 Linux.

Login as the root and type the following commands:
# yum install xen virt-manager kernel-xen
# chkconfig xend on
# reboot

Make sure you boot CentOS server using XEN kernel.

How do I install NetBSD / any Linux distro / Windows 2000 inside XEN?

Simply use gui tool called virt-manager:
# virt-manager &

CentOS XEN Virtual machine manager

CentOS XEN Virtual machine manager

Now just follow on screen instructions to setup new guest operating systems (VPS oses). virt-manager is Xen Management Consoles software. It can perform the common tasks of administering a Xen host such as configuring, starting, monitoring and stopping of Xen guests oses. Please note that above instructions also works on

  • RHEL 5
  • Fedora Linux 7

Installing CentOS 5.3 guest using the Internet

virt-install is a command line tool for provisioning new virtual machines using the “libvirt” hypervisor management library. Type the following command to install CentOS v5.3 64 bit as guest operating system in /vm:
# mkdir /vm
If you are using SELinux, enter:
# semanage fcontext -a -t xen_image_t "/vm(/.*)?"
# restorecon -R /vm
# ls -dZ /vm

Above will provide security context of Xen images. Finally, install CentOS 5.3 using the Internet mirror:
# virt-install \
--paravirt \
--name webserver01 \
--ram 512 \
--file /vm/ \
--file-size 10 \
--nographics \

Above will CentOS as a paravirtualized Xen guest, with 512 MB of RAM, a 10 GB of disk, and from a web server, in text-only mode. You need to just follow on screen instructions.

Fig.01: Centos Xen Virtualization Installation

Fig.01: Centos Xen Virtualization Installation

Once installed you can use xm command to list, start, stop and manage xen vps:
# xen list
Attach console to domain / guest called webserver01:
# xm console webserver01
See xm command cheat sheet.

Installing CentOS 5.3 guest using DVD

Install a CentOS guest, using LVM partition, virtual networking, booting from the host CDROM, using VNC server/viewer (insert DVD into drive):
# virt-install \
--connect qemu:///system \
--name mailserver
--ram 500 \
--file /dev/HostVG/ \
--network network:default \
--accelerate \
--vnc \
--cdrom /dev/cdrom

Note you need qemu and virt-viewer installed on the host system.

Installing Fedora guest using DVD iso image stored on hard disk

Install a Fedora Linux, with a real partition (/dev/sdc), using a local DVD ISO image:
# virt-install \
--name www2 \
--ram 1000 \
--file /dev/sdc \
--network bridge:eth1 \
--cdrom /tmp/fedorabootdvd.iso

Further readings:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 26 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
26 comments… add one
  • Artem Nosulchik Oct 18, 2007 @ 20:14

    Nice one! Is it necessary to enable any additional yum repositories in CentOS 5 in order to install xen, virt-manager and kernel-xen packages?

  • 🐧 nixCraft Oct 18, 2007 @ 20:38

    Noop, you can install from DVD or just download and install using yum.

  • raj Oct 23, 2007 @ 13:27

    Really easy, thanks for all info 🙂

  • Scott Jan 9, 2008 @ 20:38

    “Now just follow on screen instructions to setup new guest operating systems (VPS oses). ”

    You’re kidding, right? How unfortunate this topic got indexed in Google, because here’s what gets glossed over:

    Try installing a VM from a regular DVD. Go ahead. Please.

    Under Install Media URL, I’ve tried
    /media/Fedora 8 x86_64 DVD
    /media/Fedora8 (which I ln -s to ‘Fredora 8 x86_64 DVD’)
    /dev/scd0 (the DVD device)

    /dev/scd0 does spin the drive, but then vaguely complains it can not find what it needs…

    It appears you

    OK, pop in a Fedora 8 DVD

  • 🐧 nixCraft Jan 10, 2008 @ 4:11


    I’m sorry to hear it didn’t work out for you. These instructions are only tested on CentOS 5.0 and Fedora 7. I’ve already mentioned the fact.

  • nevyn Jan 20, 2008 @ 4:02

    What would have been helpful is if you had:
    a) included more information than “follow on screen instructions” such as a idea what sort of information we should be putting in a particular field. For example, if I wanted to install ubuntu-server, what would the URL be?
    b) Included the instructions for installing off local media – as far as I know, you can’t install directly off dvd or cd but can off nfs so if you export the cd/dvd via nfs and then use the url for the nfs share you’d be sweet.

  • quequotion Nov 14, 2008 @ 11:54

    this is a really poor and incomplete guide.

    first of all, it only works for those lucky few who get to use a graphical interface. professionals in the field, who must conserve resources and minimize infrastructure, have absolutely no use for virt-manager.

    second… there simply has to be more to it.

  • Piyush Dec 24, 2008 @ 12:31

    Vivek, Can you please add stuff like:
    Installation of XEN on non GUI system (with virt-console may be….)
    How to create a VM and change resources .. etc…

    Would be helpful ……….

    Thanks in Adv!

    – Piyush

  • Avalon May 20, 2009 @ 15:25

    Nice howto. Maybe not very thorough but gives an idea what to look for ( for noobs like me 🙂

    wrt professionals with no gui… go read the source hackers ;p

  • Avalon May 20, 2009 @ 15:35

    (sorry for double posting)
    Let me give you a hint though – vnc

  • Greg Dec 5, 2009 @ 20:10

    OK, I am absolutely new to setting up a virtual machine. I used the command below and received an error that I have no idea what it means:

    Paravirtualized guests cannot install off cdrom media.

    > –name Fedora-12
    > –ram 1000
    > –file /data/vm/Fedora-12
    > –network network:default

  • rchilro Jan 8, 2010 @ 22:47

    it is a fantastic tutorial!!!!!!!! right to the point!

    i wound suggest to include a note to edit the /etc/grub.conf and change the ‘default=0’ or it will start the old kernel.



  • Kartik Vashishta Feb 3, 2010 @ 16:24

    The option to install the virtual host via CD/DVD is grayed out for me, the only options I have is to install via the internet. Did I miss some step to add the dvd drive to the virtual machine. Please help.

  • Shan Mar 16, 2010 @ 8:25

    Hi, Im running a centos 5 64bit +cpanel with about 15 hosting accounts running in it. There are few of them wanted windows hosting to run asp vb and etc. So i cant get a dedi or vps just for 2 or 3 accounts, so i have heard about using xen to run multiple vps on it, my questions are :

    1) can i install xen to run windows without interupting cpanel and other hosting accounts?

    2)Can i do all these installation from command prompt? how about windows OS? without CD?


  • smeagol Mar 24, 2010 @ 17:24

    I am having the same trouble as Kartil Vashishta, my vm manager does not allow me to install via CD/DVD, this is right after an install of centos in text mode then switching over to gui (because of an intel gma problem) just though I would add that although I don’t think that is what is causing it, also I am using the newest release 5.4 I think.

  • Gajendra Jul 14, 2010 @ 3:19

    while creating a new vm, It is giving only nfs,ftp,http installation option for me.

    there is no local installation or iso image method

    I am using centos 5.4

  • imross ali Nov 9, 2010 @ 6:59

    i think. i can do that. OK, I am absolutely new to setting up a virtual machine. I used the command below and received an error that I have no idea what it means:

    Paravirtualized guests cannot install off cdrom media.

    > –name Fedora-12
    > –ram 1000
    > –file /data/vm/Fedora-12
    > –network network:default


    • chenliang Apr 23, 2015 @ 11:50

      virt-install –name VM-Windows2008-1 –ram 4096 –vcpus 2 –disk path=/home/img/Windows2008.img,size=40 –network=bridge:BRIDGE –vnc –vncport=5911 –os-variant win2k8 –cdrom /home/iso/Windows2008_r2*.iso -d

      can you help me, thankyou~

  • Stoplink Nov 27, 2010 @ 9:41

    Can i install this for my running Dedicated server without effected to wunning websites?

  • iwan darmawan Dec 16, 2010 @ 1:50

    i want to ask about upgrade xen vps/
    i have been setup vps with xen and i want to uprgade the disk space and ram.

    can anybody give me tutorial to do this….
    best regards

  • Ainky Jul 24, 2011 @ 10:56

    hey thanx It worked for me in RHEL 5.3

  • baker Oct 12, 2011 @ 10:20

    Create a Host and 4 VM Guests using XEN (not Virtual Box):
    a. The Host:
    i. CentOS Linux
    ii. Network address should be:
    iii. SSH and VNC should be enabled
    iv. Should be the Gateway to the Internet in both directions for the Guests – so, you shouldn’t be able to access the guests using SSH or VNC directly, you have to access them through the Host only.
    b. The Guests:
    i. RedHat Linux.
    ii. Network address should be:
    iii. SSH and VNC should be enabled
    iv. Two Guests should be installed using Para Technique, and two should use the Full Virtualization technique
    v. We need to be able to use HHD for two of them, and LVM for the other two
    vi. Install Apache Web Server on one of the guests – we should be able to access the web server from outside

    plz. some one help me i can do this as a concept 🙂

  • Sunil Nov 23, 2011 @ 11:19

    Nice one

  • Farzan Dec 11, 2012 @ 2:15

    No package kernel-xen available.
    Nothing to do

  • Fasih Apr 20, 2013 @ 6:25

    Well its useful. Let me do this on my CentOS that has a Squid Server, will update you then, See ya soon (Y)


  • gulzanesther Aug 22, 2016 @ 11:33

    really good pls help me in programming
    ……with regards

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum