Table of Contents
BigWorld provides a RPM implementation which allows the creation of binary RPM package for BWMachined. The RPM implementation uses the RPM system available in Linux distributions such as CentOS, RHEL and Fedora to generate RPM packages.
This chapter provides the following information:
-
Directory structure and files related to BigWorld RPM implementation.
-
How to generate BigWorld binary RPM packages.
-
Customising RPM Packages.
-
Setting up a yum repository.
-
Install, upgrade and uninstall using
yum
command. -
How to obtain version number of an installed package.
The RPM implementation is located in the bigworld/tools/server/rpm
directory:
-
The
Makefile
is used to generate RPM packages. -
The
generate.py
is used to facilitate the creation of RPM packages. -
The
binary_rpms
directory is where generated RPM packages are placed. -
The
rpm
directory also contains package specific directories. For example, thebwmachined
directory contains all the files specific to BWMachined.
Binary RPM packages must be generated using a normal Unix user account. Binary RPM packages must not be generated using the root user.
Note
RPM generation should not be performed from a Windows mount. Only perform the build from a native Linux filesystem or compatible Linux network file system such as NFS.
In order to allow RPM's to be built into a user writeable directory,
it is necessary to modify the user's .rpmmacros
file.
This file will contain the location of the directories in which the RPM
files will be built. Firstly we need to create the directory structure to
use. For this example we will create a new directory in the user's home
directory called rpmbuild
. We also
require an RPMS
subdirectory where
package files will be placed.
$ mkdir -p ~/rpmbuild/RPMS
Next we need to let the rpm build environment know how to use that directory. This simply involves creating a new user specific rpm macro file as follows.
$ vim ~/.rpmmacros
Copy and paste the following content into the
.rpmmacros
file.
%_topdir /home/username
/rpmbuild
%_tmppath %{_topdir}/tmp
Write and close this file. To confirm the change you made has been successful, run the following command to ensure the path looks correct.
$ rpm --eval %_topdir
To generate RPM package for BWMachined, go to the bigworld/tools/server/rpm
directory and run
the following command:
$ make
The generated RPM package will be placed in the bigworld/tools/server/rpm/binary_rpms
directory.
The generated RPM package will have the following file name:
bigworld-bwmachined-<version>
-<release>
.<architecture>
.rpm
-
The
<version>
field is the version number of the BigWorld release that the package was generated from. This field is based on the version number inbigworld/res/version.xml
. -
The
<release>
field identifies the specific build of this RPM package. By default, it is not used and is mapped to patch number inbigworld/res/version.xml
. -
The
<architecture>
field will be either i386 for 32 bit systems, or x86_64 for 64 bit installations.
The most common customisation of a RPM package is the configuration file(s) installed by the package. That is, one RPM package may include the default configuration file and another may include a customised configuration file. These RPM packages can be distinguished by using the release field in the filename of these packages.
For example, the configuration file included in a BWMachined RPM
package is located in rpm/bwmachined/bwmachined.conf
.
To generate a BWMachined RPM package with the default configuration file and assign it the release number 0:
-
Use the
bwmachined.conf
provided by default. -
Update the
Release
tag inrpm/bwmachined/bwmachined_template.spec
to the following:Release: 0
-
Generate the RPM package.
The file name of the RPM package generated will be, for example,
bigworld-bwmachined-1.9.1.0-0.i386.rpm
.
To generate a BWMachined RPM package with customised configuration file and assign it the release number 1:
-
Update the bwmachined.conf as required.
-
Update the
Release
tag to 1. -
Generate the RPM package.
The file name of the RPM package generated will be, for example,
bigworld-bwmachined-1.9.1.0-1.i386.rpm
.
For a large environment where RPM Packages, e.g. the BWMachined RPM Package, need to be installed on many machines, we recommend that a Yum repository to be set up to provide these RPM packages. This allows an RPM package to be installed on any machine in the cluster by running the yum command without the need to manually copy the RPM package to each machine in the cluster.
The Yum repository created will need to be made available through a web server such as the Apache HTTP Server. The setup required is outside the scope of this document. Please consult relevant web server documentation on how to achieve this.
Steps to set up a Yum repository:
-
On the machine that will be hosting the Yum repository, create a directory for the BigWorld RPM packages. The location of this directory will depend on the web server chosen and the web server configuration which is outside the scope of this document.
-
Copy the RPM packages to the directory created.
-
Install the createrepo package using the following command:
$ yum install createrepo
This is a utility that will generate a common metadata repository from a directory of RPM packages.
Note
You will need to be the root user to install a package.
-
Run the following command to create the necessary metadata for the yum repository:
$ createrepo <path_to_dir>
where
<path_to_dir>
is the path to the directory created.For example, if the directory created is
/mnt/bigworld_repo
, then the command to run is the following:$ createrepo /mnt/bigworld_repo
This creates a
repodata
directory in the/mnt/bigworld_repo
directory. -
The
/etc/yum.conf
on a machine that will access the repository created will need to be updated to include the following setting:[<repo_name>] name=<repo_name> baseurl=<url_to_repo> enabled=1
where <repo_name> is replaced by the name given to the repository and <url_to_repo> is replaced by the URL that refers to the repository.
Note
By default, the
/etc/yum.conf
contains a [main] entry. The entry above should be added after the [main] entry.
When the yum repository is updated, for example,
a new version of BWMachined RPM package is added, then the repodata
directory should be deleted and the
createrepo
command should be run again to generate up-to-date
metadata.
If a new RPM package was added to the repository but is not displayed on a machine when running a query command such as
$ yum info bigworld-bwmachined
run the following command to delete the metadata used by Yum to determine the remote availability of packages:
$ yum clean metadata
When the yum command is run the next time, it will download the up-to-date metadata.
This section describes how to install, upgrade and uninstall using the yum command. The BWMachined package is used as an example.
-
To install a RPM Package directly without using yum repository:
$ yum --nogpgcheck install bigworld-bwmachined-<version>-<release>.i386.rpm
where
<version>
and<release>
are replaced by the actual version and release number.This assumes that you are running the Yum command in a directory containing the specified
.rpm
file.Note
The RPM packages created by BigWorld RPM implementation are not signed, since these packages are from trusted source. Therefore, during installation and upgrade, GPG check is disabled.
-
To upgrade a package:
$ yum --nogpgcheck upgrade bigworld-bwmachined-<version>-<release>.i386.rpm
-
To install a package from a Yum repository:
$ yum --nogpgcheck install bigworld-bwmachined
-
To upgrade a package:
$ yum --nogpgcheck upgrade bigworld-bwmachined