Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- yum install epel-release -y
- yum update -y
- setenforce 0
- sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
- yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm -y
- yum install postgresql96 postgresql96-server postgresql96-devel -y
- /usr/pgsql-9.6/bin/postgresql96-setup initdb
- sed -i -e 's/ident/md5/' /var/lib/pgsql/9.6/data/pg_hba.conf
- systemctl start postgresql-9.6
- systemctl enable postgresql-9.6
- sudo -u postgres psql
- CREATE DATABASE netbox;
- CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
- GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
- \q
- psql -U netbox -h localhost -W
- yum -y install yum-utils
- yum -y install https://centos7.iuscommunity.org/ius-release.rpm
- yum install -y gcc wget httpd httpd-devel python36 python36-devel python36-setuptools libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel redhat-rpm-config redis
- easy_install-3.6 pip
- ln -s /usr/bin/python3.6 /usr/bin/python3
- systemctl enable redis
- systemctl start redis
- systemctl start httpd
- systemctl enable httpd
- wget https://github.com/netbox-community/netbox/archive/v2.6.2.tar.gz
- tar -xzf v2.6.2.tar.gz -C /opt/
- cd /opt/
- ln -s netbox-2.6.2/ netbox
- cd /opt/netbox/
- pip3 install -r requirements.txt
- pip3 install napalm
- cd netbox
- ./generate_secret_key.py
- cd netbox
- cp configuration.example.py configuration.py
- configuration.py
- ALLOWED_HOSTS = ['netbox.demo.com', '192.16.111.132','127.0.0.1']
- cd /opt/netbox/netbox/
- python3 manage.py migrate
- python3 manage.py createsuperuser
- python3 manage.py collectstatic --no-input
- python3 manage.py loaddata initial_data
- python3 manage.py runserver 0.0.0.0:8000 --insecure
- vi /etc/httpd/conf.d/netbox.conf
- <VirtualHost *:80>
- ProxyPreserveHost On
- ServerName netbox.demo.com
- Alias /static /opt/netbox/netbox/static
- # Needed to allow token-based API authentication
- <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>
- pip3 install gunicorn
- vi /opt/netbox/gunicorn_config.py
- command = '/usr/bin/gunicorn'
- pythonpath = '/opt/netbox/netbox'
- bind = '127.0.0.1:8001'
- workers = 3
- user = 'apache'
- yum install -y supervisor
- vi /etc/supervisord.d/netbox.ini
- [program:netbox]
- command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
- directory = /opt/netbox/netbox/
- user = apache
- [program:netbox-rqworker]
- command = python3 /opt/netbox/netbox/manage.py rqworker
- directory = /opt/netbox/netbox/
- user = apache
- systemctl start supervisord
- systemctl enable supervisord
- firewall-cmd --add-port=8085/tcp --permanent
- firewall-cmd --add-port=80/tcp --permanent
- firewall-cmd --add-port=443/tcp --permanent
- firewall-cmd --add-port=6379/tcp --permanent
- firewall-cmd --add-port=5432/tcp --permanent
- firewall-cmd --reload
- systemctl restart httpd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement