Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

To install python and plone on Centos 5.1 VPS

Posted on 2008-06-24
15
Medium Priority
?
2,258 Views
Last Modified: 2010-04-21
I want to install python 2.5.2 to run turbogears and bind to mysql and at the same time install plone in /opt using unified plone installer. The plone uses python 2.4.4 and is it possible to bind python 2.4.4 to mysql too.

To install python 2.5.2, what other dependencies do I need to download to install and bind to mysql
0
Comment
Question by:rroslan
  • 9
  • 6
15 Comments
 
LVL 14

Expert Comment

by:agriesser
ID: 21859236
Python 2.4.4 should work with MySQL databases. Have you tried it already?

Using the unified installer should work around these problems too, as it installs python in a separate directory (if not already available) and is not bound to a specific version of python.

I'd say: Just give it a try and see how it fairs. In case of any troubles that may arise, post them here and we'll get that sorted.
0
 

Author Comment

by:rroslan
ID: 21860784
First step is I installed python 2.5.2
typing python on terminal still shows python 2.4.3  - which is the default installed python
How do I make python to run on python 2.5.2?
0
 

Author Comment

by:rroslan
ID: 21860834
ok, I've got python 2.5.2 needs a reboot.

I will install turbogears using tgsetup
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:rroslan
ID: 21861377
turbogears installed
mysql-python binding installed - using easy_install
plone is up

cannot access webmin - maybe its the firewall? I did an update on system

cannot access plone too
0
 

Author Comment

by:rroslan
ID: 21861582
The last part to bind mysql to python from plone :

I cd /opt/Plone3.1/Python-2.4/bin
and ./easy_install-2.4 MySQL-python. It went ok

What is the best way to confirm that python 2.5.2 and python 2.4.5 binds to MySQL

I'll address the plone and webmin in another question. Perhaps its the firewall cause I did a yum update since this is a fresh install of centos
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21863375
Well you could write a little python test script like the one below.
Save it as "test.py" and start it using `python test.py`:

tuxx@vi-edv003:~$ python test.py
server version: 5.0.51a-6
tuxx@vi-edv003:~$

It should display the MySQL server version and therefore you know, that it's working with MySQL.

Please note that you need to change the values for user, passwd and db in the example shown below to match your database.
import MySQLdb
 
conn = MySQLdb.connect(host = "localhost",
                           user = "testuser",
                           passwd = "testpass",
                           db = "testdb")
cursor = conn.cursor ()
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
print "server version:", row[0]
cursor.close ()
conn.close ()

Open in new window

0
 

Author Comment

by:rroslan
ID: 21864115
The system python is now 2.5.2
Plone is running on python 2.4.5 -  Zope Version    (Zope 2.10.6-final, python 2.4.5, linux2)

But
[root@dev bin]# python2.4
Python 2.4.3 (#1, May 24 2008, 13:47:28)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

[root@dev bin]# python
Python 2.5.2 (r252:60911, Jun 25 2008, 05:35:40)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

[root@dev home]# python test.py
server version: 5.0.45
[root@dev home]#

[root@dev home]# python2.4 test.py
Traceback (most recent call last):
  File "test.py", line 1, in ?
    import MySQLdb
ImportError: No module named MySQLdb

The thing is how do I bind python 2.4.5 in /opt/Plone3.1/Python2.4/ to mysql
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21864245
Well, then you need to install the MySQL binding for python 2.4.5.

On my system, all python versions are bound to MySQL correctly as you can see here:

tuxx@vi-edv003:~$ python2.5 test.py
server version: 5.0.51a-6
tuxx@vi-edv003:~$ python2.4 test.py
server version: 5.0.51a-6
tuxx@vi-edv003:~$ python2.5
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
tuxx@vi-edv003:~$ python2.4
Python 2.4.5 (#2, Apr 17 2008, 13:00:52)
[GCC 4.2.3 (Debian 4.2.3-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
tuxx@vi-edv003:~$

I checked the CentOS download mirrors and found a package called MySQL-python-1.2.1.rpm which contains the mysql extension for the installed python2.4 package. You can download it from here:

http://mirror.centos.org/centos/5/os/i386/CentOS/MySQL-python-1.2.1-1.i386.rpm

Install it using `rpm -Uhv MySQL-python-1.2.1-1.i386.rpm` and check that there are now files in the following directories:

./usr/lib/python2.4/
./usr/lib/python2.4/site-packages/
./usr/lib/python2.4/site-packages/_mysql_exceptions.pyo
./usr/lib/python2.4/site-packages/_mysql.so
./usr/lib/python2.4/site-packages/_mysql_exceptions.pyc
./usr/lib/python2.4/site-packages/_mysql_exceptions.py
./usr/lib/python2.4/site-packages/MySQLdb/
./usr/lib/python2.4/site-packages/MySQLdb/connections.pyo
./usr/lib/python2.4/site-packages/MySQLdb/converters.pyc
./usr/lib/python2.4/site-packages/MySQLdb/__init__.py
[...]
0
 

Author Comment

by:rroslan
ID: 21868227
[root@dev ~]# rpm -Uhv MySQL-python-1.2.1-1.i386.rpm
error: Failed dependencies:
      mx is needed by MySQL-python-1.2.1-1.i386
[root@dev ~]#

How can I install mx
0
 
LVL 14

Accepted Solution

by:
agriesser earned 2000 total points
ID: 21868297
Get it here:

http://mirror.centos.org/centos/5/os/i386/CentOS/mx-2.0.6-2.2.2.i386.rpm

Install it the same way (rpm -Uhv mx-2.0.6-2.2.2.i386.rpm).

0
 

Author Comment

by:rroslan
ID: 21868472
[root@dev home]# python2.4 test.py
server version: 5.0.45
[root@dev home]# python2.5 test.py
server version: 5.0.45
[root@dev home]#

Looks ok
One question:
Is Python 2.4.5 from Plone using Python 2.4.3 to bind to MySQL?
0
 

Author Closing Comment

by:rroslan
ID: 31470276
Thank You
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21868550
Great.

Good question. I don't think that it makes a big difference, because inside the 2.4 branch of python, the plugins should be compatible and therefore both versions should be fixed by installing this package (please note that I don't know exactly how your python versions are installed, but usually, you should be safe now).
0
 

Author Comment

by:rroslan
ID: 21868756
python 2.4.3 comes with the centos VPS.
python 2.5.2 was dowwnloaded from python.org.. ./configure, make, make install
and plone ./install.sh standalone

Should that be all alright?
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21868794
Sounds good, but I don't know the configuration details of the selfcompiled versions, but they seem to at least share the python site-configuration directory, which is basically a good sign for a working setup.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question