Making and installing Python on a 1and1 shared host

In my last post I built and installed Subversion. In this post, I’ll build and install the current 2.x version of Python, which will be needed for Trac, later.

Similar to how we built and installed Subversion, where are the commands to install Python. As before, you will need to get the HTTP address for the current version of Python (from http://www.python.org/download/) and modify the procedure for your home directory path, which you can get by running the pwd command.

For line six, in the following list of commands, get the prefix path by entering cd ~/opt and then running the pwd command.

cd ~/dev
wget http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz
tar -xzvf Python-2.6.4.tgz
cd Python-2.6.4
mkdir ~/opt
./configure --prefix=$HOME/opt
make
make install

Modify your ~/.bash_profile file so you can run Subverison commands without typing the full path. If you’ve already modified your PATH to look in ~/opt/bin, then you should skip this.

echo 'export PATH=$HOME/opt/bin:$PATH' >> ~/.bash_profile

Note that I stuck the new Python at the beginning of the path so it overrides the random old Python that 1and1 has installed.

Use the source command to reset your environment from your newly modified ~/.bash_profile file.

source ~/.bash_profile

Test the result

python

Look at the version printed and exit with control-d.

End of procedure.

Be Sociable, Share!

3 thoughts on “Making and installing Python on a 1and1 shared host

  1. @Andrew, thanks for sharing this. Just starting out with a Python class and this post was extremely helpful with setting things up. :)

Comments are closed.