How to install python server on CentOS 7

To install Python Server on CentOS 7

Python’s SimpleHTTPServer is a module that allows you to instantly create a web server or serve your files in a snap.  With SimpleHTTPServer, you don’t need to install anything since you have python interpreter installed. It is very simple to install Python server on CentOS 7 and this article sheds light on it. 


Installing python

You can install Python by executing the yum command in your terminal. 

[root@linuxhelp Desktop]# yum install python -y 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
  python.x86_64 0:2.7.5-48.el7                                                  

Dependency Updated:
  python-libs.x86_64 0:2.7.5-48.el7                                             




Once it is done, start python http server by running the following command. 

[root@linuxhelp Desktop]#  python2.7 -m SimpleHTTPServer 8880
Serving HTTP on port 8880 ...

After that, open your browser and give the url as serverip:8880( It will display the server. The sever starts running on your screen.   



While server runs in browser, you can see the it will log details displayed on your terminal. 

[root@linuxhelp Desktop]#  python2.7 -m SimpleHTTPServer 8880
Serving HTTP on port 8880 ... - - [03/Aug/2017 06:16:53] "GET / HTTP/1.1" 200 - - - [03/Aug/2017 06:16:53] code , message File - - [03/Aug/2017 06:16:53] "GET /favicon.ico HTTP/1.1"  - - - [03/Aug/2017 06:16:53], message File 

With this, the installation of Phython Server is complete.

Thank you! for using Linux Help.

You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website
Be the first to comment, we value your suggestions. For further queries please comment below.

Tags: CentOS Python
user image Author :  Jacob