Lampros - Weird Bricks

Building redir from source

30 May, 2017 | CentOS

Greetings interwebs,

Folks who have worked with me before (or who have been reading my blog - yeah I know, I know) know that redir is one of my most favorite tools.

Unfortunately CentOS 7 (including EPEL) does not come with redir. What's a sysadmin to do when one of his beloved tools is missing?

Compile it himself of course!!!!!!!!!!!!!! (and create an RPM out of it so he doesn't have to do it again!)

1. Get the necessary build tools:

yum -y install
yum -y install ruby rpm-build libffi-devel make gcc autoconf automake
gem install fpm --no-ri --no-rdoc

2. Create a target directory called /builddir:

mkdir /builddir

3. Download the latest release from Github:

cd /tmp
curl -LO

4. Untar the sources, compile, etc:

tar -xzf v3.1.tar.gz
cd redir-3.1/
./configure --prefix=/builddir
make -j `nproc`
make install

Note: the --prefix=/builddir --- this is telling the configure script to set the target for make install to /builddir. We do this so it's easier to package everything up later.

5. Build the RPM:

cd /builddir
fpm --verbose -v 3.1 -n redir -s dir -t rpm .=/usr/

6. Inspect the RPM before you install it using the rpm -qlp command:

rpm -qlp redir-3.1-1.x86_64.rpm 

7. Install the RPM:

yum install redir-3.1-1.x86_64.rpm

8. Test that it works:

which redir
redir -v