nautobot初試

以下是安裝步驟

#python redis git
$ sudo apt update -y
$ sudo apt install -y git python3 python3-pip python3-venv python3-dev redis-server

#mysql
$ sudo apt install -y libmysqlclient-dev mysql-server
$ sudo -u root mysql
mysql> CREATE DATABASE nautobot;
mysql> CREATE USER 'nautobot'@'localhost' IDENTIFIED BY 'd3qvcRNZW29gqV0w';
mysql> GRANT ALL ON nautobot.* TO 'nautobot'@'localhost';
mysql> \q

# check password
$ mysql --user nautobot --password --host localhost nautobot
Enter password:
mysql> status
mysql> \q

# check redis
$ redis-cli ping
PONG

# create user nautobot and set NAUTOBOT_ROOT
$ sudo useradd --system --shell /bin/bash --create-home --home-dir /opt/nautobot nautobot
# set python venv
$ sudo -u nautobot python3 -m venv /opt/nautobot
# update .bashrc
$ echo "export NAUTOBOT_ROOT=/opt/nautobot" | sudo tee -a ~nautobot/.bashrc
# sudo to nautobot
$ sudo -iu nautobot
$ echo $NAUTOBOT_ROOT
/opt/nautobot
$ which pip3
/opt/nautobot/bin/pip3
$ pip3 install --upgrade pip wheel
# install nautobot
$ pip3 install nautobot[mysql]
# 驗證安裝
$ nautobot-server --version
1.1.2
# 配置
$ nautobot-server init
Configuration file created at '/opt/nautobot/nautobot_config.py'
以下至少要配置
ALLOWED_HOSTS [*]
DATABASES
REDIS由於在本機安裝不需要修改
# Configuring NAPALM
$ echo napalm >> $NAUTOBOT_ROOT/local_requirements.txt
$ echo django-storages >> $NAUTOBOT_ROOT/local_requirements.txt
# Prepare the Database
$ nautobot-server migrate
# Create a Superuser
$ nautobot-server createsuperuser
Username: admin
Email address: [email protected]
Password: 
Password (again): 
Superuser created successfully.
$ nautobot-server collectstatic
$ pip3 install -r /opt/nautobot/local_requirements.txt
# Check your Configuration
$ nautobot-server check
# test
$ nautobot-server runserver 0.0.0.0:8080 --insecure

登錄以後如下所示

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章