Sunday, September 29, 2013

Building xenserver-core [feedly]


 
 
Shared via feedly // published on Latest blog entries // visit site
Building xenserver-core

In a previous post, Dave Scott showed how easy it now is to install the core components of XenServer on a standard installation of CentOS, using xenserver-core. Since then, we have been hard at work adding features and functionality, and making it even smoother and easier to install from our repositories. However, since developers are a major part of the audience for xenserver-core, we have also paid a lot of attention to making it as smooth and easy as possible to build the packages for yourself.

Prerequisites

On RPM-based distributions, the packages are built using a tool called mock. Mock builds each new package in a fresh chroot environment, ensuring that your system isn't affected by the by-products of building packages, and that missing dependencies in the package specifications don't go unnoticed. To install it on a RHEL/CentOS system then you will need to add the EPEL repositories. Here is a useful article for CentOS.

After adding EPEL, install and set up mock:

yum install -y mock rpm-build

Mock will refuse to run as root - you can run it using your own user account, or a special account you create for this purpose. To add this account to the mock group, type the following as root:

useradd  -G mock
br>passwd br>br>su -

Building the packages

With the prerequisites installed, building xenserver-core is a 4-step process:

  1. Clone the xenserver-core repository. If you are planning to make changes, you should fork the repository on GitHub and clone that instead. To clone the main xenserver-core repository, type:

    git clone https://github.com/xapi-project/xenserver-core.git
  2. This configures mock and initializes an RPM repository in the RPMS directory, where the built packages will be stored. Enter the directory created by git (by default, it will be called "xenserver-core") and type:

    ./configure.sh
  3. Generate the makefile which will actually build the xenserver-core packages:

     ./makemake.py > Makefile
  4. Start the build:

    make

Building all the xenserver-core packages takes around 90 minutes on a reasonably fast machine, and requires a couple of gigabytes of free disk space. When the build finishes, you will find source packages in the SRPMS directory, and binaries in RPMS.

Installing your new packages

The most flexible way to install your packages is to copy newly-built RPM repository to a web server and configure YUM on your target machine to download packages from there. Assuming that you already have a web server set up, copy the RPMS and SRPMS directories to your server's DOCROOT directory.

To configure the target machine to use your new repository, create /etc/yum.repos.d/xapi.conf, filling in your repository's baseurl as appropriate:

[xapi]
br>name=CentOS-$releasever - xenserver-corebr>baseurl=http://your.server.address/path/to/RPMS/br>gpgcheck=0br>Priority=1br>enabled=1br>br>[xapi-source]br>name=CentOS-$releasever - xenserver-corebr>baseurl=http://your.server.address/path/to/RPMS/br>gpgcheck=0br>Priority=1br>enabled=0

After this, type yum install xenserver-core to install the packages from your new repository. Once the installation is complete, run the xenserver-install-wizard command to configure xenserver-core. Please note that, unless you were already running under Xen, you will have to reboot to complete the installation.

What's going on here?

When you cloned the xenserver-core repository you may have noticed that it doesn't actually contain any software. Instead, it has a collection of RPM SPEC files, along with the build scripts we ran above. When you run make, it downloads each package's source code from the upstream repository, builds a source RPM, then uses mock to compile the binary RPM, as you can see in this snippet of build output:

[CURL] SOURCES/libvhd-0.9.1.tar.gz
br>[RPMBUILD] SRPMS/ocaml-libvhd-0.9.1-1.src.rpmbr>[MOCK] RPMS/x86_64/ocaml-libvhd-0.9.1-1.x86_64.rpmbr>[CREATEREPO] RPMS/x86_64/ocaml-libvhd-0.9.1-1.x86_64.rpm

Please give us feedback

We want to make xenserver-core as easy as possible to install, build and use. We would love to hear what you think of our progress so far. You can contact us through comments on this blog. If you have development questions about XenServer and its components, try the xs-devel@xenserver.org mailing list.

If you run into any problems or bugs in xenserver-core's packaging or build scripts, please raise an issue on our GitHub issues page.

Prefer Ubuntu?

Following the instructions above will build xenserver-core for an RPM-based distribution such as Fedora or CentOS. What if you prefer Ubuntu or another Debian-based distribution? Try cloning the repository onto your Ubuntu machine and running the build there. The results may surprise you!

More updates coming soon...






Sent from my iPad

No comments:

Post a Comment