We will install Torque globally. Since there will be only a single version running on the cluster at a time, we will generate RPMs for it and install it across the cluster using yum.

1.1. Preparing for an RPM build

To build RPMs you will first need to install the necessary tools and set up a working environment.

  1. Install prerequisites for building an RPM (on master)

    [root@master ~]# yum install rpm-build rpmdevtools
    
  2. Create the RPM build tree

    [root@master ~]# rpmdev-setuptree
    

    This will create the directory structure used for RPM builds inside the current user’s home directory.

    [root@master ~]# tree $HOME/rpmbuild
    /root/rpmbuild
    ├── BUILD
    ├── RPMS
    ├── SOURCES
    ├── SPECS
    └── SRPMS
    
    5 directories, 0 files
    
  3. Edit the file $HOME/.rpmmacros and add the following lines at the top:

    %_packager YOUR NAME
    %_vendor MHPC
    

1.2. Build an RPM of Torque

The Torque Administration Guide explains how to install torque using make install. However, we are chosing to generate RPMs instead, which has the benefit of generating binary RPM packages that can be easily redeployed.

1.2.1. Download the necessary prerequisites

Before we can build the software package install the necessary libraries and library headers.

[root@master ~]# yum install libxml2-devel boost-devel pam-devel libcgroup-utils hwloc-devel

1.2.2. Generate a source tarball

  1. Clone the Torque Git Repository from GitHub and checkout version 6.1.3

    [root@master ~]# git clone https://github.com/adaptivecomputing/torque.git
    [root@master ~]# cd torque
    [root@master ~]# git checkout 6.1.3
    
  2. Configure & Generate a Makefile

    [root@master ~]# ./autogen.sh
    [root@master ~]# ./configure
    
  3. Generate a tarball

    [root@master ~]# make dist
    

    This will generate a torque-6.1.3.tar.gz tarball, which contains everything needed to build a RPM package.

1.2.3. Build your Torque RPMs

RPM builds need two things:

  1. The source code

  2. A .spec file that defines what to do

rpmbuild supports taking a source tarball and find the spec file inside of it. If you look at the source code you downloaded you will see a torque.spec file that was generated. This file is also inside of the tarball.

To build an RPM with such a tarball you can use the rpmbuild command as follows:

rpmbuild [OPTIONS] -tb torque-6.1.3.tar.gz

Options you pass to rpmbuild are used inside of the torque.spec file to parameterize ./configure, which is called before make.

We want to enable some extra features and disable others. Below is an explaination of the options we will be using:

--with syslog

by default, only MOM processes will report to syslog. With this option all of Torque will use it.

--without spool

by default output is written to $TORQUE_HOME/spool and then copied to user’s home directory when done. This can lead to overflows. By disabling usage of this global spool, output files are first written into each user’s $HOME/.pbs_spool directory before being copied to their final destination.

--with pam

create PAM module to limit access to nodes that have a job running.

--with cgroups

enables cgroups support which allows torque to control CPU core mappings and memory usage of jobs.

Build your Torque RPM:

[root@master ~]# rpmbuild --with pam --without spool --with cgroups --with syslog -tb torque-6.1.3.tar.gz

All RPMs generated are written into $HOME/rpmbuild/RPMS/x86_64/

[root@master ~]# tree $HOME/rpmbuild/RPMS/x86_64
/root/rpmbuild/RPMS/x86_64
├── torque-6.1.3-1.adaptive.el7.x86_64.rpm
├── torque-client-6.1.3-1.adaptive.el7.x86_64.rpm
├── torque-debuginfo-6.1.3-1.adaptive.el7.x86_64.rpm
├── torque-devel-6.1.3-1.adaptive.el7.x86_64.rpm
├── torque-scheduler-6.1.3-1.adaptive.el7.x86_64.rpm
└── torque-server-6.1.3-1.adaptive.el7.x86_64.rpm

0 directories, 6 files

1.3. Create a new RPM repository

Create a folder /provisioning/repos/batch_system and copy over all RPMs:

[root@master ~]# mkdir -p /provisioning/repos/batch_system
[root@master ~]# cp $HOME/rpmbuild/RPMS/x86_64/*.rpm /provisioning/repos/batch_system/

Create a new RPM repository out of this new folder.

[root@master ~]# createrepo /provisioning/repos/batch_system/

Add a new cobbler repository for this RPM repository.

[root@master ~]# cobbler repo add --mirror=/provisioning/repos/batch_system --name=batch_system

# verify new repo exists
[root@master ~]# cobbler repo list
   batch_system

# inspect repo configuration
[root@master ~]# cobbler repo report --name=batch_system
Name                           : batch_system
Apt Components (apt only)      :
Apt Dist Names (apt only)      :
Arch                           :
Breed                          : rsync
Comment                        :
Createrepo Flags               : <<inherit>>
Environment Variables          : {}
Keep Updated                   : True
Mirror                         : /provisioning/repos/batch_system
Mirror locally                 : True
Owners                         : ['admin']
Priority                       : 99
External proxy URL             :
RPM List                       : []
Yum Options                    : {}

# call reposync to publish to HTTP server
[root@master ~]# cobbler reposync

To make this repository visible in your yum installation, add a new file /etc/yum.repos.d/batch_system.repo with the following contents:

[batch_system]
name=batch_system
baseurl=http://master.hpc/cobbler/repo_mirror/batch_system
enabled=1
priority=99
gpgcheck=0
proxy=_none_

To add this repository automatically during installation of a compute node, edit the cobbler profile and add batch_system to repos.

[root@master ~]# cobbler profile edit --name=centos7-compute --repos="batch_system"

This will only become available if you reprovision your compute nodes. For now, just copy the batch_system.repo file to all compute nodes to make the repository available there too.

 

https://www.hpc.temple.edu/mhpc/2021/hpc-technology/exercise8/rpm.html 

 

 

 

Post a Comment

Previous Post Next Post