Page 1 of 2 12 LastLast
Results 1 to 25 of 38
  1. #1
    Join Date
    Dec 2005
    Posts
    3,110

    Smile Howto: Install Xen 4 on CentOS 5 and CentOS 6!

    Today we are going to explain how you can do a basic, but upto-date install of Xen on your CentOS 5 or CentOS 6 system ready for use with SolusVM, HyperVM or another control panel.

    This is based around packages which I maintain for both distributions including a Dom0 kernel for CentOS 6. Currently I use Xen 4.1.4 and Linux 3.4.xx, with security updates added as and when I get time. Sure there are other places out there to get Xen packages, but more often than not they are untested, out of date or too bleeding edge for production.

    Let's get started...

    Requirements

    * CentOS 5 or CentOS 6 (64Bit Only)
    * Appropriate partitioning (Majority of space unallocated and free in a LVM Volume Group)
    * Some spare time

    CentOS 5

    1. Install my GPG key to ensure only signed packages are installed should there ever be an issue with the repo
    Code:
    rpm --import http://repo.smartservermanagement.com/RPM-GPG-KEY-SSM
    2. Create a new yum .repo file with your favourite editor:
    Code:
    nano /etc/yum.repos.d/ssm.repo
    Next paste in:
    Code:
    [smartservermanagement]
            name=SmartServerManagement Repository
            baseurl=http://repo.smartservermanagement.com/el$releasever/$basearch/
            gpgcheck=1
            enabled=1
    3. Install Xen
    Code:
    yum install xen kernel-xen
    4. Next we keed to configure grub. Open /etc/grub.conf with your favourite editor:
    Code:
    nano /etc/yum.repos.d/ssm.repo
    5. It should look something like the entry below, add the dom0_mem entry to your kernel, depending on how much RAM your server has and how many VPS you intend to host, you should set between 512MB and 4096MB.
    Code:
    title CentOS (2.6.18-348.1.1.el5xen)
            root (hd0,0)
            kernel /boot/xen.gz-4.1.4 dom0_mem=1024m
            module /boot/vmlinuz-2.6.18-348.1.1.el5xen ro root=LABEL=/
            module /boot/initrd-2.6.18-348.1.1.el5xen.img
    Note: In some cases you may need to append pci=nomsi to the end of the kernel entry.

    6. Once you are happy, check that Xen is set as the first kernel to boot, and restart your system.


    CentOS 6

    1. Install my GPG key to ensure only signed packages are installed should there ever be an issue with the repo
    Code:
    rpm --import http://repo.smartservermanagement.com/RPM-GPG-KEY-SSM
    2. Create a new yum .repo file with your favourite editor:
    Code:
    nano /etc/yum.repos.d/ssm.repo
    Next paste in:
    Code:
    [smartservermanagement]
            name=SmartServerManagement Repository
            baseurl=http://repo.smartservermanagement.com/el$releasever/$basearch/
            gpgcheck=1
            enabled=1
    3. Install Xen
    Code:
    yum install xen kernel-xen
    4. Next we keed to configure grub. Open /etc/grub.conf with your favourite editor:
    Code:
    nano /etc/yum.repos.d/ssm.repo
    5. It should look something like the entry below.

    Code:
    title CentOS (3.4.29-1.el6xen.x86_64)
            root (hd0,0)
            kernel /boot/vmlinuz-3.4.29-1.el6xen.x86_64 ro root=UUID=2d68d0d5-985d-496a-88a4-67bb3c8b4a46 rhgb quiet
            initrd /boot/initramfs-3.4.29-1.el6xen.x86_64.img
    6. Notice that although our Dom0 capable kernel has been installed, the Xen kernel itself is not automatically added so you need to add this in, then the linux kernel and initrd (ramdisk) become modules of the xen kernel.

    Look at our example below.

    Pay attention to the path, if your system has a dedicated /boot partition it may just say /<filename> instead of /boot/<filename>

    Code:
    title CentOS (3.4.29-1.el6xen.x86_64)
            root (hd0,0)
            kernel /boot/xen.gz
            module /boot/vmlinuz-3.4.29-1.el6xen.x86_64 ro root=UUID=2d68d0d5-985d-496a-88a4-67bb3c8b4a46 rhgb quiet
            module /boot/initramfs-3.4.29-1.el6xen.x86_64.img
    7. Next you need to add your Dom0 memory limit, as on CentOS 5 this is usually between 512M to 4096M depending on the size of your machine and how many VPS you want to host.

    On CentOS 6 systems we also need to tell the Linux kernel how much memory it has with the mem= option.

    Example (Scroll to the right to see the mem= option:

    Code:
    title CentOS (3.4.29-1.el6xen.x86_64)
            root (hd0,0)
            kernel /boot/xen.gz dom0_mem=1024M
            module /boot/vmlinuz-3.4.29-1.el6xen.x86_64 ro root=UUID=2d68d0d5-985d-496a-88a4-67bb3c8b4a46 rhgb quiet mem=1024M
            module /boot/initramfs-3.4.29-1.el6xen.x86_64.img
    Note: I recommend no less than 1GB Dom0 memory for CentOS 6 systems, on some hardware you lose some usable memory due to an addressing bug/issue in the PV_OPS framework. Adding the mem= option onto the Linux kernel helps alleviate that issue but its not 100%.

    6. Once you are happy, check that Xen is set as the first kernel to boot, and restart your system.

    After your reboot, check to see if Xen is running

    Should look something like this...

    Code:
    [root@my ~]# xm info
    host                   : my.server.com
    release                : 3.4.29-1.el6xen.x86_64
    version                : #1 SMP Thu Jan 31 18:21:40 GMT 2013
    machine                : x86_64
    nr_cpus                : 8
    nr_nodes               : 1
    cores_per_socket       : 4
    threads_per_core       : 2
    cpu_mhz                : 3400
    hw_caps                : bfebfbff:28100800:00000000:00007f40:73bae3ff:00000000:00000001:00000281
    virt_caps              : hvm hvm_directio
    total_memory           : 32648
    free_memory            : 12634
    free_cpus              : 0
    xen_major              : 4
    xen_minor              : 1
    xen_extra              : .4
    xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
    xen_scheduler          : credit
    xen_pagesize           : 4096
    platform_params        : virt_start=0xffff800000000000
    xen_changeset          : unavailable
    xen_commandline        : dom0_mem=1024M
    cc_compiler            : gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
    cc_compile_by          : mockbuild
    cc_compile_domain      : smartservermanagement.com
    cc_compile_date        : Fri Jan 18 13:12:04 GMT 2013
    xend_config_format     : 4
    Questions / Answers / What to do if you get stuck?

    * If you are using CentOS 6, you will be running a kernel newer than most distro's, so you may need to use Pygrub if they fail to boot.

    * DHCP does not work for Xen HVM, SolusVM currently doesn't write the configuration for compatibility on CentOS 6. Hopefully this will be addressed eventually.

    * If you think you've found a bug, please PM Me with the issue + fix and I will add it in.

    * The CentOS 6 kernel is based around a modified version of the RedHat .spec so hardware compatibility should be pretty good, if there is a piece of hardware not supported, let me know.

    * This is 100% free, but I dont have time to provide free support for everyone so if you get stuck, post a reply, and I'm sure someone will be able to help. Or drop me a PM and for a small fee I can do the install for you + various other bits and pieces.

    Thanks, and happy hosting!

    Chris

  2. #2
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,431
    Have you managed to get ipv6 to work on the DomU's in a xen setup ?

  3. #3

    kernel-xen for CentOS5

    I can't find kernel-xen for CentOS 5 (el5) in your repository.
    Could you provide the rpms for the kernel-xen(el5)?

  4. #4
    Join Date
    Dec 2005
    Posts
    3,110
    I dont provide a kernel-xen package for CentOS 5 because there is already one provided by default.

    CentOS 5 = Xen packages only
    CentOS 6 = Xen packages and kernel-xen package.

    Yes we do have customers using ipv6 with these packages.

  5. #5
    Your guide simply does not work for me at this time. Not even the first couple steps. I am getting cannot resolve host and cannot retrieve repository meta as well as I am unable to download your gpg key as the host is not resolving.
    Last edited by Zazhost; 03-20-2013 at 12:32 PM.

  6. #6
    Join Date
    Mar 2011
    Location
    Edinburgh, UK
    Posts
    567
    Have you configured a DNS server in your /etc/resolv.conf file?

    Try adding this to that file:

    nameserver 8.8.8.8
    nameserver 8.8.4.4

    then run this command:

    chattr +i /etc/resolv.conf

    that will stop it being overwritten when you restart your network.
    ViralVPS.com - Linux & Windows Xen VPS Servers
    10Gbps Connection | Netherlands Location | IPv4 & IPv6
    SSD Cached RAID10 Storage | Instant Setup! | Bitcoin Accepted

  7. #7
    Thank you Mike. I checked the setting again and noticed it was set to my datacenters which of course would happen to be crap. So I changed it to comodos and im good to go now. Thank you!

  8. #8
    error 20 multiboot kernal must be loaded before modules.

    Any ideas?
    Last edited by Zazhost; 03-20-2013 at 02:50 PM.

  9. #9
    Join Date
    Dec 2005
    Posts
    3,110
    It's kernel not kernal, check your spelling.

  10. #10
    Oh, missed that one.
    Last edited by Zazhost; 03-20-2013 at 03:14 PM.

  11. #11
    I am now stuck. I have everything setup and configured, a test vps created but wont boot. Checked the xen log and saw this:

    Code:
    Traceback (most recent call last):
      File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomainInfo.py", line 106, in create
        vm.start()
      File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomainInfo.py", line 474, in start
        XendTask.log_progress(31, 60, self._initDomain)
      File "/usr/lib64/python2.6/site-packages/xen/xend/XendTask.py", line 209, in log_progress
        retval = func(*args, **kwds)
      File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomainInfo.py", line 2838, in _initDomain
        self._configureBootloader()
      File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomainInfo.py", line 3285, in _configureBootloader
        bootloader_args, kernel, ramdisk, args)
      File "/usr/lib64/python2.6/site-packages/xen/xend/XendBootloader.py", line 44, in bootloader
        raise VmError(msg)
    VmError: Disk isn't accessible

  12. #12
    Join Date
    Dec 2005
    Posts
    3,110
    The answer is in the error message
    VmError: Disk isn't accessible
    Check the disk entry in your configuration file or the LV/image.

  13. #13
    Was a partitioning error as Chris pointed out. Thanks for the how-to and thanks for all the help!

  14. #14
    Join Date
    Dec 2005
    Posts
    3,110
    No problem There will be a new kernel out shortly, nothing exciting just fixes a PCI passthrough bug which 99% of people wont be using.

  15. #15
    Join Date
    May 2009
    Location
    Chile
    Posts
    48
    for update xen, is necessary only execute yum update and modify grub?

    Thanks

  16. #16
    Join Date
    Dec 2005
    Posts
    3,110
    Yep simple as that

  17. #17
    Join Date
    May 2009
    Location
    Chile
    Posts
    48
    Quote Originally Posted by PCS-Chris View Post
    Yep simple as that
    Thanks.

    Recently vulnerability requiere kernel update?

    Rgds

  18. #18
    Join Date
    Dec 2005
    Posts
    3,110
    I would reccomend you stay upto date with the Xen + Kernel packages, but my 3.4x Dom0 kernel is not vulnerable to the recent kernel vulnerability in CentOS 6

  19. #19
    Tried your scripts and failed, server can't boot up.

    Centos5.9 64bit, Hareware raid10, 32GB ram

  20. #20

    Generating RPM from xen tar.gz

    Hi Chris,

    First off thanks much for maintaining the yum repository with latest xen RPMs. Most helpful!

    My question is: is creating these xen RPMs as simple as rigging up an xen.spec that unpacks the xen tar.gz and builds it and packages the files? That's what I've done but would appreciate any tips, etc. you might have.

    Thanks!

    John

  21. #21
    Join Date
    Dec 2005
    Posts
    3,110
    Sorry for the delay replying to these

    @ComfortVPS - I need more information to be even slightly useful here. What RAID card? What motherboard? Any chance of a screenshot of the error? It could be a Xen issue, or it could be a missing driver for your machine.

    @jschmaus - Yep more or less, and tidying up patches when things break.

    I've been really busy lately but just pushed out new packages xen 4.1.5-4.

  22. #22
    Hi,

    My grub file looked differently from yours and after trying to get it to work I broke the whole system.
    Now I can't boot it up anymore either.

    Would anyone be able to assist me setting up Xen on CentOS 6?

    - Artaex

  23. #23
    Join Date
    Dec 2005
    Posts
    3,110
    What is the error?

    Can you paste your grub.conf here and we can advise?

  24. #24
    Quote Originally Posted by PCS-Chris View Post
    What is the error?

    Can you paste your grub.conf here and we can advise?
    Hi,

    There's no error because I can't reach the system.
    I rebooted the system but I can no longer connect to it.
    I have already contacted the hosting provider to reinstall the OS.

    I would really like someone to help me as I'll probably be charged for another OS reinstall if this fails again.

    - Artaex

  25. #25
    Join Date
    Dec 2005
    Posts
    3,110
    There is nothing anyone on this forum can do to help unless you can give us more information. What do you expect us to do, guess? It could be a thousand different things.

    You don't need to reinstall your OS just because your server doesn't boot, thats a complete waste of time.

    Just ask your provider to boot into the next available kernel. When your system boots, you will come to a Grub boot menu where you can let it boot the default kernel (Usually this times out after 5 or 10 seconds), or you can interrupt it and boot an alternate kernel in the list.

    Even if you deleted every kernel from your system except the Xen kernel, you could have them fix it in minutes by booting off a rescuecd.

Page 1 of 2 12 LastLast

Similar Threads

  1. how install XEN in Centos
    By linuxtop in forum VPS Hosting
    Replies: 12
    Last Post: 04-07-2012, 02:10 PM
  2. Xen and CentOS install
    By butch3r in forum Dedicated Server
    Replies: 4
    Last Post: 10-26-2009, 09:14 AM
  3. Replies: 2
    Last Post: 06-12-2009, 11:31 PM
  4. Howto load tun/tap on centos XEN VPS ?
    By fraserflav in forum Hosting Security and Technology
    Replies: 2
    Last Post: 08-31-2007, 02:25 PM
  5. Howto load tun/tap on centos XEN VPS ?
    By fraserflav in forum VPS Hosting
    Replies: 1
    Last Post: 08-31-2007, 11:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •