Solved

To install python and plone on Centos 5.1 VPS

Posted on 2008-06-24
15
2,228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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 500 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Strings in Python are the set of characters that, once defined, cannot be changed by any other method like replace. Even if we use the replace method it still does not modify the original string that we use, but just copies the string and then modif…
Flask is a microframework for Python based on Werkzeug and Jinja 2. This requires you to have a good understanding of Python 2.7. Lets install Flask! To install Flask you can use a python repository for libraries tool called pip. Download this f…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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 …

735 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