0

I have a dedicated server running centOS. I want to install python 2.6 and postgreSQL on it so python users can host their web apps on my server. (Apache) Can anyone give me a detailed tutorial for that ?

And is Django or something similar necessary to run python with Apache ??

1 Answers1

2

(I don't use either python or PostgreSQL, but perhaps this will point you in the right direction)

On CentOS, install mod_python with yum install mod_python (if you want it embedded in Apache). You will need to configure Apache, see HowtoForge: embedding python

install python with yum install python26 (if you want to go the CGI route, or run standalone scripts)

install PostgreSQL with yum install postgresql-server (will automatically install the client)

I believe Django is a framework - in which case it is not required. The users who want to use it will provide it as part of their code.

Hope this helps.

Edit: As per the comment below, it does appear that mod_wsgi is preferred over mod_python.

It can be installed via yum install mod_wsgi

If you need to compile mod_wsgi, there are instructions here. You can also find RPMs compiled against python 3.1.

If python is already on your system, run python --version to determine the version. If it is an older version, and you compile from source, this article provides a procedure at the start (for not overwriting the existing python).

If you don't have an up-to-date python in your yum repository, you can try EPEL, which has python26-2.6.5-6

cyberx86
  • 20,805
  • 1
  • 62
  • 81
  • 1
    `WSGI` is way more modern and less buggy than `mod_python` –  Jul 06 '11 at 19:34
  • Thanks for the pointer - as I don't use python, I have never heard of it. I added it to the answer for future reference. (Being a bit new to this site, I haven't yet decided if providing a not fully correct solution, which may be of use is worse than providing no solution at all - I went with the former, since there were no other answers). – cyberx86 Jul 07 '11 at 01:13
  • 1
    incorrect or bad advice will get down voted –  Jul 07 '11 at 01:58
  • I expect as much, but find that offline an incomplete answer may point someone in the right direction and therefore may be better than no answer (provided it isn't stated as the absolute truth). (If there is a question outside my expertise, I'm not going to answer unless no one else has bothered.) If the answer is completely incorrect, I expect the downvote, good intentions or not. Besides, mistakes can teach quite a lot. (I'm not really here for the reputation, more to help people, learn a bit, and see what I know (servers are a hobby); the reputation is just a nice way of keeping score.) – cyberx86 Jul 07 '11 at 03:02
  • mod_python is in danger of becoming EOL, you may want o look at wsgi instead. – David Jul 07 '11 at 03:53
  • Be careful when replacing or mixing python versions. There are changes that may break some apps, including RedHat's/CentOS's system utilities. – David Jul 07 '11 at 03:58
  • @David. As far as the Apache Software Foundation is concerned, mod_python is EOL. It was voted as a dead project last year and has been moved into the Apache Attic. There is no development going on and has been zero traffic on mod_python user/developer mailing lists for a very long time. – Graham Dumpleton Jul 07 '11 at 14:24
  • installing python from source is **EXTREMELY** dangerous on CentOS you can completely **BREAK** the machine where it won't work at all. There are lots of tools, scripts and what not that **rely heavily on the default 2.4.3**, and if it gets interfered with **lots of stuff stops working and can't be fixed without re-installing the OS**. Best to **use the RPM for 2.6.x** and be happy with that. –  Jul 07 '11 at 15:30