Install Redis Docker Ubuntu

In this article, we’ll explain how to install NetBox on Ubuntu 20.04. This will guide you with the installation and configuration process.

  1. Install Redis Docker Ubuntu
  2. Install Redis Docker Ubuntu Windows 10
  3. Ubuntu Download

How To Install and Secure Redis on Ubuntu. September 20, 2021 Reddis. In order to get the latest version of Redis, we will use apt to install it from the official Ubuntu repositories. Update your local apt package cache and install Redis by typing: $ sudo apt update $ sudo apt install redis-server. This will download and install Redis and its. To pull a Redis Docker file and run it on local machine on the default port, i.e. 6379, run the following command: docker run -name some-redis -d redis. When you run the above command in terminal, you will see that it starts downloading the necessary files: Let’s wait for the download to complete. Depending on the latest available file size.

NetBox is an infrastructure resource modeling (IRM) application designed to empower network automation. NetBox was developed specifically to address the needs of network and infrastructure engineers. It is intended to function as a domain-specific source of truth for network operations.

NetBox runs as a web application atop the Django Python framework with a PostgreSQL database.


  • A Ubuntu 20.04 installed KVM VPS.
  • A root user access or normal user with administrative privileges
Ubuntu download

1. Keep the server up to date

# apt update -y && apt upgrade -y

2. Install and Configure PostgreSQL Database

We’ll install and configure a local PostgreSQL database.

Note: NetBox requires PostgreSQL 9.6 or higher. Please note that MySQL and other relational databases are not currently supported.

Install PostgreSQL database using following command:

# apt install -y postgresql libpq-dev

Start and enable PostgreSQL service:

# systemctl start postgresql

# systemctl enable postgresql

Next, we need to create a database for NetBox and assign it a username and password for authentication.

# sudo -u postgres psql psql

postgres=# CREATE DATABASE netbox;


postgres=# CREATE USER netbox WITH PASSWORD 'r5t6^7$%gyuuyt4';


postgres=# GRANT ALL PRIVILEGES ON DATABASE netbox TO netbox;


postgres=# q

3. Install Redis

Redis is an in-memory key-value store which NetBox employs for caching and queuing. Use following command to install Redis:

# apt install redis-server -y

Start and enable redis-server service:

# systemctl start redis-server

# systemctl enable redis-server

Use the redis-cli utility to ensure the Redis service is functional:

# redis-cli ping


4. Install and Configure NetBox

There are two ways to install NetBox.

  1. Download a Release Archive
  2. Clone the Git Repository

We’ll install NetBox by cloning the Git repository.

First, install required packages and its dependencies:

# apt install -y python3 python3-pip python3-venv python3-dev build-essential libxml2-dev libxslt1-dev libffi-dev libpq-dev libssl-dev zlib1g-dev

Update pip (Python’s package management tool) to its latest release:

# pip3 install --upgrade pip

Create the base directory /opt/netbox for the NetBox installation.

# mkdir -p /opt/netbox/ && cd /opt/netbox/

Next, clone the master branch of the NetBox GitHub repository into the current directory.

# git clone -b master https://github.com/netbox-community/netbox.git .

Create a system user account named netbox. We’ll configure the WSGI and HTTP services to run under this account. We’ll also assign this user ownership of the media directory.

# adduser --system --group netbox

# chown --recursive netbox /opt/netbox/netbox/media/

Move into the NetBox configuration directory and make a copy of configuration.example.py named configuration.py.

# cd /opt/netbox/netbox/netbox/

# cp configuration.example.py configuration.py

Create a symbolic link of Python binary.

# ln -s /usr/bin/python3 /usr/bin/python

Generate a random SECRET_KEY of at least 50 alphanumeric characters.

# /opt/netbox/netbox/generate_secret_key.py

Above command will create a secret key, store it so that we can use it in the configuration.py.

Open and edit the configuration file configuration.py.

