Fixed the typos and formatting on the Centos Doc

This commit is contained in:
Chagara 2016-07-07 18:01:14 -04:00
parent 4e1eef28e9
commit 02342af25c

View File

@ -1,4 +1,4 @@
<h1>Getting started on RHEL/Centos OS( DRAFT STILL IN THE WORKS)</h1>
<h1>Getting started on RHEL/Centos OS</h1>
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 <<EOL
CREATE DATABASE netbox;
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
\q
EOL
# Install required RPM's
```
Install required RPM's
```
yum install epel-release
yum install -y gcc openssl-devel python python-dev git python-pip libxml2-devel libxslt-devel libffi-devel graphviz
```
# Either choose to clone or pull stable.
# Git clone the repo
```
mkdir -p /opt/netbox
cd /opt/netbox
git clone -b master https://github.com/digitalocean/netbox.git .
@ -50,19 +64,28 @@ key=`python2.7 /opt/netbox/netbox/generate_secret_key.py`
sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = '$key'/" /opt/netbox/netbox/netbox/configuration.py
python2.7 /opt/netbox/netbox/manage.py migrate
python2.7 /opt/netbox/netbox/manage.py collectstatic
# You should probably createsuperuser too, but django doesn't like heredocs
# You can also test your install at this point using python2.7 manage.py runserver 0.0.0.0:8080
```
Test the application to make sure it starts
```
python2.7 manage.py runserver 0.0.0.0:8080
```
# Latest Nginx is better
Use the latest NGINX
```
echo "[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1" > /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
```