diff --git a/docs/centos.md b/docs/centos.md index 2d01cb76c..871e017ff 100644 --- a/docs/centos.md +++ b/docs/centos.md @@ -1,4 +1,4 @@ -

Getting started on RHEL/Centos OS( DRAFT STILL IN THE WORKS)

+

Getting started on RHEL/Centos OS

This guide documents the process of installing NetBox on RHEL/Centos 7 with [nginx](https://www.nginx.com/) and [gunicorn](http://gunicorn.org/). @@ -8,37 +8,51 @@ CENTOS 7 - Centos 6 is similar, but slightly different # PostgreSQL + Install postgresql repository +# yum localinstall https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm -# Install postgresql repository -yum localinstall https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm - -# Install posgresql +This packages are necessary to Install postgresql +``` yum install postgresql95-server postgresql95-devel python-psycopg2 -y -# Enable the service +``` + +Enable the service +``` systemctl enable postgresql-9.5 -# Initialize the database +``` + +Initialize the database +``` /usr/pgsql-9.5/bin/postgresql95-setup initdb - -# Allow password login for users - +``` +Allow password login for users +``` sed -i -e 's/ident/md5/' /var/lib/pgsql/9.5/data/pg_hba.conf -# Start the service -service postgresql-9.5 start +``` -# Create our user/database +Start the service +``` +service postgresql-9.5 start +``` + +Create our user/database +``` sudo -u postgres psql < /etc/yum.repos.d/nginx.repo +``` +Install nginx gunicorn and supervisor +``` yum install -y nginx python-gunicorn supervisor +``` -# nginx: +Use this Nginx configuration: + ``` echo 'server { listen 80; @@ -83,21 +106,29 @@ echo 'server { } }' > /etc/nginx/conf.d/netbox.conf rm /etc/nginx/conf.d/default - -# Creater a user to run netbox services +``` +Creater a user to run netbox services +``` useradd -M netbox - -# Gunicorn config +``` +``` +Gunicorn configuration echo "command = '/usr/bin/gunicorn' pythonpath = '/opt/netbox/netbox' bind = '0.0.0.0:8001' workers = 3 user = 'netbox'" > /opt/netbox/gunicorn_config.py - -# supervisor config +``` +Supervisor configuration +``` echo "[program:netbox] command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi directory = /opt/netbox/netbox/ user = netbox" >> /etc/supervisord.conf +``` +Restart the services to it takes the changes +``` service nginx restart +``` service supervisord restart +```