NetBox
NetBox is an open source web application designed to help manage and document computer networks
install
- 必要なパッケージをインストール
$ sudo apt-get install -y python3 python3-dev python3-setuptools build-essential libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev zlib1g-dev $ wget https://bootstrap.pypa.io/get-pip.py $ sudo python3 get-pip.py
- netbox をダウンロードして展開
$ https://github.com/digitalocean/netbox/archive/v2.2.9.tar.gz $ cd /opt && sudo tar xvf ~/v2.2.9.tar.gz $ sudo ln -s ln -s netbox-2.2.9 netbox $ sudo chown -R netbox:netbox netbox-2.2.9
- pythonパッケージのインストール
$ sudo pip3 install -r requirements.txt $ sudo pip3 install napalm
- 設定ファイル編集
$ cd netbox/netbox $ sudo cp configuration.example.py configuration.py configuration.py編集
- データベース設定とスキーマ設定
$ cd /opt/netbox/netbox $ python3 manage.py migrate
- スーパーユーザの作成
$ python3 manage.py createsuperuser Username (leave blank to use 'root'): admin Email address: admin@localhost Password: Password (again): Superuser created successfully.
- 静的ファイルの収集
$ sudo python3 manage.py collectstatic --no-input
テスト起動
$ python3 manage.py runserver 0.0.0.0:8000 --insecure
Webサーバ(リバースプロキシ)設定
- Apacheインストール
$ sudo apt-get install -y apache2
- /etc/apache2/sites-available/netbox.conf
<VirtualHost *:80> ProxyPreserveHost On ServerName 192.168.1.135 Alias /static /opt/netbox/netbox/static # Needed to allow token-based API authentication WSGIPassAuthorization on <Directory /opt/netbox/netbox/static> Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted </Directory> <Location /static> ProxyPass ! </Location> ProxyPass / http://127.0.0.1:8001/ ProxyPassReverse / http://127.0.0.1:8001/ </VirtualHost>
- リバースプロキシの有効化
$ sudo a2enmod proxy $ sudo a2enmod proxy_http $ sudo a2ensite netbox $ sudo service apache2 restar `` 1. gunucornインストール
pip3 install gunicorn