Install mod_python on Centos 6

mod_python is one of the easiest ways to use your Python Scripts as web pages. To install mod_python on your Centos 6 server, simply follow the steps below. We also recommend using our LAMP installer, this method can easily be implemented with our installer.

To install mod_python, we need the EPEL repositories:
rpm --import https://fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -ivh epel-release-6-7.noarch.rpm
yum install yum-priorities
Now edit the /etc/yum.repos.d/eped.repo file and add priority=10 to the [epel]section. After that follow the steps below and you’ll have mod_python installed and active.
yum install mod_python
service httpd restart
Now you should configure your httpd.conf files so that apache nows where and when to interpret your Python scripts. If you have installed you system with our LAMP installer, then go to /etc/httpd/conf.d and edit you websites .conffile (starting with a z_)
vi /etc/httpd/conf.d/z_castmator.com
Make sure you add the following lines in the <Directory …> </Directory> statements.

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On


Don’t forget that PythonDebug is for debug mode. When you’re done developing it may be a good idea to turn it off.

Also don’t forget to add your DirectoryIndex handlers so that Apache knows you can also have Python Index files. You can add this right after the </Directory> statement.


DirectoryIndex index.html index.php index.py
Since we’ve altered with the configuration files of Apache, we should restart it again, then you are ready to go.
service httpd restart
  • 96 Users Found This Useful
Was this answer helpful?

Related Articles

Setting time with NTP in LINUX

NTP (Network Time Protocol) could be used to set time synced with ntp clocks, to do this use the...

Linux version & Operating System info

LINUX Version Info To learn the architecture and kernel version info use the shell command...

Compile and build Apache + MySQL + PHP from the source [cite]

This is a complete working solution to build Apache (httpd-2.2.25), MySQL (MySQL-5.6.14) and PHP...

Using vi Editor

Vi is the one of the mostly used editor in Linux via terminal. In most cases where Linux is used...

Build PHP5.5 on CentOS 6.4 with MSSQL Support [cite]

Most of the yum repos doesn’t include PHP5.5.X on current releases for the time being. So...