TACTIC Install - CentOS 5.7

TACTIC Install - CentOS 5.7

CentOS 5.5 has now been deprecated in favour of CentOS 5.7 or CentOS 6.0. Since CentOS 5.5 will no longer receive updates and we urge you to consider using a more up to date version of the operating system such as CentOS 5.7.

For CentOS 6.2 and above, please refer to the TACTIC Install - CentOS 6.2 page. Step-by-step instructions for Tactic 3.6.0.v01 are provided below.

Requirements

Tactic requires the following software to be installed:

  • Apache HTTP server 2.2

  • Postgres Database Server 8.4 or higher

  • Python 2.7 and the following Python modules:

    • Python Imaging Library 1.1.7

    • Python lxml 2.2.8

    • Pycrypto 2.3

    • Psycopg2 2.3.2

It should be noted that while there may be newer versions of these Python modules, Tactic 3.6.0.v01 is built with these particular versions and may not work as intended should you use later versions.

Disabling Security for Testing

For the sake of getting Tactic up quickly without a large amount of fuss, it is prudent to disable firewalling and SELinux. This is by no means an endorsement to run your server without these services. Once you have Tactic up and running we encourage you to read the section <TACTIC SECURITY>.

CentOS 5.7 uses the iptables service as a firewall. To disable this temporarily you can issue the following commands as root.

/etc/init.d/iptables save
/etc/init.d/iptables stop

This will disable the firewall for the currently running CentOS session. Should you wish these settings to persist across reboots. You can issue the following command as root.

/sbin/chkconfig iptables off

To disable SELinux, edit the file /etc/selinux/config as root with your favourite editor and set the SELINUX variable to 'disabled'.

SELINUX=disabled

Getting this setting to take effect requires a reboot.

Installing Apache HTTP server

To install Apache 2.2 on CentOS 5.7 issue the following command as root:

yum install httpd

This package has several dependencies and they should be installed as well.

It would be good to familarize yourself with some of the more pertinent paths in the Apache installation on CentOS5.7. We've listed them below for your convenience.

Apache 2.2 paths

/etc/httpd/conf/httpd.conf Path to the main Apache configuration file.
/etc/httpd/conf.d/ Path to the Apache dynamic configuration directory.
/var/log/httpd/error.log Path the the Apache error log.
/var/www/html Path to the Document Root folder of the base Apache install.

It's best to test your Apache install at this point. The included main Apache configuration file is enough to get the server started. You will need create a small html file to do this. Using your favourite editor create a file called index.html, including the following contents:

<html>
  <head>
    <title>Apache Base Install</title>
  </head>
<body>
   <p>Apache Install Successful</p> 
</body>
</html>

Save the file in /var/www/html and issue the following command as root to ensure proper permissions are set.

chmod 755 /var/www/html/index.html

Now we can start the Apache server itself. As root issue the following command.

/etc/init.d/httpd start

The service should start successfully. If it does not consult the Apache error log listed above to discover any problems that may have occured.

At last we should now be able to point a web browser to the IP address associated with the server. If you see the text "Apache Install Successful", then your server is up and running and server pages properly.

Finally we will want the Apache service to persist through reboots. As root issue the following command:

/sbin/chkconfig httpd on

Then reboot the server and make sure that httpd comes up on reboot and that you can view the test page properly. Later in the install we will configure the Apache server to interact with Tactic properly.

Installing Postgres Database Server

CentOS 5.7 repositories use Postgres version 8.1.23-1. However Tactic requires version 8.4 or higher. First we must make sure that we didn't include the default version Postgres in our base install. As root please issue the following command:

rpm -qva | grep -i postgres

This command will search your installed packages and filter the output for any packages containing the work postgres. If you receive any output from this command please uninstall the packages by issuing the following command:

rpm -e <package_name>

Where <package_name> is the name of the package you wish to uninstall. Consult the RPM or Yum manpages for further instructions on installing and uninstalling packages.

Lastly before installing any new Postgres repository, we want to make sure to exclude the default version of Postgres from showing up in the base and update Yum repositories included with the operating system itself. Using your favourite editor, edit the file /etc/yum.repos.d/CentOS-Base.repo to include the line:

exclude=postgresql*

Under both the [base] section and the [updates] section of the file. Save the file. For more information on the Yum installer and repository system please see the manpages for yum or the yum website http://yum.baseurl.com

Once we have uninstalled any previous versions of Postgres, we can then proceed installing a new Yum repository that contains the version of Postgres we want to install. As root issue the following commands:

cd /tmp
wget http://yum.pgrpms.org/9.1/redhat/rhel-5-i386/pgdg-centos-91-9.1-4.noarch.rpm
rpm -Uvh pgdg-centos-91-9.1-4.noarch.rpm

