Install from source on Debian¶
This details what the Debian package does for you automatically.
Adapt this if you can’t use an official
.deb or need to install on
something that isn’t Debian-based.
This howto is based on Debian 9 (Stretch).
1. OS dependencies¶
First get the following OS packages:
apt-get install -y python-pip python-wheel git postgresql apache2 libapache2-mod-wsgi libsnmp30
2. Get the source¶
Get the source:
git clone https://github.com/Uninett/nav.git cd nav
You might want to choose your version now, otherwise you’ll be installing the
bleeding edge master branch. All release versions have git tags, so you can
easily find and checkout the latest stable version (although these instructions
are not valid for versions of NAV prior to 4.9). Use
git tag to list the
available tags, and
git checkout x.y.z to checkout version
5. Build the docs¶
If you like, you can build the complete HTML documentation thus:
python setup.py build_sphinx
6. Initialize the database¶
/etc/nav/db.conf there should be an option called
userpw_nav. Choose a password and append it here, then run:
sudo -u postgres navsyncdb -c
You should now have a database
nav with a user
7. Create users and groups¶
navcron user and a corresponding group for NAV to run as:
sudo addgroup --system nav sudo adduser --system --home /usr/share/nav \ --shell /bin/sh --ingroup nav navcron
You should also make sure navcron has permission to write log files, pid
files and various other state information. You can configure the log and pid
file directories in
nav.conf. Then make sure these directories exist
and are writable for the
sudo chown -R navcron:nav /path/to/log/directory sudo chown -R navcron:nav /path/to/pid/directory
Sending SMS messages using a locally attached GSM device¶
If you want to use NAV’s SMS functionality in conjunction with Gammu, you
should make sure the
navcron user is allowed to write to the serial device
you’ve connected your GSM device to. Often, this device has a group ownership
set to the
dialout group, so the easieast route is to add the
sudo addgroup navcron dialout
8. Ensure that a writeable uploads directory exists¶
The NAV web ui allows you to upload and attach images to room and location objects. These images will be stored in the file system, so NAV needs a writeable directory to store them in (and from where the web server can serve them).
mkdir -p /usr/share/nav/var/uploads chown navcron:nav /usr/share/nav/var/uploads
Then, ensure you set this option in
9. Install the static resources¶
django-admin collectstatic --settings=nav.django.settings
It’ll respond with something like:
You have requested to collect static files at the destination location as specified in your settings: /usr/share/nav/www/static This will overwrite existing files! Are you sure you want to do this? Type 'yes' to continue, or 'no' to cancel:
Take note of the path (
/usr/share/nav/www, without the
subdir), as you’ll need it in the next step and type yes and hit
10. Configure Apache¶
Copy the file
/etc/nav/apache/apache.conf and edit the defines inside the copy.
documentrootshould be the path from step 9.
documentation_pathis where Sphinx put the docs, in
nav_uploads_pathis the upload path you created in step 8.
/usr/local/lib/python3.7/dist-packages(or wherever the
navPython module was installed)
We suggest creating a new Apache site config:
<VirtualHost *:80> ServerName nav.example.org ServerAdmin email@example.com Include /etc/nav/apache/apache.conf </VirtualHost>
You should, of course, replace
nav.example.org with a DNS name that your
server can actually be reached under.
Then, disable the default Apache site, enable the
nav site, and enable
mod_wsgi, before restarting Apache:
a2dissite 000-default a2ensite nav a2enmod wsgi systemctl reload apache2
You should now be able to browse the NAV web interface.
You should always protect your NAV web site using SSL!
11. Installing and configuring Graphite¶
NAV uses Graphite to store and retrieve time-series data. If you do not already have a Graphite installation you wish to integrate with NAV, here is a separate guide on how to install and use Graphite with NAV on your Debian system.