Browse Source

Refreshed installation docs

Jeremy Stretch 7 years ago
parent
commit
a7f0b5adb3
2 changed files with 30 additions and 21 deletions
  1. 14 9
      docs/installation/netbox.md
  2. 16 12
      docs/installation/postgresql.md

+ 14 - 9
docs/installation/netbox.md

@@ -1,18 +1,23 @@
 # Installation
 
+This section of the documentation discusses installing and configuring the NetBox application.
+
+!!! note
+    Python 3 is strongly encouraged for new installations. Support for Python 2 will be discontinued in the near future. This documentation includes a guide on [migrating from Python 2 to Python 3](migrating-to-python3).
+
 **Ubuntu**
 
 Python 3:
 
 ```no-highlight
-# apt-get install -y python3 python3-dev python3-setuptools libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
+# apt-get install -y python3 python3-dev python3-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
 # easy_install3 pip
 ```
 
 Python 2:
 
 ```no-highlight
-# apt-get install -y python2.7 python-dev python-setuptools libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
+# apt-get install -y python2.7 python-dev python-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev
 # easy_install pip
 ```
 
@@ -163,13 +168,13 @@ You may use the script located at `netbox/generate_secret_key.py` to generate a
 # Run Database Migrations
 
 !!! warning
-    The examples on the rest of this page call the `python` executable, which will be Python2 on most systems. Replace this with `python3` if you're running NetBox on Python3.
+    The examples on the rest of this page call the `python3` executable. Replace this with `python2` or `python` if you're using Python 2.
 
-Before NetBox can run, we need to install the database schema. This is done by running `python manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example):
+Before NetBox can run, we need to install the database schema. This is done by running `python3 manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example):
 
 ```no-highlight
 # cd /opt/netbox/netbox/
-# python manage.py migrate
+# python3 manage.py migrate
 Operations to perform:
   Apply all migrations: dcim, sessions, admin, ipam, utilities, auth, circuits, contenttypes, extras, secrets, users
 Running migrations:
@@ -187,7 +192,7 @@ If this step results in a PostgreSQL authentication error, ensure that the usern
 NetBox does not come with any predefined user accounts. You'll need to create a super user to be able to log into NetBox:
 
 ```no-highlight
-# python manage.py createsuperuser
+# python3 manage.py createsuperuser
 Username: admin
 Email address: admin@example.com
 Password:
@@ -198,7 +203,7 @@ Superuser created successfully.
 # Collect Static Files
 
 ```no-highlight
-# python manage.py collectstatic --no-input
+# python3 manage.py collectstatic --no-input
 
 You have requested to collect static files at the destination
 location as specified in your settings:
@@ -219,7 +224,7 @@ NetBox ships with some initial data to help you get started: RIR definitions, co
     This step is optional. It's perfectly fine to start using NetBox without using this initial data if you'd rather create everything from scratch.
 
 ```no-highlight
-# python manage.py loaddata initial_data
+# python3 manage.py loaddata initial_data
 Installed 43 object(s) from 4 fixture(s)
 ```
 
@@ -228,7 +233,7 @@ Installed 43 object(s) from 4 fixture(s)
 At this point, NetBox should be able to run. We can verify this by starting a development instance:
 
 ```no-highlight
-# python manage.py runserver 0.0.0.0:8000 --insecure
+# python3 manage.py runserver 0.0.0.0:8000 --insecure
 Performing system checks...
 
 System check identified no issues (0 silenced).

+ 16 - 12
docs/installation/postgresql.md

@@ -1,16 +1,16 @@
-NetBox requires a PostgreSQL 9.4 or higher database to store data. (Please note that MySQL is not supported, as NetBox leverages PostgreSQL's built-in [network address types](https://www.postgresql.org/docs/current/static/datatype-net-types.html).)
+NetBox requires a PostgreSQL database to store data. This can be hosted locally or on a remote server. (Please note that MySQL is not supported, as NetBox leverages PostgreSQL's built-in [network address types](https://www.postgresql.org/docs/current/static/datatype-net-types.html).)
 
 !!! note
-    The installation instructions provided here have been tested to work on Ubuntu 16.04 and CentOS 6.9. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors.
+    The installation instructions provided here have been tested to work on Ubuntu 16.04 and CentOS 7.4. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors.
 
 !!! warning
-    NetBox v2.2 or later requires PostgreSQL 9.4.0 or higher.
+    NetBox v2.2 and later requires PostgreSQL 9.4 or higher.
 
 # Installation
 
 **Ubuntu**
 
-If a recent enough version of PostgreSQL is not available through your distribution's package manager, consider installing from an official [PostgreSQL repository](https://wiki.postgresql.org/wiki/Apt).
+If a recent enough version of PostgreSQL is not available through your distribution's package manager, you'll need to install it from an official [PostgreSQL repository](https://wiki.postgresql.org/wiki/Apt).
 
 ```no-highlight
 # apt-get update
@@ -19,22 +19,26 @@ If a recent enough version of PostgreSQL is not available through your distribut
 
 **CentOS**
 
+CentOS 7.4 does not ship with a recent enough version of PostgreSQL, so it will need to be installed from an external repository. The instructions below show the installation of PostgreSQL 9.6.
+
 ```no-highlight
-# yum install -y postgresql postgresql-server postgresql-devel
-# postgresql-setup initdb
+# yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
+# yum install postgresql96 postgresql96-server postgresql96-devel
+# /usr/pgsql-9.6/bin/postgresql96-setup initdb
 ```
 
-CentOS users should modify the PostgreSQL configuration to accept password-based authentication by replacing `ident` with `md5` for all host entries within `/var/lib/pgsql/data/pg_hba.conf`. For example:
+CentOS users should modify the PostgreSQL configuration to accept password-based authentication by replacing `ident` with `md5` for all host entries within `/var/lib/pgsql/9.6/data/pg_hba.conf`. For example:
 
 ```no-highlight
 host    all             all             127.0.0.1/32            md5
 host    all             all             ::1/128                 md5
 ```
 
-Then, start the service:
+Then, start the service and enable it to run at boot:
 
 ```no-highlight
-# systemctl start postgresql
+# systemctl start postgresql-9.6
+# systemctl enable postgresql-9.6
 ```
 
 # Database Creation
@@ -58,10 +62,10 @@ GRANT
 postgres=# \q
 ```
 
-You can verify that authentication works issuing the following command and providing the configured password:
+You can verify that authentication works issuing the following command and providing the configured password. (Replace `localhost` with your database server if using a remote database.)
 
 ```no-highlight
-# psql -U netbox -h localhost -W
+# psql -U netbox -W -h localhost netbox
 ```
 
-If successful, you will enter a `postgres` prompt. Type `\q` to exit.
+If successful, you will enter a `netbox` prompt. Type `\q` to exit.