Skip to content

Commit 6f23ab5

Browse files
committed
Better copy/paste support for installation docs
1 parent 5e67627 commit 6f23ab5

File tree

4 files changed

+50
-45
lines changed

4 files changed

+50
-45
lines changed

docs/installation/1-postgresql.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,28 @@ sudo systemctl enable postgresql
4040

4141
## Database Creation
4242

43-
At a minimum, we need to create a database for NetBox and assign it a username and password for authentication. This is done with the following commands.
44-
45-
!!! danger
46-
**Do not use the password from the example.** Choose a strong, random password to ensure secure database authentication for your NetBox installation.
43+
At a minimum, we need to create a database for NetBox and assign it a username and password for authentication. Start by invoking the PostgreSQL shell as the system Postgres user.
4744

4845
```no-highlight
49-
$ sudo -u postgres psql
50-
psql (12.5 (Ubuntu 12.5-0ubuntu0.20.04.1))
51-
Type "help" for help.
46+
sudo -u postgres psql
47+
```
5248

53-
postgres=# CREATE DATABASE netbox;
54-
CREATE DATABASE
55-
postgres=# CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
56-
CREATE ROLE
57-
postgres=# GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
58-
GRANT
59-
postgres=# \q
49+
Within the shell, enter the following commands to create the database and user (role), substituting your own value for the password:
50+
51+
```postgresql
52+
CREATE DATABASE netbox;
53+
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
54+
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
6055
```
6156

57+
!!! danger
58+
**Do not use the password from the example.** Choose a strong, random password to ensure secure database authentication for your NetBox installation.
59+
60+
Once complete, enter `\q` to exit the PostgreSQL shell.
61+
6262
## Verify Service Status
6363

64-
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.)
64+
You can verify that authentication works by executing the `psql` command and passing the configured username and password. (Replace `localhost` with your database server if using a remote database.)
6565

6666
```no-highlight
6767
$ psql --username netbox --password --host localhost netbox

docs/installation/2-redis.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ You may wish to modify the Redis configuration at `/etc/redis.conf` or `/etc/red
2828
Use the `redis-cli` utility to ensure the Redis service is functional:
2929

3030
```no-highlight
31-
$ redis-cli ping
32-
PONG
31+
redis-cli ping
3332
```
33+
34+
If successful, you should receive a `PONG` response from the server.

