NetWork
网络管理工具
PacketFence
QSFP
如何登录 华为 DeviceManager?
服务器 / 存储设备管理
ZeroTier
获取网卡UUID
net-tools 和 iproute2
H3C交换机的基本配置
Netbox --- IPAM 管理工具
Zabbix
phpIPAM
port mode
Link Aggregation
Cisco HSRP
Huawei VRRP
H3C IRF
EVE-NG
eNSP
本文档使用 MrDoc 发布
-
+
home page
Netbox --- IPAM 管理工具
[TOC] # PostgreSQL数据库安装 ##1.yum 下载安装 ``` # yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm # yum install -y postgresql96 postgresql96-server postgresql96-devel # /usr/pgsql-9.6/bin/postgresql96-setup initdb Initializing database ... OK # ``` ##2.修改配置 ``` # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident ``` 修改文件/var/lib/pgsql/9.6/data/pg_hba.conf中ident为md5 ``` # vim /var/lib/pgsql/9.6/data/pg_hba.conf ...... # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 ``` ``` #listen_addresses = 'localhost' # what IP address(es) to listen on; ``` 修改listen_addresses参数/var/lib/pgsql/9.6/data/postgresql.conf ``` # /var/lib/pgsql/9.6/data/postgresql.conf listen_addresses = '10.249.104.83' # what IP address(es) to listen on; ``` ##3.启动服务 systemctl start postgresql-9.6 systemctl enable postgresql-9.6 ##4.创建数据库 ``` # sudo -u postgres psql could not change directory to "/root": Permission denied psql (9.6.18) Type "help" for help. * 创建数据库 postgres=# CREATE DATABASE netbox; CREATE DATABASE * 创建用户 postgres=# CREATE USER netbox WITH PASSWORD 'Admin123'; CREATE ROLE * 授权 postgres=# GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox; GRANT postgres=# \q # ``` ##5.验证状态 psql -U netbox -W -h 10.44.196.30 netbox ``` # psql -U netbox -W -h localhost netbox Password for user netbox: psql (9.6.18) Type "help" for help. netbox=> netbox-> \dS List of relations Schema | Name | Type | Owner ------------+---------------------------------+-------+---------- pg_catalog | pg_aggregate | table | postgres pg_catalog | pg_am | table | postgres pg_catalog | pg_amop | table | postgres ...... ``` #Redis安装 ##1.yum安装 ``` # yum install -y epel-release # yum install -y redis # systemctl start redis # systemctl enable redis ``` #2.验证状态 ``` #redis-cli ping PONG ``` #NetBox安装 ##1.依赖环境安装 ``` # yum install -y gcc python36 python36-devel python36-setuptools libxml2-devel libxslt-devel libffi-devel openssl-devel redhat-rpm-config # easy_install-3.6 pip Searching for pip Best match: pip 9.0.3 Adding pip 9.0.3 to easy-install.pth file Installing pip script to /usr/local/bin Installing pip3 script to /usr/local/bin Installing pip3.6 script to /usr/local/bin Using /usr/lib/python3.6/site-packages Processing dependencies for pip Finished processing dependencies for pip # ``` ##2.克隆git仓库 ``` # mkdir -p /opt/netbox/ && cd /opt/netbox/ # yum install -y git # git clone -b master https://github.com/netbox-community/netbox.git . Cloning into '.'... remote: Enumerating objects: 221, done. remote: Counting objects: 100% (221/221), done. remote: Compressing objects: 100% (160/160), done. remote: Total 49913 (delta 112), reused 120 (delta 61), pack-reused 49692 Receiving objects: 100% (49913/49913), 21.28 MiB | 162.00 KiB/s, done. Resolving deltas: 100% (39669/39669), done. # 或者 # https://github.com/netbox-community/netbox/archive/v2.6.0.tar.gz ``` ##3.创建用户(centos需要先建组) ``` # groupadd netbox # adduser -r netbox -g netbox #chown --recursive netbox /opt/netbox/netbox/media/ ``` ##4.设置python环境 ``` # python3 -m venv /opt/netbox/venv # source venv/bin/activate # pip3 install -r requirements.txt ``` **使用国内源** ``` pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple ``` ##5.配置文件设置 ``` cd netbox/netbox/ cp configuration.example.py configuration.py ``` ##6.编辑configuration.py文件,设置可访问主机 ``` ALLOWED_HOSTS = [‘127.0.0.1’] ``` 如果全可以访问就填入* **ALLOWED_HOSTS = [‘*’]** 至少包含50个字母数字字符的随机密钥 ``` # cd /opt/netbox/netbox # ./generate_secret_key.py Y7yWCElz0dh%r*R)3q8GL+_jI4s#(SpO^mxVFJAu=ci&TwU@e9 56 SECRET_KEY = 'Y7yWCElz0dh%r*R)3q8GL+_jI4s#(SpO^mxVFJAu=ci&TwU@e9' ``` ``` # Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local'] ALLOWED_HOSTS = ['*'] # PostgreSQL database configuration. See the Django documentation for a complete list of available parameters: # https://docs.djangoproject.com/en/stable/ref/settings/#databases DATABASE = { 'NAME': 'netbox', # Database name 'USER': 'netbox', # PostgreSQL username 'PASSWORD': '123456', # PostgreSQL password 'HOST': '10.44.196.30', # Database server 'PORT': '', # Database port (leave blank for default) 'CONN_MAX_AGE': 300, # Max database connection age } ``` ##7.数据库迁移 ``` # cd /opt/netbox/netbox/ # python3 manage.py migrate ``` ## 8.管理员用户创建 ``` # cd /opt/netbox/netbox/ (venv) # python3 manage.py createsuperuser Username (leave blank to use 'root'): admin Email address: admin@example.com Password: Password (again): Superuser created successfully. # (venv) # python3 manage.py collectstatic --no-input 976 static files copied to '/opt/netbox/netbox/static'. (venv) # ``` ##9.启动程序 ``` (venv) # python3 manage.py runserver 0.0.0.0:8000 --insecure Performing system checks... System check identified no issues (0 silenced). August 10, 2020 - 07:48:14 Django version 3.0.9, using settings 'netbox.settings' Starting development server at http://0.0.0.0:8000/ Quit the server with CONTROL-C. ``` ##10.应用测试 本地访问可以通过 http://localhost:8000/ 
Seven
Sept. 30, 2020, 8:55 a.m.
转发文档
Collection documents
Last
Next
手机扫码
Copy link
手机扫一扫转发分享
Copy link
Markdown文件
share
link
type
password
Update password