Build Moonshot from source on RedHat

The Moonshot source code is composed of several modules, all of them available from our GIT repositories, and they all can be built by hand relatively easier, assuming you have all of the prerequisite packages installed. This page has instructions for getting those packages and building the software itself for CentOS 7. For other CentOS and RedHat versions, the process is very similar and only a few package names may differ.

Contents

1. System Preparation

To build all of the Moonshot components, you need various packages installed. To install all of these, see below:

Debian 8
yum install -y epel-release wget
wget -O /etc/yum.repos.d/shibboleth.repo "https://shibboleth.net/cgi-bin/sp_repo.cgi?platform=CentOS_7"
yum -y install automake make autoconf libtool gettext-devel gtk3-devel libgee-devel newt-devel vala\
    desktop-file-utils openssl-devel dbus-glib-devel glib-devel rpm-build\
    libconfuse-devel libevent-devel shibboleth-devel jansson-devel libshibresolver-devel gcc-c++ sqlite-devel\
    libtalloc-devel pam-devel net-snmp-devel net-snmp-utils readline-devel libpcap-devel openldap-devel perl-devel\
    perl-generators "perl(ExtUtils::Embed)" python-devel mysql-devel postgresql-devel libcurl-devel json-c-devel\
    unixODBC-devel libxml2-devel libsecret-devel gcr-devel selinux-policy-devel selinux-policy-doc

2. Build and install Moonshot from source

In order to build Moonshot you should build and install its components in the given order (as they depend on each other).

2.1. libradsec

git clone https://github.com/janetuk/libradsec.git
cd libradsec
sh autogen.sh
./configure
make
make install

2.2. moonshot-ui

git clone https://github.com/janetuk/moonshot-ui.git
cd moonshot-ui
sh autogen.sh
./configure
make
make install

2.3. mech_eap

git clone https://github.com/janetuk/mech_eap.git
cd mech_eap
sh autogen.sh
./configure
make
make install
# Make install does not install everything in the right place, so a couple of adjustments are required
ln -s /usr/local/lib/gss/ /usr/lib64/
cp ./mech_eap/mech /etc/gss/mech.d/moonshot.conf

2.4. trust_router

git clone https://github.com/janetuk/trust_router.git
cd trust_router
autoreconf -fi
./configure
make
make install

2.5. freeradius

git clone https://github.com/janetuk/freeradius.git
cd freeradius
./configure
make
make install

3. Building Moonshot binary packages from source

Instead of building and installing from source, you can build RPM binary packages from source. This method is preferred over the previous one unless you want to actively develop some of the Moonshot modules, since it will install all the files in the right location (eg. libraries, systemd units...) as well performing the pre and post install operations.

The installation order is the same as described in the previous section. 

3.1. libradsec, moonshot-ui, mech_eap, and trust_router

The process is identical for all the modules. In the instructions, we use the variable $MODULE_NAME to refer to a module's name.

git clone https://github.com/janetuk/$MODULE_NAME.git
cd $MODULE_NAME
autoreconf -fi
./configure
make dist
mkdir -p SOURCES
# tarball might be .tar.gz, tar.xz, tar.bz2, etc. Use the appropriate one
mv $MODULE_NAME*z SOURCES
rpmbuild -ba $MODULE_NAME.spec --define "_topdir `pwd`"
#  Note: packages are generated in ./RPMS/x86_64/
yum install RPMS/x86_64/*.rpm

3.2. freeradius

git clone https://github.com/janetuk/freeradius.git
cd freeradius
./configure
make dist
mkdir -p SOURCES
mv freeradius*.tar.bz2 SOURCES
cp centos/* SOURCES
rpmbuild -ba centos/freeradius.spec --define "_topdir `pwd`"
yum install RPMS/x86_64/*.rpm