Python is a beautiful programming language, one that we strongly support here at Webhostpython.com. Not only do our standard cPanel shared hosting plans come with it, but we also have specific plans geared towards python using our customized control panel.

One of the simplest first steps to any programming language, is to create what is known as a “Hello World” application. This lets you know A), you have installed Python ok, on your server and it’s working correctly, and B) that you have now created a working python application in a working environment.

So the first thing we’re going to do to create this hello world application is login to our account using SSH. For instructions on how to use putty to SSH into your server, click here.¬†This tutorial has been written for CentOS (6.X/ 5.X)

After logging into SSH, we want to verify that we have a working version of python. So type in:

python -V

This should return information pertaining to the version of Python you are using, and confirms that you do indeed have a working python on your server, vps, or working environment.

The first thing we want to do is create a file using the following command:

touch hello-world.py

To make sure we have successfully created this file, we can run the following command to see a directory listing and make sure that the file is listed:

ls

Now, let’s edit the file we have just created:

nano hello-world.py

This opens up a file editor. We now want to type in the code to our first hello world application. So, type the following:

print “Hello, World!”

After doing this, save and exit this file by pressing ctrl + x on your keyboard. When prompted to save the file, type ‘y’ for yes, and then press enter to keep the filename the same. Doing this will take you back to your command prompt.

Now, let’s run the file we have just created to see if it is working correctly. So type the following:

python hello-world.py

This should give you an output that says “Hello World”. That’s it! You have now created your first hello world python application in Linux!