# nano /opt/netbox/netbox/netbox/configuration.py

The final file should have the following configurations.


'NAME': 'netbox', # Database name you created
'USER': 'netbox', # PostgreSQL username you created
'PASSWORD': 'r5t6^7$%gyuuyt4', # PostgreSQL password you set
'HOST': 'localhost', # Database server
'PORT': ', # Database port (leave blank for default)


Once NetBox has been configured, we’re ready to proceed with the actual installation.

We’ll run the packaged upgrade script (upgrade.sh) to perform the following actions:

  • Create a Python virtual environment
  • Install all required Python packages
  • Run database schema migrations
  • Aggregate static resource files on disk

# /opt/netbox/upgrade.sh

Enter the Python virtual environment created by the upgrade script:

# source /opt/netbox/venv/bin/activate

Create a superuser account using the createsuperuser

# cd /opt/netbox/netbox

# python3 manage.py createsuperuser


Email address: [email protected]


Password (again):

Superuser created successfully.

5. Configure Gunicorn

NetBox ships with a default configuration file for gunicorn. To use it, copy /opt/netbox/contrib/gunicorn.py to /opt/netbox/gunicorn.py.

# cp /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py

Copy contrib/netbox.service and contrib/netbox-rq.service to the /etc/systemd/system/ directory and reload the systemd dameon:

# cp -v /opt/netbox/contrib/*.service /etc/systemd/system/

# systemctl daemon-reload

Start and enable the netbox and netbox-rq services:

# systemctl start netbox netbox-rq

# systemctl enable netbox netbox-rq

6. Configure Nginx Web Server

Install Nginx web server using following command:

# apt install -y nginx

Install Redis Docker Ubuntu

Copy the nginx configuration file provided by NetBox to /etc/nginx/sites-available/netbox.

# cp /opt/netbox/contrib/nginx.conf /etc/nginx/sites-available/netbox

Edit the netbox configuration file and remove all the content and copy paste below contents:

# nano /etc/nginx/sites-available/netbox

Remember to change server_name.