docs/installation/3-netbox.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,21 @@ This documentation provides two options for installing NetBox: from a downloadab
3636
Download the [latest stable release](https://github.com/netbox-community/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` as the NetBox root.
3737

3838
```no-highlight
39-
$ sudo wget https://github.com/netbox-community/netbox/archive/vX.Y.Z.tar.gz
40-
$ sudo tar -xzf vX.Y.Z.tar.gz -C /opt
41-
$ sudo ln -s /opt/netbox-X.Y.Z/ /opt/netbox
42-
$ ls -l /opt | grep netbox
43-
lrwxrwxrwx 1 root root 13 Jul 20 13:44 netbox -> netbox-2.9.0/
44-
drwxr-xr-x 2 root root 4096 Jul 20 13:44 netbox-2.9.0
39+
sudo wget https://github.com/netbox-community/netbox/archive/vX.Y.Z.tar.gz
40+
sudo tar -xzf vX.Y.Z.tar.gz -C /opt
41+
sudo ln -s /opt/netbox-X.Y.Z/ /opt/netbox
4542
```
4643

4744
!!! note
48-
It is recommended to install NetBox in a directory named for its version number. For example, NetBox v2.9.0 would be installed into `/opt/netbox-2.9.0`, and a symlink from `/opt/netbox/` would point to this location. This allows for future releases to be installed in parallel without interrupting the current installation. When changing to the new release, only the symlink needs to be updated.
45+
It is recommended to install NetBox in a directory named for its version number. For example, NetBox v3.0.0 would be installed into `/opt/netbox-3.0.0`, and a symlink from `/opt/netbox/` would point to this location. (You can verify this configuration with the command `ls -l /opt | grep netbox`.) This allows for future releases to be installed in parallel without interrupting the current installation. When changing to the new release, only the symlink needs to be updated.
4946

5047
### Option B: Clone the Git Repository
5148

5249
Create the base directory for the NetBox installation. For this guide, we'll use `/opt/netbox`.
5350

5451
```no-highlight
55-
sudo mkdir -p /opt/netbox/ && cd /opt/netbox/
52+
sudo mkdir -p /opt/netbox/
53+
cd /opt/netbox/
5654
```
5755

5856
If `git` is not already installed, install it:
@@ -75,7 +73,7 @@ Next, clone the **master** branch of the NetBox GitHub repository into the curre
7573
sudo git clone -b master https://github.com/netbox-community/netbox.git .
7674
```
7775

78-
The screen below should be the result:
76+
The `git clone` command should generate output similar to the following:
7977

8078
```
8179
Cloning into '.'...
@@ -250,13 +248,8 @@ Once the virtual environment has been activated, you should notice the string `(
250248
Next, we'll create a superuser account using the `createsuperuser` Django management command (via `manage.py`). Specifying an email address for the user is not required, but be sure to use a very strong password.
251249

252250
```no-highlight
253-
(venv) $ cd /opt/netbox/netbox
254-
(venv) $ python3 manage.py createsuperuser
255-
Username: admin
256-
Email address: [email protected]
257-
Password:
258-
Password (again):
259-
Superuser created successfully.
251+
cd /opt/netbox/netbox
252+
python3 manage.py createsuperuser
260253
```
261254

262255
## Schedule the Housekeeping Task
@@ -276,13 +269,19 @@ See the [housekeeping documentation](../administration/housekeeping.md) for furt
276269
At this point, we should be able to run NetBox's development server for testing. We can check by starting a development instance:
277270

278271
```no-highlight
279-
(venv) $ python3 manage.py runserver 0.0.0.0:8000 --insecure
272+
python3 manage.py runserver 0.0.0.0:8000 --insecure
273+
```
274+
275+
If successful, you should see output similar to the following:
276+
277+
```no-highlight
278+
Watching for file changes with StatReloader
280279
Performing system checks...
281280
282281
System check identified no issues (0 silenced).
283-
November 17, 2020 - 16:08:13
284-
Django version 3.1.3, using settings 'netbox.settings'
285-
Starting development server at http://0.0.0.0:8000/
282+
August 30, 2021 - 18:02:23
283+
Django version 3.2.6, using settings 'netbox.settings'
284+
Starting development server at http://127.0.0.1:8000/
286285
Quit the server with CONTROL-C.
287286
```
288287

docs/installation/4-gunicorn.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,23 @@ sudo systemctl enable netbox netbox-rq
3131
You can use the command `systemctl status netbox` to verify that the WSGI service is running:
3232

3333
```no-highlight
34-
# systemctl status netbox.service
34+
systemctl status netbox.service
35+
```
36+
37+
You should see output similar to the following:
38+
39+
```no-highlight
3540
● netbox.service - NetBox WSGI Service
3641
Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: enabled)
37-
Active: active (running) since Tue 2020-11-17 16:18:23 UTC; 3min 35s ago
42+
Active: active (running) since Mon 2021-08-30 04:02:36 UTC; 14h ago
3843
Docs: https://netbox.readthedocs.io/en/stable/
39-
Main PID: 22836 (gunicorn)
40-
Tasks: 6 (limit: 2345)
41-
Memory: 339.3M
44+
Main PID: 1140492 (gunicorn)
45+
Tasks: 19 (limit: 4683)
46+
Memory: 666.2M
4247
CGroup: /system.slice/netbox.service
43-
├─22836 /opt/netbox/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid>
44-
├─22854 /opt/netbox/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid>
45-
├─22855 /opt/netbox/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid>
48+
├─1140492 /opt/netbox/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /va>
49+
├─1140513 /opt/netbox/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /va>
50+
├─1140514 /opt/netbox/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /va>
4651
...
4752
```
4853

0 commit comments

Comments
 (0)