-
Notifications
You must be signed in to change notification settings - Fork 10
CentOS Build Instructions
This page contains information about building various components of the Toolkit in CentOS 6.
The Toolkit includes a custom version of the CentOS 6 RHEL (Red Hat Enterprise Linux) kernel.
To build this kernel, you will need a host with CentOS 6, and the 'rpm-build' package installed (optionally mock) with at least 15 GB of space available.
- Download the most recent kernel Source RPM for CentOS 6
- Navigate to the proper release, i.e. http://vault.centos.org/6.6/updates/Source/SPackages/
- Unpack the kernel source RPM (eg.
rpm -ivh kernel-2.6.32-279.2.1.el6.src.rpm
) by doing:- rpm2cpio kernel-2.6.32-279.2.1.el6.src.rpm | cpio -id
- This will unpack the kernel source RPM into the same directory you are in
- Download web100_changes.patch from https://raw.githubusercontent.com/perfsonar/toolkit-building/master/software/kernel/web100_changes.patch to the same directory where the kernel sources were unpacked.
- Apply the patch with "patch -i web100_changes.patch -p1". This will likely leave a few .rej files around. You will need to edit those files, and manually apply the changes.
- Unpack the kernel source RPM (eg.
- To build the kernel SRPM run:
rpmbuild --define "_sourcedir ." --define "_srcrpmdir ." --nodeps -bs *spec
- If the above commands executed properly you should see a kernel SRPM file
- If not look through the output to determine what went wrong
- To build the kernel run mock (make sure your user is in the "mock" group):
- x86_64: mock -r epel-6-x86_64 --resultdir=$HOME/mock-results/epel-6-x86_64/ --arch=x86_64 --without=debug --without=kabichk kernel_file.src.rpm
- i386: mock -r epel-6-i386 --resultdir=$HOME/mock-results/epel-6-i386 --arch=i386 --target=i686 --without=debug --without=kabichk kernel_file.src.rpm
- You also need to run a third command to build the firmware as noarch:
- mock -r epel-6-i386 --resultdir=$HOME/mock-results/epel-6-i386 --arch=i386 --target=noarch --without=debug --without=kabichk --with=firmware kernel_file.src.rpm
- If new patches have been added, these commands may error out due to patches that don't apply cleanly. If so, these patches will need modified as appropriate and the command rerun (look here)
The pS-Performance Toolkit NetInstall is built using custom CentOS kickstart files. You can read more about kickstart installations here. The kickstart file defines the set of software repositories to use, the set of software to install, and a script that performs some system configuration once the software has been installed. Customizing the toolkit will involve changing one or more of those elements in the kickstart files.
The build procedures here assume that the toolkit ISOs are being built on CentOS 6. The steps may work on other systems, but have only been tested on CentOS 6.
For building custom versions of the NetInstall, you'll need a copy of ImageMagick installed on the host. This should be available via yum.
For building custom versions of the NetInstall, you will need a copy of mkisofs installed on the host. This should be available via yum.
You can download the kickstarts, images and scripts needed to build the toolkit by doing a git checkout of http://github.com/perfsonar/toolkit-building
The important directories for customization are kickstarts
, images
, and scripts
. The kickstarts
directory contains the files used for generating the kickstarts used by the NetInstall setup. The scripts
directory contains scripts used for building the toolkit. The images
directory contains the image displayed when the CD is first booted.
If you run the script build_netinstall.sh
as root, it should build an ISO of the NetInstall.
As of the CentOS 6 release, there is an option to specify whether to build a 32-bit or 64-bit version. If the script is executed without any parameters it will automatically build a 32-bit version of the Toolkit, however if you wish to build a 64-bit version you must supply the script with an architecture parameter. For example, to build a 64-bit version of the NetInstall you would run build_netinstall.sh --arch x86_64
as root. Note that this requires all Toolkit software to be rebuilt for 64-bit compatibility.
The general build process of the NetInstall roceeds as follows:
- Patches the 'generic' kickstart file (
centos6-base.cfg
) with NetInstall-specific modifications (centos6-netinstall.patch
) - Modifies the generic CentOS netinstall CD (in the
resources
directory) to include the kickstart and to boot using it - Modifies the generic CentOS netinstall CD to use the proper boot image
To customize the toolkit, you will need to modify the kickstart file. The centos6-base.cfg
file in the kickstarts directory is the 'generic' kickstart file. There is patch file centos6-netinstall.patch
that modifies this kickstart file.
There are a large number of directives inside the kickstart. The meaning of most of these is outside the scope of this document, but should be available here.
The set of repositories that will be used to retrieve RPMs from can be customized. This allows you to use a local mirror to speed up builds as well as to include new or customized RPMs. Note, however, that when changing the repositories, you must make sure that the software to be installed (either directly or to satisfy dependencies) must still be available in the set of repositories.
The 'repo' lines specify the set of repositories to use:
repo --name=a-Internet2 --baseurl=http://software.internet2.edu/rpms/i386/main/
The above line tells the kickstart to use the Internet2 repository and gives the URL of the yum repository.
Note: the repositories here are only used for installation. They will not be available after installation. If you want to make these software repositories available after installation, you must either have the kickstart install an appropriate repository package (see here for an example of the repository package), or have the post installation script add the appropriate .repo and key files.
In the %packages
section, there are a list of packages to install or not install. Any packages that start with "@" are package groups (e.g. @core
is the set of core packages). Any packages that start with "-" are packages that should not be installed (e.g. -sysreport
says to not install the sysreport package). All other packages are normal packages to install like you might do with yum.
You can add any packages here that you might want installed.
The toolkit system environment can be configured using the %post script
. This script is run after the software packages have been installed, and allow for modifications to be made to the installed system before it is booted for the first time.
There is an existing %post
script that performs a number of tasks needed by the toolkit. However, this script can be modified to include any desired configuration for the toolkit system. For example, users could be added, or configuration files could be modified. The existing post installation script includes a wide variety of methods for configuring aspects of the installed system.
The thing to remember when making changes is that the patch files expect to patch the centos6-base.cfg
file. There are a few ways to go about making changes. One way is to make changes to the centos6-base.cfg
in such a way that they don't conflict with the patches. This is generally the path of least resistance.
This page contains background information on mock. The latter sections assume basic knowledge of mock and 'holding' repositories, and that the holding repository has been configured as described.
This page contains information on creating and building source RPMs. The latter sections assume basic knowledge of building source RPMs.
To ease the use of mock, we built a simple wrapper script over the mock command which simply sets some default values:
- The uniqueext value will be set to the callers username
- The architecture is set to "i386"
- The default build environment is set to "epel-6" (RedHat6 + the EPEL repositories)
- The output directory is set to /home/username/holding/environment/architecture/name
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
Getopt::Long::Configure("pass_through");
Getopt::Long::Configure("no_ignore_case");
my $uniqueext;
my $resultdir;
my $arch;
my $distro;
my $result = GetOptions("uniqueext=s", \$uniqueext, "resultdir=s", \$resultdir, "arch=s", \$arch, "distro=s", \$distro);
my @remaining_args = @ARGV;
my $srpm = $ARGV[$#ARGV];
unless ($srpm)
{
print "No source RPM specified.\n";
exit(-1);
}
unless (`rpm -qp $srpm 2>/dev/null`)
{
print "Invalid SRPM: $srpm";
exit(-1);
}
my ($name, $pass, $uid, $gid, $quota, $comment, $gcos, $dir, $shell, $expire) = getpwuid($>);
$arch = "i386" unless ($arch);
$distro = "epel-6" unless ($distro);
$uniqueext = $name unless ($uniqueext);
$resultdir = "/home/$name/holding/$distro/$arch/" . `rpm -qp $srpm 2>/dev/null` unless ($resultdir);
chomp($resultdir);
my $mycfg = "$distro-$arch";
$mycfg = "$distro-i386" if ( ! -e "/etc/mock/$mycfg" and $arch eq "i686" and -e "/etc/mock/$distro-i386.cfg");
my @args = ();
push @args, ("/usr/bin/mock");
push @args, ("-r", $mycfg);
push @args, ("--resultdir", $resultdir);
push @args, ("--uniqueext", $uniqueext);
push @args, ("--arch", $arch);
push @args, @remaining_args;
print join(" ", @args) . "\n";
system(@args);
- Build a source RPM of I2utils (e.g. I2util-1.1-1.el6.src.rpm)
- A copy of the source/spec file is available at http://github.com/perfsonar/i2util
- Run:
i2_mock [I2utils SRPM]
(e.g.i2_mock I2util-1.1-1.el6.src.rpm
)
- Build a source RPM of web100_userland (e.g. web100_userland-1.8-1.el6.src.rpm)
- A copy of the source/spec file is available at https://github.com/perfsonar/toolkit-building/tree/master/software/web100-userland
- Run:
i2_mock [web100_userland SRPM]
(e.g.web100_userland-1.8-1.el6.src.rpm
)
- Place a built RPM of I2utils into the 'holding' repository
- Build a source RPM of bwctl (e.g. bwctl-1.4rc1-1.el6.src.rpm)
- A copy of the source/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/bwctl/
- Run:
i2_mock [bwctl SRPM]
(e.g.i2_mock bwctl-1.4rc1-1.el6.src.rpm
)
- Place a built RPM of I2utils into the 'holding' repository
- Build a source RPM of owamp (e.g. owamp-3.3rc1-1.el6.src.rpm)
- A copy of the source/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/owamp/
- Run:
i2_mock [owamp SRPM]
(e.g.i2_mock owamp-3.3rc1-1.el6.src.rpm
)
- Place a built RPM of I2utils into the 'holding' repository
- Place a built RPM of web100_userland into the 'holding' repository
- Build a source RPM of ndt (e.g. ndt-3.6.4-3.el6.src.rpm)
- A copy of the sources/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/ndt/
- Run:
i2_mock [ndt SRPM]
(e.g.ndt-3.6.4-3.el6.src.rpm
)
- Place a built RPM of web100_userland into the 'holding' repository
- Build a source RPM of npad (e.g. npad-1.5.6-2.el6.src.rpm)
- A copy of the sources/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/npad/
- Run:
i2_mock [npad SRPM]
(e.g.i2_mock npad-1.5.6-2.el6.src.rpm
)
- Build a source RPM of nuttcp (e.g. nuttcp-6.1.2-1.el6.src.rpm)
- A copy of the sources/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/nuttcp/
- Run:
i2_mock [nuttcp SRPM]
(e.g.i2_mock nuttcp-6.1.2-1.el6.src.rpm
)
- Build a source RPM of dbxml (e.g. dbxml-2.5.16-1.el6.src.rpm)
- A copy of the source/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/dbxml/
- Run:
i2_mock [dbxml SRPM]
(e.g.i2_mock dbxml-2.5.16-1.el6.src.rpm
)
- Place a built RPM of dbxml into the 'holding' repository
- Build a source RPM of perl-dbxml (e.g. perl-dbxml-2.5.16-1.el6.src.rpm)
- A copy of the source/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/dbxml/
- Run:
i2_mock [perl-dbxml SRPM]
(e.g.i2_mock perl-dbxml-2.5.16-1.el6.src.rpm
)
- Build a source RPM of the kernel. This will involve steps described above. (e.g. kernel-2.6.32-279.2.1.el6.aufs.web100.src.rpm)
- Run
i2_mock --arch i686 --without debug --without kabichk [kernel SRPM]
(e.g.i2_mock --arch i686 --without debug --without kabichk kernel-2.6.32-279.2.1.el6.aufs.web100.src.rpm
)- NOTE: make sure you have at least 5 GB of available disk space for building the set of kernels
- Copy the kernel development RPMS (kernel-devel) into the 'holding' repository
- Make note of the kernel version number (e.g. 2.6.32-279.2.1.el6.aufs.web100)
- Build a source RPM of the aufs module (e.g. aufs-kmod-2.2-1.el6.src.rpm)
- A copy of the sources/spec file is available at https://github.com/perfsonar/toolkit-building/tree/master/software/aufs
- Run
i2_mock --arch i686 -D "kversion [kernel version number]" [aufs-kmod SRPM]
(e.g.i2_mock --arch i686 -D "kversion 2.6.32-279.2.1.el6.aufs.web100" aufs-kmod-2.2-1.el6.src.rpm
)
- Copy the aufs-kmod RPMS into the 'holding' repository
- Build a source RPM of the aufs utilities (e.g. aufs-util-2.2-1.el6.src.rpm)
- A copy of the sources/spec file is available at https://github.com/perfsonar/toolkit-building/tree/master/software/aufs
- Run
i2_mock [aufs-util SRPM]
(e.g.i2_mock aufs-util-2.2-1.el6.src.rpm
)
- Copy the kernel development RPMS (kernel-devel) into the 'holding' repository
- Make note of the kernel version number (e.g. 2.6.32-279.2.1.el6.aufs.web100)
- Build a source RPM of the sk98lin module (e.g. sk98lin-kmod-10.92.1.3-1.el6.src.rpm)
- A copy of the sources/spec file is available at http://anonsvn.internet2.edu/svn/nptoolkit/trunk/software/sk98lin/
- Run
i2_mock --arch i686 -D "kversion [kernel version number]" [sk98lin-kmod SRPM]
(e.g.i2_mock --arch i686 -D "kversion 2.6.32-279.2.1.el6.aufs.web100" sk98lin-kmod-10.92.1.3-1.el6.src.rpm
)