Sphinx Documentation Generator is web software written in python and based on jinja template. The direct HTML outputs that makes it superfast and working with all browsers. For creating any documentation for any projects using reStructuredText (rst) Markups. Sphinx makes documentation Project much easier using its rich features. In this tutorial we are going to explain the installation and configuration using step by step procedures.
Step-1 (Install Required Modules)
On Ubuntu and its derivatives
Firstly update the repositories so that update packages will be useful for installation
# apt-get update
So, Installing required packages
# apt-get install python-pip python-dev apache2
On CentOS and its derivatives
While Installing and Enabling EPEL repository for better package support.
# yum install epel-release
After that it is essential for Installing required packages.
# yum install python-pip python-devel httpd
Step-2 (Install Sphinx using Python Package manager)
It is the best way to upgrade the Python Package manager
# pip install --upgrade pip
After that, Installing the Setuptools
# easy_install -U setuptools
Finally, Installing Sphinx using pip based python package installer.
# pip install sphinx
Step-3 (Select the path for Installing the Sphinx)
Change the directory to where we will going to install sphinx software.
# cd /var/www/html/
Run the Sphinx setup scripts
Run the auto sphinx setup script.
# sphinx-quickstart
Step-4 (Create the Static HTML files)
# make html
Create the Index file
Rename the your project HTML files to index HTML to work properly with Apache web server
# cp -rv /var/www/html/_build/html/yourproject.html /var/www/html/_build/html/index.html
Step-5 (Add the Static files path to Apache Virtual Configuration files)
On Ubuntu and its derivatives
# vi /etc/apache2/sites-available/000-default.conf
On CentOS and its derivatives
# vi /etc/httpd/conf.d/welcome.conf
After this command run add given lines
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/_build/html/ </VirtualHost>
When all done restart the Apache Services
On Ubuntu and its derivatives
# sudo systemctl restart apache2
On CentOS and its derivatives
# sudo systemctl restart httpd
Step-6 (Check the Sphinx on your browser)
Now your Sphinx python Document Generator Website is live on your server IP.
Finally Add the data to the source files.
# vi /var/www/html/_build/html/_sources/yourproject.txt
For yout kind information it uses reStructuredText for plaintext markup syntax.
For more information and reference use the Sphinx python Doc official Website.
Congratulation you have installed the Sphinx on CentOS and Ubuntu.