At the time of writing the current version of Postgres was 9.1-4, for more current installation versions please visit http://yum.pgrpms.org/repopackages.php and view the available repository RPMs for your operating system and architecture.

Lastly we will install the proper Postgres version 9.1 RPMs. As root issue the following command:

yum install postgresql91 postgresql91-server postgresql91-devel

Now that Postgres is installed we will do some basic configuration and testing to make sure our installation is ready for use with Tactic.

Again we should first familiarize ourselves with the pertinent Postgres file paths that will be used throughout the install:

Common Paths in Postgres 9.1 on CentOS 5.7

/var/lib/pgsql/9.1 Path to the main Postgres directory.
/var/lib/pgsql/data/pg_hba.conf Path to the host based authentication file for Postgres.
/var/lib/pgsql/9.1/pgstartup.log Path to the Postgres startup log.
/var/lib/pgsql/9.1/data/pg_log Path to Postgres database logs.

If you have used the base postgresql-server install before you will notice that the above paths are slightly different than the usual paths used on CentOS. This install also varies from the base install in that the user must manually initialize the databases used by Postgres. To do this issue the following command as root:

/etc/init.d/postgresql-91 initdb

Once that command successfully completes we can then start the service. As root issue the following command:

/etc/init.d/postgresql-91 start

If the service starts successfully we can move forward. If not please view any startup errors in the Postgres startup log. Further troubleshooting help can be found at http://postgresql.org,

Lastly we will want to make sure the Postgres service persists through reboots. As root issue the following command:

/sbin/chkconfig postgresql-91 on

Reboot your server to ensure the service comes up appropriately.

Installing Python 2.7

As noted above Tactic requires version 2.7 of Python. CentOS comes with, and depends on an earlier version of Python. This means we simply can't remove Python from the system as we did with Postgres. We have to create a custom Python 2.7 install and keep it seperate from the base install.

First we need to install some development libraries and a compiler. As root issue the following command:

yum install gcc zlib-devel libxslt-devel libxml2-devel

Once those are installed we can get Python 2.7, as root issue the following command:

cd /tmp
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar -zxvf Python-2.7.1.tgz
cd Python-2.7.1
./configure --prefix=/opt/python2.7
make && make install

This will install Python 2.7 in the custom path /opt/python2.7. You can choose a different custom install directory should you choose.

Installing Python 2.7 Modules

Next we will install the necessary Python 2.7 modules. These provide extended functionality to the Python environment. Before we begin however we will have to set an environment variable such that the Python 2.7 modules we are installing can find their link dependencies. In the BASH shell environment as root issue the following command:

export LD_LIBRARY_PATH=/opt/python2.7/lib

This will prefix your link dependency library path with our custom python libaries ensuring they get precedence in the installation of the modules. This environment variable only exists for the current shell environment. Any new shells you open will need to have this variable set as well. We will institute a permanent solution to this problem later.

Installing lxml 2.2.8

Tactic requires lxml version 2.2.8. At the time of writing Tactic encountered errors running with lxml 2.3 installed. Please make sure you install lxml 2.2x. Installation and setup for each module is almost the same. As root issue the following commands

cd /tmp
wget http://codespeak.net/lxml/lxml-2.2.8.tgz
tar -zxvf lxml-2.2.8.tgz
cd lxml-2.2.8
/opt/python/bin/python2.7 setup.py install

We have used the location of our custom installed python binary in the last line, if you have chosen a different install location use it instead.

Verify the installation by running your custom python binary and trying to import the module. As root issue the following command:

/opt/python2.7/bin/python2.7

You should receive a python environment and prompt similar to this:

Python 2.7.1 (r271:86832, Apr 12 2011, 16:16:18)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

At the prompt please type the following:

import lxml

If you receive another prompt and no error occurs, the import was successful and lxml is installed. We will use the same procedure to check the veracity of our other modules installations as well.

Installing Python Imaging Library 1.1.7

We follow the same procedure to install the Python Imaging Library. As root issue the following commands:

cd /tmp
wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
tar -zxvf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7
/opt/python2.7/bin/python2.7 setup.py install

Check the installation of the module by loading python and issuing the following command at the python prompt.

import PIL
Installing Pycrypto 2.3

The installation of Pycrypto also follows this template. As root issue the following commands:

cd /tmp
wget http://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.3.tar.gz
tar -zxvf pycrypto-2.3.tar.gz
cd pycrypto-2.3
/opt/python2.7/bin/python2.7 setup.py install

Check the installation of the module by loading python and issuing the following command at the python prompt.

import Crypto
Installing Psycopg2 2.3.2

Psycopg2 is a Postgres database adapter for Python. The install is akin to the previous 3 except that since we've customized our Postgres install, we have to let Psycopg2 know that as well. First lets get the package and uncompress it. As root issue the following:

cd /tmp
wget http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.3.2.tar.gz
tar -zxvf psycopg2-2.3.2.tar.gz
cd psycopg2-2.3.2

Now we have to modify the pg_config variable in the file setup.cfg. Using your favourite editor open /tmp/psycopg2-2.3.2/setup.cfg and edit the pg_config entry to match the following:

pg_config=/usr/pgsql-9.1/bin/pg_config

Now we should be able to install Psycopg2 properly. As root issue the following command:

/opt/python2.7/bin/python2.7 setup.py install

Check the installation of the module by loading python and issuing the following command at the python prompt.

import psycopg2

Now that all the Tactic components are installed, we can begin installing Tactic itself.

Installing Tactic 3.6.0.v01

First we have to download the Tactic source from the Southpaw Community website. Using a web browser navigate to http://community.southpawtech.com and login using the support account you were assigned. After you have logged in, please click on "Downloads" in the upper right hand corner of the website. Once you are on the downloads page, you should see the download link for TACTIC Enterprise. Save the TACTIC Enterprise zip file in /tmp on the server.

Once we have the Tactic source we need to unpack it. As root issue the following commands:

cd /tmp
unzip tactic-3.6.0.v01.zip

Once the Tactic source is unpacked, you should familarize yourself with the Tactic directory structure. The prefix of the paths will change during install, however the directory structure will remain the same.

Common Paths in Tactic 3.6.0.v01

/tmp/tactic-3.6.0.v01/doc Path to the Tactic documentation.
/tmp/tactic-3.6.0.v01/src Path to the Tactic source files.
/tmp/tactic-3.6.0.v01/src/install Path to the Tactic install script and configuration files for Tactic dependencies.

Before we run the Tactic installer, we must further configure Postgres to ensure proper installation of Tactic.

Configuring Postgres

Tactic supplies a custom host based authentication file for Postgres. After stopping the Postgres service we will install the file in question, restart the service and verify that the configuration has been properly put in place. As root issue the following commands:

/etc/init.d/postgresql-9.1 stop
mv /var/lib/pgsql/9.1/data/pg_hba.conf /var/lib/pgsql/9.1/data/pg_hba.conf.INSTALL
cp /tmp/tactic-3.6.0.v01/src/install/postgresql/pg_hba.conf /var/lib/pgsql/9.1/data/pg_hba.conf
chown postgres:postgres /var/lib/pgsql/9.1/data/pg_hba.conf
/etc/init.d/postgresql-9.1 start

If the service starts successfully we can then move onto testing. If not please consult the Postgres startup log for error information. Postgres must be running as a service during the Tactic install. Next we will test the install, as root issue the following commands:

psql -U postgres template1

This command should return you to a prompt like this one:

template1=#

If you are not prompted for a password and, see this prompt, then the configuration changes have been successful. Type \q to exit.

Installing Tactic

We are now ready to run the Tactic installer. The installer doesn't know about our custom Python installation location though, so we have edit the install.py file. Using your favorite editor, edit the file /tmp/tactic-3.6.0.v01/src/install/install.py.

Find the following line in the file:

python_site_packages_dir = "/usr/local/lib/python%s.%s/site-packages"

Replace it with the following line:

python_site_packages_dir = "/opt/python2.7/lib/python%s.%s/site-packages"

Save the file. We will test this by running the installer. Make sure you are using a shell with the LD_LIBRARY_PATH set as mentioned in the "Installing Python 2.7 Modules" section. As root issue the following command:

/opt/python2.7/bin/python2.7 /tmp/tactic-3.6.0.v01/src/install/install.py

The installer will ask you a number of questions. You should be prompted by the following:

Please enter the base path of the TACTIC installation:

(/home/apache) -> /opt/tactic

Choose your custom Tactic path, this will be the base directory for your Tactic installation. We have chosen /opt/tactic. Next you will be asked to identify the user used to run the Apache service.

Please enter the user Apache Web Server is run under:

(apache) ->

In many cases the default user "apache" is correct. However you can verify this easily in another shell by issuing the following command as root:

ps -ef | grep httpd

The first column of output is the username Apache is running under. Should you receive no output, make sure your httpd service is running. Under CentOS 5.7 the apache user is "apache" so we will accept the default the installer gives us.

The installer will then install the Tactic databases, configure Tactic and copy the source code into the Tactic base directory.

Configuring Apache

Lastly Tactic requires us to install the custom Apache configuration file it has created during the installation process. As root issue the following commands:

cp /opt/tactic/tactic_data/config/tactic.conf /etc/httpd/conf.d

To test this we should first verify that /etc/httpd/conf.d is an included module path in the main Apache configuration file. As root issue the following command:

cat /etc/httpd/conf/httpd.conf | grep conf.d

If you receive the following as output we have installed the Tactic Apache configuration file correctly.

