O'Reilly logo

NGINX Unit Cookbook by Derek DeJonghe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Installation

Introduction

The first step toward using NGINX Unit is installing it. NGINX Unit can be installed on a wide variety of systems. This chapter will detail how to install Unit on the major Linux distributions such as Debian, Ubuntu, Red Hat, and CentOS through NGINX package repositories. Other installation methods, such as compiling from source and using third-party repositories, are also included to enable success with NGINX Unit on virtually any Linux-based platform.

Red Hat–Based Systems (.rpm)

Problem

You need to install NGINX Unit on Red Hat or CentOS.

Solution

Create a file named /etc/yum.repos.d/unit.repo that contains the following contents:

[unit]
name=unit repo
baseurl=https://packages.nginx.org/unit/OS/$releasever/$basearch/
gpgcheck=0
enabled=1

Alter the file, replacing OS at the end of the URL with rhel or centos, depending on your distribution.

Install the Unit base package:

sudo yum install unit

Install additional modules that you may want to use with Unit:

sudo yum install unit-php unit-python unit-go unit-perl \
      unit-devel unit-jsc-common unit-jsc8 unit-jsc11

Discussion

The file you just created for this solution instructs the yum package management system to utilize the Official NGINX Unit package repository. The command that follows installs Unit from the Official repository, as well as the Unit modules needed for each application language you may want to run.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required