diff --git a/docs/installation/docker.md b/docs/installation/docker.md index 25f12fe7f..00551a096 100644 --- a/docs/installation/docker.md +++ b/docs/installation/docker.md @@ -4,7 +4,7 @@ This guide demonstrates how to build and run NetBox as a Docker container. It as To get NetBox up and running: -```shell +```no-highlight # git clone -b master https://github.com/digitalocean/netbox.git # cd netbox # docker-compose up -d diff --git a/docs/installation/ldap.md b/docs/installation/ldap.md index 2389464e7..6a4994a5c 100644 --- a/docs/installation/ldap.md +++ b/docs/installation/ldap.md @@ -7,19 +7,19 @@ built-in Django users in the event of a failure. On Ubuntu: -```shell +```no-highlight sudo apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev ``` On CentOS: -```shell +```no-highlight sudo yum install -y python-devel openldap-devel ``` ## Install django-auth-ldap -```shell +```no-highlight sudo pip install django-auth-ldap ``` diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index 5040a27dc..bb2297d96 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -8,7 +8,7 @@ **CentOS/RHEL** -```shell +```no-highlight # yum install -y epel-release # yum install -y gcc python2 python-devel python-pip libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel ``` @@ -19,7 +19,7 @@ You may opt to install NetBox either from a numbered release or by cloning the m Download the [latest stable release](https://github.com/digitalocean/netbox/releases) from GitHub as a tarball or ZIP archive and extract it to your desired path. In this example, we'll use `/opt/netbox`. -```shell +```no-highlight # wget https://github.com/digitalocean/netbox/archive/vX.Y.Z.tar.gz # tar -xzf vX.Y.Z.tar.gz -C /opt # cd /opt/ @@ -31,7 +31,7 @@ Download the [latest stable release](https://github.com/digitalocean/netbox/rele Create the base directory for the NetBox installation. For this guide, we'll use `/opt/netbox`. -```shell +```no-highlight # mkdir -p /opt/netbox/ && cd /opt/netbox/ ``` @@ -39,19 +39,19 @@ If `git` is not already installed, install it: **Debian/Ubuntu** -```shell +```no-highlight # apt-get install -y git ``` **CentOS/RHEL** -```shell +```no-highlight # yum install -y git ``` Next, clone the **master** branch of the NetBox GitHub repository into the current directory: -```shell +```no-highlight # git clone -b master https://github.com/digitalocean/netbox.git . Cloning into '.'... remote: Counting objects: 1994, done. @@ -66,7 +66,7 @@ Checking connectivity... done. Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.) -```shell +```no-highlight # pip install -r requirements.txt ``` @@ -74,7 +74,7 @@ Install the required Python packages using pip. (If you encounter any compilatio Move into the NetBox configuration directory and make a copy of `configuration.example.py` named `configuration.py`. -```shell +```no-highlight # cd netbox/netbox/ # cp configuration.example.py configuration.py ``` @@ -124,7 +124,7 @@ You may use the script located at `netbox/generate_secret_key.py` to generate a Before NetBox can run, we need to install the database schema. This is done by running `./manage.py migrate` from the `netbox` directory (`/opt/netbox/netbox/` in our example): -```shell +```no-highlight # cd /opt/netbox/netbox/ # ./manage.py migrate Operations to perform: @@ -143,7 +143,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: -```shell +```no-highlight # ./manage.py createsuperuser Username: admin Email address: admin@example.com @@ -154,7 +154,7 @@ Superuser created successfully. # Collect Static Files -```shell +```no-highlight # ./manage.py collectstatic You have requested to collect static files at the destination @@ -175,7 +175,7 @@ NetBox ships with some initial data to help you get started: RIR definitions, co !!! note 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. -```shell +```no-highlight # ./manage.py loaddata initial_data Installed 43 object(s) from 4 fixture(s) ``` @@ -184,7 +184,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: -```shell +```no-highlight # ./manage.py runserver 0.0.0.0:8000 --insecure Performing system checks... diff --git a/docs/installation/postgresql.md b/docs/installation/postgresql.md index 71b62c7cc..e1d9a49ea 100644 --- a/docs/installation/postgresql.md +++ b/docs/installation/postgresql.md @@ -4,27 +4,27 @@ NetBox requires a PostgreSQL database to store data. MySQL is not supported, as **Debian/Ubuntu** -```shell +```no-highlight # apt-get install -y postgresql libpq-dev python-psycopg2 ``` **CentOS/RHEL** -```shell +```no-highlight # yum install -y postgresql postgresql-server postgresql-devel python-psycopg2 # postgresql-setup initdb ``` If using CentOS, 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: -```text +```no-highlight host all all 127.0.0.1/32 md5 host all all ::1/128 md5 ``` Then, start the service: -```shell +```no-highlight # systemctl start postgresql ``` @@ -35,7 +35,7 @@ At a minimum, we need to create a database for NetBox and assign it a username a !!! danger DO NOT USE THE PASSWORD FROM THE EXAMPLE. -```shell +```no-highlight # sudo -u postgres psql psql (9.3.13) Type "help" for help. @@ -51,7 +51,7 @@ postgres=# \q You can verify that authentication works issuing the following command and providing the configured password: -```shell +```no-highlight # psql -U netbox -h localhost -W ``` diff --git a/docs/installation/upgrading.md b/docs/installation/upgrading.md index 0d28b4eb2..afb36f464 100644 --- a/docs/installation/upgrading.md +++ b/docs/installation/upgrading.md @@ -8,7 +8,7 @@ Download the [latest stable release](https://github.com/digitalocean/netbox/rele Download and extract the latest version: -```shell +```no-highlight # wget https://github.com/digitalocean/netbox/archive/vX.Y.Z.tar.gz # tar -xzf vX.Y.Z.tar.gz -C /opt # cd /opt/ @@ -17,13 +17,13 @@ Download and extract the latest version: Copy the 'configuration.py' you created when first installing to the new version: -```shell +```no-highlight # cp /opt/netbox-X.Y.Z/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/configuration.py ``` If you followed the original installation guide to set up gunicorn, be sure to copy its configuration as well: -```shell +```no-highlight # cp /opt/netbox-X.Y.Z/gunicorn_config.py /opt/netbox/gunicorn_config.py ``` @@ -31,7 +31,7 @@ If you followed the original installation guide to set up gunicorn, be sure to c This guide assumes that NetBox is installed at `/opt/netbox`. Pull down the most recent iteration of the master branch: -```shell +```no-highlight # cd /opt/netbox # git checkout master # git pull origin master @@ -42,7 +42,7 @@ This guide assumes that NetBox is installed at `/opt/netbox`. Pull down the most Once the new code is in place, run the upgrade script (which may need to be run as root depending on how your environment is configured). -```shell +```no-highlight # ./upgrade.sh ``` @@ -56,6 +56,6 @@ This script: Finally, restart the WSGI service to run the new code. If you followed this guide for the initial installation, this is done using `supervisorctl`: -```shell +```no-highlight # sudo supervisorctl restart netbox ``` diff --git a/docs/installation/web-server.md b/docs/installation/web-server.md index 35a5e8c5d..10cc4992f 100644 --- a/docs/installation/web-server.md +++ b/docs/installation/web-server.md @@ -5,7 +5,7 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for !!! info Only Debian/Ubuntu instructions are provided here, but the installation process for CentOS/RHEL does not differ much. Please consult the documentation for those distributions for details. -```shell +```no-highlight # apt-get install -y gunicorn supervisor ``` @@ -13,7 +13,7 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately. -```shell +```no-highlight # apt-get install -y nginx ``` @@ -43,7 +43,7 @@ server { Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sites-enabled` directory to the configuration file you just created. -```shell +```no-highlight # cd /etc/nginx/sites-enabled/ # rm default # ln -s /etc/nginx/sites-available/netbox @@ -51,7 +51,7 @@ Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sit Restart the nginx service to use the new configuration. -```shell +```no-highlight # service nginx restart ``` @@ -59,7 +59,7 @@ To enable SSL, consider this guide on [securing nginx with Let's Encrypt](https: ## Option B: Apache -```shell +```no-highlight # apt-get install -y apache2 ``` @@ -90,7 +90,7 @@ Once Apache is installed, proceed with the following configuration (Be sure to m Save the contents of the above example in `/etc/apache2/sites-available/netbox.conf`, enable the `proxy` and `proxy_http` modules, and reload Apache: -```shell +```no-highlight # a2enmod proxy # a2enmod proxy_http # a2ensite netbox @@ -103,7 +103,7 @@ To enable SSL, consider this guide on [securing Apache with Let's Encrypt](https Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using CentOS/RHEL change the username from `www-data` to `nginx` or `apache`. -```text +```no-highlight command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '127.0.0.1:8001' @@ -115,7 +115,7 @@ user = 'www-data' Save the following as `/etc/supervisor/conf.d/netbox.conf`. Update the `command` and `directory` paths as needed. -```text +```no-highlight [program:netbox] command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi directory = /opt/netbox/netbox/ @@ -124,7 +124,7 @@ user = www-data Then, restart the supervisor service to detect and run the gunicorn service: -```shell +```no-highlight # service supervisor restart ```