mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Fixed the typos and formatting on the Centos Doc
This commit is contained in:
parent
4e1eef28e9
commit
02342af25c
@ -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/).
|
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
|
# 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
|
This packages are necessary to Install postgresql
|
||||||
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
|
|
||||||
yum install postgresql95-server postgresql95-devel python-psycopg2 -y
|
yum install postgresql95-server postgresql95-devel python-psycopg2 -y
|
||||||
# Enable the service
|
```
|
||||||
|
|
||||||
|
Enable the service
|
||||||
|
```
|
||||||
systemctl enable postgresql-9.5
|
systemctl enable postgresql-9.5
|
||||||
# Initialize the database
|
```
|
||||||
|
|
||||||
|
Initialize the database
|
||||||
|
```
|
||||||
/usr/pgsql-9.5/bin/postgresql95-setup initdb
|
/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
|
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
|
sudo -u postgres psql <<EOL
|
||||||
CREATE DATABASE netbox;
|
CREATE DATABASE netbox;
|
||||||
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
|
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
|
||||||
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
|
GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;
|
||||||
\q
|
\q
|
||||||
EOL
|
EOL
|
||||||
|
```
|
||||||
# Install required RPM's
|
Install required RPM's
|
||||||
|
```
|
||||||
yum install epel-release
|
yum install epel-release
|
||||||
yum install -y gcc openssl-devel python python-dev git python-pip libxml2-devel libxslt-devel libffi-devel graphviz
|
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
|
mkdir -p /opt/netbox
|
||||||
cd /opt/netbox
|
cd /opt/netbox
|
||||||
git clone -b master https://github.com/digitalocean/netbox.git .
|
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
|
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 migrate
|
||||||
python2.7 /opt/netbox/netbox/manage.py collectstatic
|
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]
|
echo "[nginx]
|
||||||
name=nginx repo
|
name=nginx repo
|
||||||
baseurl=http://nginx.org/packages/centos/7/$basearch/
|
baseurl=http://nginx.org/packages/centos/7/$basearch/
|
||||||
gpgcheck=0
|
gpgcheck=0
|
||||||
enabled=1" > /etc/yum.repos.d/nginx.repo
|
enabled=1" > /etc/yum.repos.d/nginx.repo
|
||||||
|
```
|
||||||
|
|
||||||
|
Install nginx gunicorn and supervisor
|
||||||
|
```
|
||||||
yum install -y nginx python-gunicorn supervisor
|
yum install -y nginx python-gunicorn supervisor
|
||||||
|
```
|
||||||
|
|
||||||
# nginx:
|
Use this Nginx configuration:
|
||||||
|
```
|
||||||
echo 'server {
|
echo 'server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
@ -83,21 +106,29 @@ echo 'server {
|
|||||||
}
|
}
|
||||||
}' > /etc/nginx/conf.d/netbox.conf
|
}' > /etc/nginx/conf.d/netbox.conf
|
||||||
rm /etc/nginx/conf.d/default
|
rm /etc/nginx/conf.d/default
|
||||||
|
```
|
||||||
# Creater a user to run netbox services
|
Creater a user to run netbox services
|
||||||
|
```
|
||||||
useradd -M netbox
|
useradd -M netbox
|
||||||
|
```
|
||||||
# Gunicorn config
|
```
|
||||||
|
Gunicorn configuration
|
||||||
echo "command = '/usr/bin/gunicorn'
|
echo "command = '/usr/bin/gunicorn'
|
||||||
pythonpath = '/opt/netbox/netbox'
|
pythonpath = '/opt/netbox/netbox'
|
||||||
bind = '0.0.0.0:8001'
|
bind = '0.0.0.0:8001'
|
||||||
workers = 3
|
workers = 3
|
||||||
user = 'netbox'" > /opt/netbox/gunicorn_config.py
|
user = 'netbox'" > /opt/netbox/gunicorn_config.py
|
||||||
|
```
|
||||||
# supervisor config
|
Supervisor configuration
|
||||||
|
```
|
||||||
echo "[program:netbox]
|
echo "[program:netbox]
|
||||||
command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
|
command = gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
|
||||||
directory = /opt/netbox/netbox/
|
directory = /opt/netbox/netbox/
|
||||||
user = netbox" >> /etc/supervisord.conf
|
user = netbox" >> /etc/supervisord.conf
|
||||||
|
```
|
||||||
|
Restart the services to it takes the changes
|
||||||
|
```
|
||||||
service nginx restart
|
service nginx restart
|
||||||
|
```
|
||||||
service supervisord restart
|
service supervisord restart
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user