Here at Webhostpython.com, we completely support Python and the Django framework. This has been one of our main focal points, hence the name “Webhostpython“. We are avid supporters of this beautiful programming language.
Installing Python and Django on a VPS or server with CentOS is quite easy. Most of it can be done via yum. You will need root access to your server. You can download and install “putty” here https://www.webhostpython.com/billing/dl.php?type=d&id=22 This is used to SSH into your server. The username would be ‘root’ and the password will be the root password to your server. You have now logged into your server.
Your server most likely already comes with Python installed. You can verify this by logging into your server via SSH and typing:
root@server [/]# python -V
You should get an output, such as the above, which says ‘Python 2.6.6″. If you have a different version, such as a newer one, that is fine. You have Python installed and can continue with installing django.
To install django, we first need to add the epel repository. Do the following:
rpm –Uvh epel–release–6–8.noarch.rpm
rm epel–release–6–8.noarch.rpm –f
You have now installed the epel repository, which may be needed for CentOS 5/6.x. In order to install django, you will need to install MySQL-python. This is a requirement for django to be installed properly using our method. However, “yum” excludes any installation that has ‘MySQL”.
So first, we need to modify the config file for yum. So type:
Now, on the second line, you will see something like this:
exclude=apache* bind-chroot courier* dovecot* exim* mysql* filesystem httpd* mod_ssl* mydns* nsd* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*
You will remove the part that says “mysql*”. So, you need to swith to editor mode so you can delete that line. Move to the area that you are about to delete, in this case “mysql*”. Then, press the “i” button on your keyboard. You are now in “insert mode”. You are now able to delete the mysql* text.
After you have deleted it, press the esc key on your keyboard. Now, type in “ZZ” (Yes, just type in two capital letter Z’s)This will automatically close and save your changes.
We are now ready. Install MySQL-python by typing:
yum install MySQL-python
If you are asked “yes or no” to continue, type in ‘yes’.
When that is done installing, now move on to finally install django:
yum install django
And again, if asked “yes or no” to continue, type in ‘yes’. That’s it! Django is now installed on your VPS or server. You can now test to make sure python and django are installed correctly by typing in “python” and then typing the following:
This will give you the version number of django and verify that it has been completed! Here is an example of the last step:
root@server [~]# python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import django
>>> print django.get_version()
Press “ctrl +d” to exit python mode. You are all set and ready to go!