From 2213e3e0cf4a5687aeadcb2b6a052a1cb4634f12 Mon Sep 17 00:00:00 2001 From: Chagara Date: Fri, 2 Sep 2016 16:38:58 -0400 Subject: [PATCH 01/26] added centos/rhel installation on netbox.md postgresql.md and web-server.md --- docs/installation/netbox.md | 25 ++++++++++++++++++++++--- docs/installation/postgresql.md | 14 ++++++++++++++ docs/installation/web-server.md | 22 ++++++++++++++++++++-- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index b5b96d034..27a9a855d 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -2,6 +2,8 @@ NetBox requires following system dependencies: +Debian/Ubuntu + * python2.7 * python-dev * python-pip @@ -12,9 +14,26 @@ NetBox requires following system dependencies: * libpq-dev * libssl-dev +Centos/RHEL + +* python27 +* python-devel +* git +* python-pip +* libxml2-devel +* libxslt-devel +* libffi-devel +* graphviz +* openssl-devel + +### Debian/Ubuntu ``` # sudo apt-get install -y python2.7 python-dev python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev ``` +## Centos/RHEL +``` +# sudo yum install -y epel-release +# sudo yum install -y python27 python-devel git python-pip libxml2-devel lbxslt-devel libffi-devel graphviz.x_86_64 openssl-devel You may opt to install NetBox either from a numbered release or by cloning the master branch of its repository on GitHub. @@ -76,7 +95,7 @@ Move into the NetBox configuration directory and make a copy of `configuration.e ``` Open `configuration.py` with your preferred editor and set the following variables: - + * ALLOWED_HOSTS * DATABASE * SECRET_KEY @@ -143,8 +162,8 @@ NetBox does not come with any predefined user accounts. You'll need to create a # ./manage.py createsuperuser Username: admin Email address: admin@example.com -Password: -Password (again): +Password: +Password (again): Superuser created successfully. ``` diff --git a/docs/installation/postgresql.md b/docs/installation/postgresql.md index c4ad03b6a..c2eac37ba 100644 --- a/docs/installation/postgresql.md +++ b/docs/installation/postgresql.md @@ -4,13 +4,27 @@ NetBox requires a PostgreSQL database to store data. MySQL is not supported, as The following packages are needed to install PostgreSQL with Python support: +Debian/Ubuntu + * postgresql * libpq-dev * python-psycopg2 +Centos/RHEL + +* postgresql +* postgresql-server +* postgresql-libs +* postgresql-devel + +Debian/Ubuntu ``` # sudo apt-get install -y postgresql libpq-dev python-psycopg2 ``` +Centos/RHEL +``` +# sudo yum install postgresql postgresql-server postgresql-libs postgresql-devel +``` # Configuration diff --git a/docs/installation/web-server.md b/docs/installation/web-server.md index b30e2659c..1853f74a2 100644 --- a/docs/installation/web-server.md +++ b/docs/installation/web-server.md @@ -1,18 +1,29 @@ # Web Server Installation -We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we provide example configurations for both [nginx](https://www.nginx.com/resources/wiki/) and [Apache](http://httpd.apache.org/docs/2.4). (You are of course free to use whichever combination of HTTP and WSGI services you'd like.) We'll also use [supervisord](http://supervisord.org/) to enable service persistence. +We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we provide example configurations for both [nginx](https://www.nginx.com/resources/wiki/) and [Apache](http://httpd.apache.org/docs/2.4). (You are of course free to use whichever combination of HTTP and WSGI services you'd like.) We'll also use [supervisord](http://supervisord.org/) to enable service persistence. +Debian/Ubuntu ``` # sudo apt-get install -y gunicorn supervisor ``` +Centos/RHEL +``` +# sudo yum install -y gunicorn supervisor +``` ## Option A: nginx The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately. +Debian/Ubuntu + ``` # sudo apt-get install -y nginx ``` +Centos/RHEL +``` +# sudo yum install -y nginx +``` Once nginx is installed, proceed with the following configuration: @@ -43,7 +54,7 @@ Save this configuration to `/etc/nginx/sites-available/netbox`. Then, delete `/e ``` # cd /etc/nginx/sites-enabled/ # rm default -# ln -s /etc/nginx/sites-available/netbox +# ln -s /etc/nginx/sites-available/netbox ``` Restart the nginx service to use the new configuration. @@ -57,9 +68,16 @@ To enable SSL, consider this guide on [securing nginx with Let's Encrypt](https: ## Option B: Apache +Debian/Ubuntu + ``` # sudo apt-get install -y apache2 ``` +Centos/RHEL + +``` +# sudo yum install -y httpd +``` Once Apache is installed, proceed with the following configuration (Be sure to modify the `ServerName` appropriately): From af519b93b7c6eefaa599eaa00075b7e51890956f Mon Sep 17 00:00:00 2001 From: Chagara Date: Fri, 2 Sep 2016 16:54:47 -0400 Subject: [PATCH 02/26] added more changes for centos/rhel installation --- docs/installation/netbox.md | 1 + docs/installation/web-server.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index 27a9a855d..51ab09de5 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -62,6 +62,7 @@ If `git` is not already installed, install it: ``` # sudo apt-get install -y git +# sudo yum install -y git ``` Next, clone the **master** branch of the NetBox GitHub repository into the current directory: diff --git a/docs/installation/web-server.md b/docs/installation/web-server.md index 1853f74a2..3e914dd5d 100644 --- a/docs/installation/web-server.md +++ b/docs/installation/web-server.md @@ -117,7 +117,7 @@ To enable SSL, consider this guide on [securing Apache with Let's Encrypt](https # gunicorn Installation -Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. +Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using centos/RHEL use the apache user instead of www-data. ``` command = '/usr/bin/gunicorn' @@ -127,6 +127,7 @@ workers = 3 user = 'www-data' ``` + # supervisord Installation Save the following as `/etc/supervisor/conf.d/netbox.conf`. Update the `command` and `directory` paths as needed. From f8f973dac2fb33b02125f22bed9e11c5b84aad5d Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 21 Sep 2016 11:45:12 -0400 Subject: [PATCH 03/26] Post-release version bump --- netbox/netbox/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index a7de9c47c..ef25ae84f 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -12,7 +12,7 @@ except ImportError: "the documentation.") -VERSION = '1.6.1-r1' +VERSION = '1.6.2-dev' # Import local configuration for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']: From 33694030b70dfc9d404c90f2af2def80eca32832 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 21 Sep 2016 11:57:05 -0400 Subject: [PATCH 04/26] Tweaked ExportTemplate admin display --- netbox/extras/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/extras/admin.py b/netbox/extras/admin.py index 402cd6093..b0d33c189 100644 --- a/netbox/extras/admin.py +++ b/netbox/extras/admin.py @@ -40,7 +40,7 @@ class GraphAdmin(admin.ModelAdmin): @admin.register(ExportTemplate) class ExportTemplateAdmin(admin.ModelAdmin): - list_display = ['content_type', 'name', 'mime_type', 'file_extension'] + list_display = ['name', 'content_type', 'mime_type', 'file_extension'] @admin.register(TopologyMap) From 59c6d5b1ec8d4f7c4ff4498417d5b870799289fc Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 21 Sep 2016 11:58:04 -0400 Subject: [PATCH 05/26] Fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f97d27394..e4ba912a3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ NetBox runs as a web application atop the [Django](https://www.djangoproject.com The complete documentation for Netbox can be found at [Read the Docs](http://netbox.readthedocs.io/en/latest/). -Questions? Comments? Please subscribe to [the netbox-disucss mailing list](https://groups.google.com/forum/#!forum/netbox-discuss), or join us on IRC in **#netbox** on **irc.freenode.net**! +Questions? Comments? Please subscribe to [the netbox-discuss mailing list](https://groups.google.com/forum/#!forum/netbox-discuss), or join us on IRC in **#netbox** on **irc.freenode.net**! ### Build Status From fde24258e3fe6d9606038552d8aaa575da04ed8a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 22 Sep 2016 10:06:59 -0400 Subject: [PATCH 06/26] Fixes #571: Correct rack group filter on device list --- netbox/dcim/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 01fd8abb4..b65916267 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -593,7 +593,7 @@ class DeviceBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm): class DeviceFilterForm(BootstrapMixin, CustomFieldFilterForm): model = Device site = FilterChoiceField(queryset=Site.objects.annotate(filter_count=Count('racks__devices')), to_field_name='slug') - rack_group_id = FilterChoiceField(queryset=Site.objects.annotate(filter_count=Count('racks__devices')), + rack_group_id = FilterChoiceField(queryset=RackGroup.objects.annotate(filter_count=Count('racks__devices')), label='Rack Group') role = FilterChoiceField(queryset=DeviceRole.objects.annotate(filter_count=Count('devices')), to_field_name='slug') tenant = FilterChoiceField(queryset=Tenant.objects.annotate(filter_count=Count('devices')), to_field_name='slug', From 0001bbc96625ddd0fd8c0f7f0bf2f3d6e1f54ab3 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 26 Sep 2016 12:50:44 -0400 Subject: [PATCH 07/26] #447: Correcting CentOS installation docs --- docs/installation/netbox.md | 51 ++++++++++++--------------------- docs/installation/postgresql.md | 44 ++++++++++++++-------------- 2 files changed, 41 insertions(+), 54 deletions(-) diff --git a/docs/installation/netbox.md b/docs/installation/netbox.md index 51ab09de5..042943cce 100644 --- a/docs/installation/netbox.md +++ b/docs/installation/netbox.md @@ -1,39 +1,17 @@ # Installation -NetBox requires following system dependencies: +**Debian/Ubuntu** -Debian/Ubuntu - -* python2.7 -* python-dev -* python-pip -* libxml2-dev -* libxslt1-dev -* libffi-dev -* graphviz -* libpq-dev -* libssl-dev - -Centos/RHEL - -* python27 -* python-devel -* git -* python-pip -* libxml2-devel -* libxslt-devel -* libffi-devel -* graphviz -* openssl-devel - -### Debian/Ubuntu ``` -# sudo apt-get install -y python2.7 python-dev python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev +# apt-get install -y python2.7 python-dev python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev libssl-dev ``` -## Centos/RHEL + +**CentOS/RHEL** + +``` +# yum install -y epel-release +# yum install -y gcc python2 python-devel python-pip libxml2-devel libxslt-devel libffi-devel graphviz openssl-devel ``` -# sudo yum install -y epel-release -# sudo yum install -y python27 python-devel git python-pip libxml2-devel lbxslt-devel libffi-devel graphviz.x_86_64 openssl-devel You may opt to install NetBox either from a numbered release or by cloning the master branch of its repository on GitHub. @@ -60,9 +38,16 @@ Create the base directory for the NetBox installation. For this guide, we'll use If `git` is not already installed, install it: +**Debian/Ubuntu** + ``` -# sudo apt-get install -y git -# sudo yum install -y git +# apt-get install -y git +``` + +**CentOS/RHEL** + +``` +# yum install -y git ``` Next, clone the **master** branch of the NetBox GitHub repository into the current directory: @@ -83,7 +68,7 @@ Checking connectivity... done. Install the required Python packages using pip. (If you encounter any compilation errors during this step, ensure that you've installed all of the system dependencies listed above.) ``` -# sudo pip install -r requirements.txt +# pip install -r requirements.txt ``` # Configuration diff --git a/docs/installation/postgresql.md b/docs/installation/postgresql.md index c2eac37ba..a4c898bad 100644 --- a/docs/installation/postgresql.md +++ b/docs/installation/postgresql.md @@ -2,31 +2,33 @@ NetBox requires a PostgreSQL database to store data. MySQL is not supported, as # Installation -The following packages are needed to install PostgreSQL with Python support: +**Debian/Ubuntu** -Debian/Ubuntu - -* postgresql -* libpq-dev -* python-psycopg2 - -Centos/RHEL - -* postgresql -* postgresql-server -* postgresql-libs -* postgresql-devel - -Debian/Ubuntu ``` -# sudo apt-get install -y postgresql libpq-dev python-psycopg2 -``` -Centos/RHEL -``` -# sudo yum install postgresql postgresql-server postgresql-libs postgresql-devel +# apt-get install -y postgresql libpq-dev python-psycopg2 ``` -# Configuration +**CentOS/RHEL** + +``` +# yum install -y postgresql postgresql-server postgresql-devel python-psycopg2 +# postgresql-setup initdb +``` + +If using CentOS, modify the PostgreSQL configuration to accept password-based authentication by replacing `ident` with `md5` for all host entries within `/var/lib/pgsql/data/pg_hba.conf`. For example: + +``` +host all all 127.0.0.1/32 md5 +host all all ::1/128 md5 +``` + +Then, start the service: + +``` +# systemctl start postgresql +``` + +# Database Creation At a minimum, we need to create a database for NetBox and assign it a username and password for authentication. This is done with the following commands. From a803bd80334e4f54779e1d8243b61f06a46ac771 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 26 Sep 2016 14:21:10 -0400 Subject: [PATCH 08/26] Simplified web server installation doc --- docs/installation/web-server.md | 37 +++++++++------------------------ 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/docs/installation/web-server.md b/docs/installation/web-server.md index 3e914dd5d..559928888 100644 --- a/docs/installation/web-server.md +++ b/docs/installation/web-server.md @@ -2,30 +2,22 @@ We'll set up a simple WSGI front end using [gunicorn](http://gunicorn.org/) for the purposes of this guide. For web servers, we provide example configurations for both [nginx](https://www.nginx.com/resources/wiki/) and [Apache](http://httpd.apache.org/docs/2.4). (You are of course free to use whichever combination of HTTP and WSGI services you'd like.) We'll also use [supervisord](http://supervisord.org/) to enable service persistence. -Debian/Ubuntu +!!! info + Only Debian/Ubuntu instructions are provided here, but the installation process for CentOS/RHEL does not differ much. Please consult the documentation for those distributions for details. + ``` -# sudo apt-get install -y gunicorn supervisor -``` -Centos/RHEL -``` -# sudo yum install -y gunicorn supervisor +# apt-get install -y gunicorn supervisor ``` ## Option A: nginx The following will serve as a minimal nginx configuration. Be sure to modify your server name and installation path appropriately. -Debian/Ubuntu - ``` -# sudo apt-get install -y nginx -``` -Centos/RHEL -``` -# sudo yum install -y nginx +# apt-get install -y nginx ``` -Once nginx is installed, proceed with the following configuration: +Once nginx is installed, save the following configuration to `/etc/nginx/sites-available/netbox`. Be sure to replace `netbox.example.com` with the domain name or IP address of your installation. (This should match the value configured for `ALLOWED_HOSTS` in `configuration.py`.) ``` server { @@ -49,7 +41,7 @@ server { } ``` -Save this configuration to `/etc/nginx/sites-available/netbox`. Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sites-enabled` directory to the configuration file you just created. +Then, delete `/etc/nginx/sites-enabled/default` and create a symlink in the `sites-enabled` directory to the configuration file you just created. ``` # cd /etc/nginx/sites-enabled/ @@ -61,22 +53,14 @@ Restart the nginx service to use the new configuration. ``` # service nginx restart - * Restarting nginx nginx ``` To enable SSL, consider this guide on [securing nginx with Let's Encrypt](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04). ## Option B: Apache -Debian/Ubuntu - ``` -# sudo apt-get install -y apache2 -``` -Centos/RHEL - -``` -# sudo yum install -y httpd +# apt-get install -y apache2 ``` Once Apache is installed, proceed with the following configuration (Be sure to modify the `ServerName` appropriately): @@ -117,7 +101,7 @@ To enable SSL, consider this guide on [securing Apache with Let's Encrypt](https # gunicorn Installation -Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using centos/RHEL use the apache user instead of www-data. +Save the following configuration file in the root netbox installation path (in this example, `/opt/netbox/`) as `gunicorn_config.py`. Be sure to verify the location of the gunicorn executable (e.g. `which gunicorn`) and to update the `pythonpath` variable if needed. If using CentOS/RHEL change the username from `www-data` to `nginx` or `apache`. ``` command = '/usr/bin/gunicorn' @@ -127,7 +111,6 @@ workers = 3 user = 'www-data' ``` - # supervisord Installation Save the following as `/etc/supervisor/conf.d/netbox.conf`. Update the `command` and `directory` paths as needed. @@ -139,7 +122,7 @@ directory = /opt/netbox/netbox/ user = www-data ``` -Finally, restart the supervisor service to detect and run the gunicorn service: +Then, restart the supervisor service to detect and run the gunicorn service: ``` # service supervisor restart From 45432a6f295003bd78121088da66abcf835a3079 Mon Sep 17 00:00:00 2001 From: Robert Drake Date: Mon, 26 Sep 2016 23:43:05 -0400 Subject: [PATCH 09/26] viewport change for mobile --- netbox/templates/_base.html | 1 + 1 file changed, 1 insertion(+) diff --git a/netbox/templates/_base.html b/netbox/templates/_base.html index 0a9cb20d4..6b9467ad6 100644 --- a/netbox/templates/_base.html +++ b/netbox/templates/_base.html @@ -9,6 +9,7 @@ +