Include conf.d/*.conf

If you do not receive this output, using your favourite editor as root edit the file /etc/httpd/conf/httpd.conf and at the bottom of the file insert the statement listed above. Save the file.

Lastly we will create a redirect for Tactic using the index.html file at the document root of the Apache server. Using your favourite editor as root, edit the file /var/www/html/index.html to contain only the following line:

<META http-equiv="refresh" content="0;URL=/tactic">

Restart the Apache service to make sure the configuration hasn't caused any problems. As root issue the following command:

/etc/init.d/httpd restart

Lastly we need to ensure that the Apache server has loaded the modules needed for proxying and load balancing the Tactic service. As root issue the following command:

/usr/sbin/httpd -t -D DUMP_MODULES

In the resulting output look for the following modules:

rewrite_module (shared)
proxy_module (shared)
proxy_http_module (shared)
proxy_balancer_module (shared)
deflate_module (shared)

The CentOS 5.7 install of Apache includes a large array of modules enabled by default, including the ones required by Tactic.

Starting Tactic in Development Mode

We are now prepared to start the Tactic service for the first time. Tactic must be run as the Apache user. Usually we would su to the apache user, however since its a system account without a login this will not work without optionally telling su to give the Apache user a shell environment. In a shell with the LD_LIBRARY_PATH set as laid out in the section "Installing Python 2.7 Modules", as root issue the following command:

su apache -s /bin/bash -c "/opt/python2.7/bin/python2.7 /opt/tactic/tactic/src/bin/startup_dev.py"

You should see the following output:

Registering site ... admin
Registering site ... sthpw
Registering site ... default

Starting TACTIC ...

Starting Scheduler ....
[08/Nov/2011:23;13:20] ENGINE Bus STARTING
[08/Nov/2011:23;13:20] ENGINE Started monitor thread '_TimeoutMonitor'.
[08/Nov/2011:23;13:20] ENGINE Started monitor thread 'Autoreloader'
[08/Nov/2011:23;13:21] ENGINE Serving on 127.0.0.1:8081
[08/Nov/2011:23;13:21] ENGINE Bus STARTED

You should now be able to navigate a web browser to http://localhost/tactic/admin. Alternatively use the non-local IP address or fully qualified domain name you have assigned to your Tactic server in place of localhost. You should see the Tactic login screen.

Tactic defines an administrative user by default. The login information is:Use

Username: admin, Password: (set it on your first login)

In 3.9, the login screen requires you to change the password immediately. You will have to type it in twice to confirm.

Installing Tactic as a Service

You can use the key combination CTRL+c in the shell running the Tactic Development mode service to stop it when you are ready

The Tactic service file is simple to install, however due to the custom Python pathing we have used we have edit the Tactic service file to reflect those changes. As root, using your favourite editor open the file /opt/tactic/tactic/src/install/service/tactic and make the following changes.

The Python environment variable PYTHON should be set to the path of our custom Python binary.

PYTHON=/opt/python2.7/bin/python2.7

Additionally we want to setup the LD_LIBRARY_PATH variable to include our custom Python libraries. Under the following line:

export PYTHON

Add the following lines to the file:

LD_LIBRARY_PATH=/opt/python2.7/lib
export LD_LIBRARY_PATH

Lastly, Tactic startup uses the same mechanism as Developer mode, however this is not yet reflected in the Tactic service file. Change the following line:

su - $TACTIC_USER -m -c "$LAUNCH" >> $LOG 2>&1 &

To this:

su $TACTIC_USER -s /bin/bash -m -c "$LAUNCH" >> $LOG 2>&1 &

Save the file.

One last Python path must be corrected before we install the Tactic service. During installation Tactic created a file that you will become more familiar with throughout your use of Tactic. That file is /opt/tactic/tactic_data/config/tactic_linux-conf.xml. Using your favourite editor as root edit this file. Find the following line:

<python>python</python>

And replace it with:

<python>/opt/python2.7/bin/python2.7</python>

Save the file.

Now we will install the Tactic service. As root type the following:

cp /opt/tactic/tactic/src/install/service/tactic /etc/init.d/tactic
chmod 755 /etc/init.d/tactic
/sbin/chkconfig tactic on
/etc/init.d/tactic start

Tactic should now start properly as a service. Test this by launching a web browser and navigating to the Tactic login page as you did previously. If you are having trouble the following error logs will help you diagnose your problems:

Common Error Logs

/opt/tactic/tactic_temp/log/stdout.log Path to the TACTIC standard out log assuming you have chosen /opt/tactic as the base installation path
/var/log/tactic Path to the Tactic error log.
/var/log/httpd/error_log Path to the Apache error log.
/var/log/httpd/access_log Path to the Apache access log.

Finally, reboot the server and test whether the TACTIC service continues to perform across reboots. You are advised to set up log rotation by reviewing the Rotate Log section in the Sys Admiin documentation.