How to Install & Configure Sphinx-Doc on Ubuntu 16.04 / CentOS 7

How to Install and Configure Sphinx Python based Documentation Generator on Ubuntu / CentOS / RHEL / Linux Mint / Debian. Sphinx Documentation Generator is web software written in python and based on jinja template features for direct HTML outputs that makes it so fast to open on your browsers. It is used to create any documentation for any projects using reStructuredText (rst) Markups. It makes documentation Project much easier using its rich features. this tutorial explains installation and configuration using step by step procedures.

Install Sphinx Documentation Generator

Step-1 (Install Required Modules)
On Ubuntu and its derivatives

Update the repositories

# apt-get update

Installing required packages

# apt-get install python-pip python-dev apache2
On CentOS and its derivatives

Installing and Enabling EPEL repository

# yum install epel-release

Installing required packages

# yum install python-pip python-devel httpd
Step-2 (Install Sphinx using Python Package manager)

Upgrade the Python Package manager

# pip install --upgrade pip

Installing the Setuptools

# easy_install -U setuptools

Installing Sphinx

# pip install sphinx

Configure the Sphinx Documentation Generator

Step-1 (Select the path for Installing the Sphinx)

Change the directory to where we will going to install sphinx software.

# cd /var/www/html/
Step-2 ( Run the Sphinx setup scripts)

Run the auto sphinx setup script and select the recommended options during running the setup

# sphinx-quickstart
Step-3 (Create the Static HTML files)
# make html
Step-4 (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

Remove all the default lines after that Add the given lines

<VirtualHost *:80>

ServerAdmin [email protected]
DocumentRoot /var/www/html/_build/html/

Step-6 (Restart the Apache Services)
On Ubuntu and its derivatives
# sudo systemctl restart apache2
On CentOS and its derivatives
# sudo systemctl restart httpd
Step-7 (Check Sphinx website whether its is working or not)

Now your Sphinx python Document Generator Website is live on your server IP.


Step-8 (Add the data to the source files)
# vi /var/www/html/_build/html/_sources/yourproject.txt

It uses reStructuredText for plaintext markup syntax.For more information and reference use the Sphinx python Doc official Website.


Now you have successfully deployed the Sphinx Python based Documentation Generator on you respective Linux Distribution. If you need help we will happy to assist you accordingly for that you must use the comment section below.

Related Post

Develop New SysAdmin Skills with E-books (FREE Download)