server {
listen 80;


client_max_body_size 25m;

location /static/ {
alias /opt/netbox/netbox/static/;

location / {
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;

Then, delete /etc/nginx/sites-enabled/default and create a symlink in the sites-enabled directory to the configuration file you just created.

# rm /etc/nginx/sites-enabled/default

# ln -s /etc/nginx/sites-available/netbox /etc/nginx/sites-enabled/netbox

Now test Nginx configuration and restart the Nginx service:

# nginx -t

# systemctl restart nginx

That’s it we have successfully completed with the installation and configuration process.

Navigate to your browser and access NetBox with using either server IP or domain name.

In this article, we’ve seen how to install NetBox on Ubuntu 20.04.

Introduction to Redis and Docker

The Docker engine compliments Remote Dictionary Server (Redis) by giving developers a dependable Redis Docker Engine strategy to run an instance of the Redis data structure as a service or as a compartmentalized container. Downloading the Bitnami Redis image from the Docker hub has many advantages. For one, changes from the upstream source are published instantly. Secondly, Bitnami provides the latest features and bug fixes fast, and project flexibility is enhanced because the configuration technique and elements are alike for the cloud images, containers, and virtual servers.

Prerequisites to running Redis with Docker

  • Download and install PostgresSQL for your OS.

Install or run the Redis CLI library

  • Install the Redis CLI package for your OS.OR
  • Perform a container restart and run both Redis image and the Redis CLI image.

NOTE: If you use a macOS and installed Redis with Homebrew, the Redis CLI package should be included.

Install the Docker Engine

Get the Docker Engine on your OS or put it on your server. You’ll need to install it prior to running the container Redis.

Install Docker on Windows or macOS

  • Open an account with Docker so you can make a user profile.

  • Login, and then download the Docker installer.

  • Open the macOS DMG installer and follow the prompts to finish the installation.

Install Docker on macOS using Homebrew

  • With Homebrew, you can bypass having a Docker account and do a Docker Engine installation. Use the command brew install:
brew install docker
  • Another option is to get the application Docker Machine with this command:
  • Perform a virtual box installation using this install command:
brew cask install virtualbox

Install ‘Docker CE’ on Linux

  • Perform a Docker dependency package installation:
sudoapt-get-yinstall apt-transport-https ca-certificates curl software-properties-common
  • Obtain the most recent Docker version with the command sudo apt-get update.

  • If you’re uncertain about the Linux version you have or the type of Distro running, use with the command cat /etc/os-release.

NOTE: For CentOS and Fedora Linux Red Hat distros, use the command yum to install the latest version with the YUM package manager.

  • Get the Docker Packages GPG key. Use the command below for Ubuntu and Linux Mint distros that are Debian-based:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg sudoapt-key add -
  • Obtain the Docker repository file .deb with this command:
sudo add-apt-repository 'deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo '$UBUNTU_CODENAME') stable'
  • Inspect the updated repository list with the command cat /etc/apt/sources.list.d/additional-repositories.list:

  • Next, perform another index update with the command sudo apt-get update:

  • Finally, accomplish a Docker Compose and Docker CE installation:

Verify that the Docker Engine is running

  • Acquire a list of every image that was downloaded in the repository with the command docker ps.

  • To take a look at the details about various commands and Docker Hub features, input the command docker help along with the topic you want to know more about. For instance, the command docker help pull returns options that go along with that specific command as well as provide general information about image pulling.

NOTE: Get the version number of Docker with the command docker --version.

Pull the Redis Docker image

  • At Bitnami’s Docker image for Redis, you can complete a stable version Redis Docker image pull; otherwise, use this command:
docker pull bitnami/redis

NOTE: A default is available by using docker pull redis.

List all of the Docker images

  • Use this ls command along with --all or -a to view a list of every image from the repository:

NOTE: Hidden images will be included in the list because you added the flag --all or -a.

Run the Redis Docker image

  • Here’s an example where a container named objrock-redis and the bitnami/redis (Redis image) that is being run as.
docker run --name'objrock-redis'-d bitnami/redis

NOTE: The mode “detached” is represented by the option -d. The above command enables you to perform a detached mode launching of the container. Verify that you have sudo permissions if you experience issues starting the container in detached mode.

List the Docker containers to look for Redis

  • Confirm that the container is active with the command docker ps. If you don’t see container activity, use the -a flag or --all to include hidden containers:

Install Redis Docker Ubuntu Windows 10

NOTE: Get even more specifics about a container with the command docker logs and then list the container’s name.

  • The output of your Docker container where you have the Redis image running should look something like this from a terminal window:

NOTE: Each container and Docker image has it’s own one-of-a-kind ID, so you’ll be able to tell it apart from any other container or image.

Setting a password for the Redis environment

You can set a password for your container. You should already have one set for your configuration for Redis. To apply a container password, identify it within the Docker environment file docker-compose.yml.

Run the Redis container without a password

  • You can also run your container and skip assigning a password altogether so that it will not respond with the exception REDIS_PASSWORD environment variable is empty or not set. Use the ALLOW_EMPTY_PASSWORD and -e flag like this:
docker run --name'objrock-redis'-eALLOW_EMPTY_PASSWORD=yes bitnami/redis:latest

Another way to run the Redis image in a Docker container is by using command redis-cli, the Redis CLI image. First, check that the app Redis CLI is active. Verify that its configuration is correct as well. When finished with your confirmation checks, it’s okay to do your Redis port (default port 6379) container binding.

Ubuntu Download

Conclusion to Redis and Docker

The convenience of using the Docker Engine to pull the Redis image and run the Redis data structure as a container is speed, agility, and project pliability. What’s more, viewing lists of every container along with their details helps manage your work. Organize, visualize, strategize. Try the Redis Docker way today!

Most Viewed Posts