How To Install Brotli Compression on Centos 7

In this section of Linux Tutorials, we want to teach you How To Install Brotli Compression on Centos 7.

Brotli is a state-of-the-art lossless compression format, supported by all major browsers. It can achieve considerably better compression ratios than the ubiquitous gzip and is rapidly gaining in popularity. Cloudflare uses the Google brotli library to compress web content whenever possible dynamically.

One of the more exciting features of the brotli file format, in the context of textual web content compression, is the inclusion of a built-in static dictionary. The dictionary is quite large, and in addition to containing various strings in multiple languages, it also supports the option to apply multiple transformations to those words, increasing its versatility.

The open-sourced brotli library, which implements an encoder and decoder for brotli, has 11 predefined quality levels for the encoder, with higher quality levels demanding more CPU in exchange for a better compression ratio.

How To Install Brotli Compression on Centos 7

Before you start to install Brotli o your server, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Centos 7.

In this tutorial, we will install Brotli from the source on Centos 7.

Install Brotli from source on Centos 7

First, update your local package index with the following command:

sudo yum update -y

Then, install the required packages and dependencies with the command below:

sudo yum install -y wget gcc make bc sed autoconf automake libtool git tree

Now you need to clone the Brotli repository from the GitHub with the following command:

git clone https://github.com/google/brotli.git

Switch to your Brotli directory:

cd brotli

Next, create a manual page for the Brotli command:

sudo cp ~/brotli/docs/brotli.1 /usr/share/man/man1 && sudo gzip /usr/share/man/man1/brotli.1

To generate the Autotools configure file, run the following command:

./bootstrap

Now you have access to the usual C program build steps: configuremake and make install available.

At this point, you can build and install Brotli on Centos 7 with the following commands:

# ./configure --prefix=/usr \
            --bindir=/usr/bin \
            --sbindir=/usr/sbin \
            --libexecdir=/usr/lib64/brotli \
            --libdir=/usr/lib64/brotli \
            --datarootdir=/usr/share \
            --mandir=/usr/share/man/man1 \
            --docdir=/usr/share/doc

# make
# sudo make install

When you are finished, you can verify your Brotli installation on Centos 7 by checking its version:

brotli --version
Output
brotli 1.0.9

Also, you can use the following command to get more help about the brotli command:

brotli -h

Conclusion

At this point, you learn to Install Brotli Compression on Centos 7 from the source.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!