Sphinx on Ubuntu 16.04

Purpose

This document explains how to install Sphinx on Ubuntu 16.04.

Process

Update the software on your Ubuntu workstation. The necessary commands are apt update and apt upgrade, run as the root user:

root@host:~# apt update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security/main Sources [44.1 kB]
Get:5 http://security.ubuntu.com/ubuntu xenial-security/universe Sources [12.3 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [160 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [65.8 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [51.9 kB]
Get:9 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [31.8 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [201 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [107 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [415 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [159 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [356 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [128 kB]
Fetched 1,922 kB in 0s (2,465 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
20 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@host:~# apt upgrade
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
The following NEW packages will be installed:
  libpython3.5
The following packages will be upgraded:
  distro-info-data init init-system-helpers initramfs-tools-bin klibc-utils
  libapparmor1 libc-bin libc6 libklibc libsystemd0 libudev1 locales
  multiarch-support systemd systemd-sysv tzdata vim vim-common vim-runtime
  vim-tiny
20 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.9 MB of archives.
After this operation, 4,778 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 init-system-helpers all 1.29ubuntu3 [32.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 init amd64 1.29ubuntu3 [4,716 B]
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc6 amd64 2.23-0ubuntu4 [2,586 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 locales all 2.23-0ubuntu4 [3,214 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libc-bin amd64 2.23-0ubuntu4 [623 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libapparmor1 amd64 2.10.95-0ubuntu2.5 [31.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libsystemd0 amd64 229-4ubuntu11 [206 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 systemd amd64 229-4ubuntu11 [3,669 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 systemd-sysv amd64 229-4ubuntu11 [13.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libudev1 amd64 229-4ubuntu11 [56.0 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 multiarch-support amd64 2.23-0ubuntu4 [6,828 B]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 tzdata all 2016h-0ubuntu0.16.04 [168 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 distro-info-data all 0.28ubuntu0.2 [4,006 B]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 initramfs-tools-bin amd64 0.122ubuntu8.5 [9,334 B]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 klibc-utils amd64 2.0.4-8ubuntu1.16.04.2 [107 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libklibc amd64 2.0.4-8ubuntu1.16.04.2 [41.3 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim amd64 2:7.4.1689-3ubuntu1.1 [1,036 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-tiny amd64 2:7.4.1689-3ubuntu1.1 [445 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.1 [5,174 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython3.5 amd64 3.5.2-2~16.04 [1,359 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-common amd64 2:7.4.1689-3ubuntu1.1 [104 kB]
Preconfiguring packages ...
Fetched 18.9 MB in 0s (38.2 MB/s)
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../init-system-helpers_1.29ubuntu3_all.deb ...
Unpacking init-system-helpers (1.29ubuntu3) over (1.29ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up init-system-helpers (1.29ubuntu3) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../init_1.29ubuntu3_amd64.deb ...
Unpacking init (1.29ubuntu3) over (1.29ubuntu2) ...
Setting up init (1.29ubuntu3) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../libc6_2.23-0ubuntu4_amd64.deb ...
Unpacking libc6:amd64 (2.23-0ubuntu4) over (2.23-0ubuntu3) ...
Setting up libc6:amd64 (2.23-0ubuntu4) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../locales_2.23-0ubuntu4_all.deb ...
Unpacking locales (2.23-0ubuntu4) over (2.23-0ubuntu3) ...
Preparing to unpack .../libc-bin_2.23-0ubuntu4_amd64.deb ...
Unpacking libc-bin (2.23-0ubuntu4) over (2.23-0ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libc-bin (2.23-0ubuntu4) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../libapparmor1_2.10.95-0ubuntu2.5_amd64.deb ...
Unpacking libapparmor1:amd64 (2.10.95-0ubuntu2.5) over (2.10.95-0ubuntu2.2) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Setting up libapparmor1:amd64 (2.10.95-0ubuntu2.5) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../libsystemd0_229-4ubuntu11_amd64.deb ...
Unpacking libsystemd0:amd64 (229-4ubuntu11) over (229-4ubuntu10) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Setting up libsystemd0:amd64 (229-4ubuntu11) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../systemd_229-4ubuntu11_amd64.deb ...
Unpacking systemd (229-4ubuntu11) over (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for dbus (1.10.6-1ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up systemd (229-4ubuntu11) ...
addgroup: The group `systemd-journal' already exists as a system group. Exiting.
unable to set CAP_SETFCAP effective capability: Operation not permitted
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../systemd-sysv_229-4ubuntu11_amd64.deb ...
Unpacking systemd-sysv (229-4ubuntu11) over (229-4ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up systemd-sysv (229-4ubuntu11) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../libudev1_229-4ubuntu11_amd64.deb ...
Unpacking libudev1:amd64 (229-4ubuntu11) over (229-4ubuntu10) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Setting up libudev1:amd64 (229-4ubuntu11) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../multiarch-support_2.23-0ubuntu4_amd64.deb ...
Unpacking multiarch-support (2.23-0ubuntu4) over (2.23-0ubuntu3) ...
Setting up multiarch-support (2.23-0ubuntu4) ...
(Reading database ... 14282 files and directories currently installed.)
Preparing to unpack .../tzdata_2016h-0ubuntu0.16.04_all.deb ...
Unpacking tzdata (2016h-0ubuntu0.16.04) over (2016f-0ubuntu0.16.04) ...
Preparing to unpack .../distro-info-data_0.28ubuntu0.2_all.deb ...
Unpacking distro-info-data (0.28ubuntu0.2) over (0.28ubuntu0.1) ...
Preparing to unpack .../initramfs-tools-bin_0.122ubuntu8.5_amd64.deb ...
Unpacking initramfs-tools-bin (0.122ubuntu8.5) over (0.122ubuntu8.1) ...
Preparing to unpack .../klibc-utils_2.0.4-8ubuntu1.16.04.2_amd64.deb ...
Unpacking klibc-utils (2.0.4-8ubuntu1.16.04.2) over (2.0.4-8ubuntu1.16.04.1) ...
Preparing to unpack .../libklibc_2.0.4-8ubuntu1.16.04.2_amd64.deb ...
Unpacking libklibc (2.0.4-8ubuntu1.16.04.2) over (2.0.4-8ubuntu1.16.04.1) ...
Preparing to unpack .../vim_2%3a7.4.1689-3ubuntu1.1_amd64.deb ...
Unpacking vim (2:7.4.1689-3ubuntu1.1) over (2:7.4.1689-3ubuntu1) ...
Preparing to unpack .../vim-tiny_2%3a7.4.1689-3ubuntu1.1_amd64.deb ...
Unpacking vim-tiny (2:7.4.1689-3ubuntu1.1) over (2:7.4.1689-3ubuntu1) ...
Preparing to unpack .../vim-runtime_2%3a7.4.1689-3ubuntu1.1_all.deb ...
Unpacking vim-runtime (2:7.4.1689-3ubuntu1.1) over (2:7.4.1689-3ubuntu1) ...
Selecting previously unselected package libpython3.5:amd64.
Preparing to unpack .../libpython3.5_3.5.2-2~16.04_amd64.deb ...
Unpacking libpython3.5:amd64 (3.5.2-2~16.04) ...
Preparing to unpack .../vim-common_2%3a7.4.1689-3ubuntu1.1_amd64.deb ...
Unpacking vim-common (2:7.4.1689-3ubuntu1.1) over (2:7.4.1689-3ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up locales (2.23-0ubuntu4) ...
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
Setting up tzdata (2016h-0ubuntu0.16.04) ...

Current default time zone: 'Etc/UTC'
Local time is now:      Tue Nov  1 05:30:27 UTC 2016.
Universal Time is now:  Tue Nov  1 05:30:27 UTC 2016.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Setting up distro-info-data (0.28ubuntu0.2) ...
Setting up initramfs-tools-bin (0.122ubuntu8.5) ...
Setting up libklibc (2.0.4-8ubuntu1.16.04.2) ...
Setting up klibc-utils (2.0.4-8ubuntu1.16.04.2) ...
Setting up vim-common (2:7.4.1689-3ubuntu1.1) ...
Setting up vim-runtime (2:7.4.1689-3ubuntu1.1) ...
Setting up libpython3.5:amd64 (3.5.2-2~16.04) ...
Setting up vim (2:7.4.1689-3ubuntu1.1) ...
Setting up vim-tiny (2:7.4.1689-3ubuntu1.1) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...

Install the virtualenvwrapper command, which allows you to easily manage multiple Python virtual environments. The command for this is apt install virtualenvwrapper:

root@host:~# apt install virtualenvwrapper
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  bash-completion javascript-common libjs-jquery libjs-sphinxdoc
  libjs-underscore python-pbr python-pip-whl python-pkg-resources python-six
  python-stevedore python-virtualenv python3-pkg-resources python3-virtualenv
  virtualenv virtualenv-clone
Suggested packages:
  apache2 | lighttpd | httpd python-setuptools python3-setuptools
The following NEW packages will be installed:
  bash-completion javascript-common libjs-jquery libjs-sphinxdoc
libjs-underscore python-pbr python-pip-whl python-pkg-resources python-six
python-stevedore python-virtualenv python3-pkg-resources python3-virtualenv
virtualenv virtualenv-clone virtualenvwrapper
0 upgraded, 16 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,983 kB of archives.
After this operation, 5,761 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 bash-completion all 1:2.1-4.2ubuntu1.1 [152 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 javascript-common all 11 [6,066 B]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libjs-jquery all 1.11.3+dfsg-4 [161 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 libjs-underscore all 1.7.0~dfsg-1ubuntu1 [46.7 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 libjs-sphinxdoc all 1.3.6-2ubuntu1 [57.5 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-pip-whl all 8.1.1-2ubuntu0.2 [1,111 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-six all 1.10.0-3 [10.9 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-pbr all 1.8.0-4ubuntu1 [46.6 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-stevedore all 1.12.0-1 [17.7 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python-virtualenv all 15.0.1+ds-3 [46.7 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/main amd64 python3-pkg-resources all 20.7.0-1 [79.0 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python3-virtualenv all 15.0.1+ds-3 [43.3 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial/universe amd64 virtualenv all 15.0.1+ds-3 [4,342 B]
Get:15 http://archive.ubuntu.com/ubuntu xenial/universe amd64 virtualenv-clone all 0.2.5-1 [7,428 B]
Get:16 http://archive.ubuntu.com/ubuntu xenial/universe amd64 virtualenvwrapper all 4.3.1-2 [84.5 kB]
Fetched 1,983 kB in 0s (8,321 kB/s)
Selecting previously unselected package bash-completion.
(Reading database ... 14292 files and directories currently installed.)
Preparing to unpack .../bash-completion_1%3a2.1-4.2ubuntu1.1_all.deb ...
Unpacking bash-completion (1:2.1-4.2ubuntu1.1) ...
Replaced by files in installed package apt (1.2.12~ubuntu16.04.1) ...
Selecting previously unselected package javascript-common.
Preparing to unpack .../javascript-common_11_all.deb ...
Unpacking javascript-common (11) ...
Selecting previously unselected package libjs-jquery.
Preparing to unpack .../libjs-jquery_1.11.3+dfsg-4_all.deb ...
Unpacking libjs-jquery (1.11.3+dfsg-4) ...
Selecting previously unselected package libjs-underscore.
Preparing to unpack .../libjs-underscore_1.7.0~dfsg-1ubuntu1_all.deb ...
Unpacking libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
Selecting previously unselected package libjs-sphinxdoc.
Preparing to unpack .../libjs-sphinxdoc_1.3.6-2ubuntu1_all.deb ...
Unpacking libjs-sphinxdoc (1.3.6-2ubuntu1) ...
Selecting previously unselected package python-pip-whl.
Preparing to unpack .../python-pip-whl_8.1.1-2ubuntu0.2_all.deb ...
Unpacking python-pip-whl (8.1.1-2ubuntu0.2) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_20.7.0-1_all.deb ...
Unpacking python-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python-six.
Preparing to unpack .../python-six_1.10.0-3_all.deb ...
Unpacking python-six (1.10.0-3) ...
Selecting previously unselected package python-pbr.
Preparing to unpack .../python-pbr_1.8.0-4ubuntu1_all.deb ...
Unpacking python-pbr (1.8.0-4ubuntu1) ...
Selecting previously unselected package python-stevedore.
Preparing to unpack .../python-stevedore_1.12.0-1_all.deb ...
Unpacking python-stevedore (1.12.0-1) ...
Selecting previously unselected package python-virtualenv.
Preparing to unpack .../python-virtualenv_15.0.1+ds-3_all.deb ...
Unpacking python-virtualenv (15.0.1+ds-3) ...
Selecting previously unselected package python3-pkg-resources.
Preparing to unpack .../python3-pkg-resources_20.7.0-1_all.deb ...
Unpacking python3-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python3-virtualenv.
Preparing to unpack .../python3-virtualenv_15.0.1+ds-3_all.deb ...
Unpacking python3-virtualenv (15.0.1+ds-3) ...
Selecting previously unselected package virtualenv.
Preparing to unpack .../virtualenv_15.0.1+ds-3_all.deb ...
Unpacking virtualenv (15.0.1+ds-3) ...
Selecting previously unselected package virtualenv-clone.
Preparing to unpack .../virtualenv-clone_0.2.5-1_all.deb ...
Unpacking virtualenv-clone (0.2.5-1) ...
Selecting previously unselected package virtualenvwrapper.
Preparing to unpack .../virtualenvwrapper_4.3.1-2_all.deb ...
Unpacking virtualenvwrapper (4.3.1-2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up bash-completion (1:2.1-4.2ubuntu1.1) ...
Setting up javascript-common (11) ...
Setting up libjs-jquery (1.11.3+dfsg-4) ...
Setting up libjs-underscore (1.7.0~dfsg-1ubuntu1) ...
Setting up libjs-sphinxdoc (1.3.6-2ubuntu1) ...
Setting up python-pip-whl (8.1.1-2ubuntu0.2) ...
Setting up python-pkg-resources (20.7.0-1) ...
Setting up python-six (1.10.0-3) ...
Setting up python-pbr (1.8.0-4ubuntu1) ...
update-alternatives: using /usr/bin/python2-pbr to provide /usr/bin/pbr (pbr) in auto mode
Setting up python-stevedore (1.12.0-1) ...
Setting up python-virtualenv (15.0.1+ds-3) ...
Setting up python3-pkg-resources (20.7.0-1) ...
Setting up python3-virtualenv (15.0.1+ds-3) ...
Setting up virtualenv (15.0.1+ds-3) ...
Setting up virtualenv-clone (0.2.5-1) ...
Setting up virtualenvwrapper (4.3.1-2) ...

Install git with the command apt install git. We will use git to manage source code for documentation:

root@host:~# apt install git
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  git-man liberror-perl patch rsync
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk
  gitweb git-arch git-cvs git-mediawiki git-svn ed diffutils-doc
The following NEW packages will be installed:
  git git-man liberror-perl patch rsync
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,176 kB of archives.
After this operation, 26.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 rsync amd64 3.1.1-3ubuntu1 [325 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 liberror-perl all 0.17-1.2 [19.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 git-man all 1:2.7.4-0ubuntu1 [735 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 git amd64 1:2.7.4-0ubuntu1 [3,006 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 patch amd64 2.7.5-1 [90.4 kB]
Fetched 4,176 kB in 0s (17.8 MB/s)
Selecting previously unselected package rsync.
(Reading database ... 16979 files and directories currently installed.)
Preparing to unpack .../rsync_3.1.1-3ubuntu1_amd64.deb ...
Unpacking rsync (3.1.1-3ubuntu1) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../liberror-perl_0.17-1.2_all.deb ...
Unpacking liberror-perl (0.17-1.2) ...
Selecting previously unselected package git-man.
Preparing to unpack .../git-man_1%3a2.7.4-0ubuntu1_all.deb ...
Unpacking git-man (1:2.7.4-0ubuntu1) ...
Selecting previously unselected package git.
Preparing to unpack .../git_1%3a2.7.4-0ubuntu1_amd64.deb ...
Unpacking git (1:2.7.4-0ubuntu1) ...
Selecting previously unselected package patch.
Preparing to unpack .../patch_2.7.5-1_amd64.deb ...
Unpacking patch (2.7.5-1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up rsync (3.1.1-3ubuntu1) ...
Setting up liberror-perl (0.17-1.2) ...
Setting up git-man (1:2.7.4-0ubuntu1) ...
Setting up git (1:2.7.4-0ubuntu1) ...
Setting up patch (2.7.5-1) ...

Building Sphinx documentation with make is convenient, so we install make:

root@host:~# apt install make
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
  make-doc
The following NEW packages will be installed:
  make
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 151 kB of archives.
After this operation, 365 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 make amd64 4.1-6 [151 kB]
Fetched 151 kB in 0s (1,169 kB/s)
Selecting previously unselected package make.
(Reading database ... 17831 files and directories currently installed.)
Preparing to unpack .../archives/make_4.1-6_amd64.deb ...
Unpacking make (4.1-6) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up make (4.1-6) ...

If you want to use gettext to localize your documentation, install gettext:

root@host:~# apt install gettext
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libasprintf-dev libcroco3 libgettextpo-dev libgettextpo0 libgomp1 libicu55
  libunistring0 libxml2 sgml-base xml-core
Suggested packages:
  gettext-doc autopoint sgml-base-doc debhelper
The following NEW packages will be installed:
  gettext libasprintf-dev libcroco3 libgettextpo-dev libgettextpo0 libgomp1
  libicu55 libunistring0 libxml2 sgml-base xml-core
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.1 MB of archives.
After this operation, 40.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 sgml-base all 1.26+nmu4ubuntu1 [12.5 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial/main amd64 libunistring0 amd64 0.9.3-5.2ubuntu1 [279 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 libicu55 amd64 55.1-7 [7,643 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libxml2 amd64 2.9.3+dfsg1-1ubuntu0.1 [696 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 xml-core all 0.13+nmu2 [23.3 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 libcroco3 amd64 0.6.11-1 [81.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgomp1 amd64 5.4.0-6ubuntu1~16.04.2 [55.1 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 gettext amd64 0.19.7-2ubuntu3 [1,076 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 libasprintf-dev amd64 0.19.7-2ubuntu3 [4,734 B]
Get:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgettextpo0 amd64 0.19.7-2ubuntu3 [125 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 libgettextpo-dev amd64 0.19.7-2ubuntu3 [141 kB]
Fetched 10.1 MB in 0s (27.5 MB/s)
Selecting previously unselected package sgml-base.
(Reading database ... 17854 files and directories currently installed.)
Preparing to unpack .../sgml-base_1.26+nmu4ubuntu1_all.deb ...
Unpacking sgml-base (1.26+nmu4ubuntu1) ...
Selecting previously unselected package libunistring0:amd64.
Preparing to unpack .../libunistring0_0.9.3-5.2ubuntu1_amd64.deb ...
Unpacking libunistring0:amd64 (0.9.3-5.2ubuntu1) ...
Selecting previously unselected package libicu55:amd64.
Preparing to unpack .../libicu55_55.1-7_amd64.deb ...
Unpacking libicu55:amd64 (55.1-7) ...
Selecting previously unselected package libxml2:amd64.
Preparing to unpack .../libxml2_2.9.3+dfsg1-1ubuntu0.1_amd64.deb ...
Unpacking libxml2:amd64 (2.9.3+dfsg1-1ubuntu0.1) ...
Selecting previously unselected package xml-core.
Preparing to unpack .../xml-core_0.13+nmu2_all.deb ...
Unpacking xml-core (0.13+nmu2) ...
Selecting previously unselected package libcroco3:amd64.
Preparing to unpack .../libcroco3_0.6.11-1_amd64.deb ...
Unpacking libcroco3:amd64 (0.6.11-1) ...
Selecting previously unselected package libgomp1:amd64.
Preparing to unpack .../libgomp1_5.4.0-6ubuntu1~16.04.2_amd64.deb ...
Unpacking libgomp1:amd64 (5.4.0-6ubuntu1~16.04.2) ...
Selecting previously unselected package gettext.
Preparing to unpack .../gettext_0.19.7-2ubuntu3_amd64.deb ...
Unpacking gettext (0.19.7-2ubuntu3) ...
Selecting previously unselected package libasprintf-dev:amd64.
Preparing to unpack .../libasprintf-dev_0.19.7-2ubuntu3_amd64.deb ...
Unpacking libasprintf-dev:amd64 (0.19.7-2ubuntu3) ...
Selecting previously unselected package libgettextpo0:amd64.
Preparing to unpack .../libgettextpo0_0.19.7-2ubuntu3_amd64.deb ...
Unpacking libgettextpo0:amd64 (0.19.7-2ubuntu3) ...
Selecting previously unselected package libgettextpo-dev:amd64.
Preparing to unpack .../libgettextpo-dev_0.19.7-2ubuntu3_amd64.deb ...
Unpacking libgettextpo-dev:amd64 (0.19.7-2ubuntu3) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Setting up sgml-base (1.26+nmu4ubuntu1) ...
Setting up libunistring0:amd64 (0.9.3-5.2ubuntu1) ...
Setting up libicu55:amd64 (55.1-7) ...
Setting up libxml2:amd64 (2.9.3+dfsg1-1ubuntu0.1) ...
Setting up xml-core (0.13+nmu2) ...
Setting up libcroco3:amd64 (0.6.11-1) ...
Setting up libgomp1:amd64 (5.4.0-6ubuntu1~16.04.2) ...
Setting up gettext (0.19.7-2ubuntu3) ...
Setting up libasprintf-dev:amd64 (0.19.7-2ubuntu3) ...
Setting up libgettextpo0:amd64 (0.19.7-2ubuntu3) ...
Setting up libgettextpo-dev:amd64 (0.19.7-2ubuntu3) ...
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...

Create a new, non-root user. Here, we create a user user using the Debian-specific adduser command:

root@host:~# adduser user
Adding user `user' ...
Adding new group `user' (1000) ...
Adding new user `user' (1000) with group `user' ...
Creating home directory `/home/user' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for user
Enter the new value, or press ENTER for the default
        Full Name []:
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n]

Login as the user with the sudo command. The -i flag runs the shell as though it were a login shell. The -u flag selects the user which will run the command or shell:

root@host:~# sudo -i -u user
user@host:~$

Create a Python virtual environment for working with Sphinx. In this example, we are using the -p option to choose the Python 3.5 interpreter:

user@host:~$ mkvirtualenv -p $(which python3.5) sphinx
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /home/user/.virtualenvs/sphinx/bin/python3.5
Also creating executable in /home/user/.virtualenvs/sphinx/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

This automatically activates the sphinx virtual environment. You can see this in the command prompt:

(sphinx) user@host:~$

Next, install Sphinx:

(sphinx) user@host:~$ pip install sphinx
Collecting sphinx
  Downloading Sphinx-1.4.8-py2.py3-none-any.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 903kB/s
Collecting babel!=2.0,>=1.3 (from sphinx)
  Downloading Babel-2.3.4-py2.py3-none-any.whl (7.1MB)
    100% |████████████████████████████████| 7.1MB 240kB/s
Collecting alabaster<0.8,>=0.7 (from sphinx)
  Downloading alabaster-0.7.9-py2.py3-none-any.whl
Collecting imagesize (from sphinx)
  Downloading imagesize-0.7.1-py2.py3-none-any.whl
Collecting snowballstemmer>=1.1 (from sphinx)
  Downloading snowballstemmer-1.2.1-py2.py3-none-any.whl (64kB)
    100% |████████████████████████████████| 71kB 7.0MB/s
Collecting six>=1.5 (from sphinx)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting Jinja2>=2.3 (from sphinx)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |████████████████████████████████| 266kB 5.1MB/s
Collecting Pygments>=2.0 (from sphinx)
  Downloading Pygments-2.1.3-py2.py3-none-any.whl (755kB)
    100% |████████████████████████████████| 757kB 2.3MB/s
Collecting docutils>=0.11 (from sphinx)
  Downloading docutils-0.12-py3-none-any.whl (508kB)
    100% |████████████████████████████████| 512kB 3.0MB/s
Collecting pytz>=0a (from babel!=2.0,>=1.3->sphinx)
  Downloading pytz-2016.7-py2.py3-none-any.whl (480kB)
    100% |████████████████████████████████| 481kB 3.9MB/s
Collecting MarkupSafe (from Jinja2>=2.3->sphinx)
  Downloading MarkupSafe-0.23.tar.gz
Building wheels for collected packages: MarkupSafe
  Running setup.py bdist_wheel for MarkupSafe ... done
  Stored in directory: /home/user/.cache/pip/wheels/a3/fa/dc/0198eed9ad95489b8a4f45d14dd5d2aee3f8984e46862c5748
Successfully built MarkupSafe
Installing collected packages: pytz, babel, alabaster, imagesize, snowballstemmer, six, MarkupSafe, Jinja2, Pygments, docutils, sphinx
Successfully installed Jinja2-2.8 MarkupSafe-0.23 Pygments-2.1.3 alabaster-0.7.9 babel-2.3.4 docutils-0.12 imagesize-0.7.1 pytz-2016.7 six-1.10.0 snowballstemmer-1.2.1 sphinx-1.4.8

At this point, you can run sphinx-quickstart to configure a documentation root.