Install Brotli Compression on Ubuntu 20.04

This tutorial intends to teach you to Install Brotli Compression on Ubuntu 20.04. Brotli is an open-source, lossless compression algorithm introduced by Google in 2015.

Brotli is built using a modern version of the LZ77 algorithmHuffman coding, and 2nd-order context modeling.

The algorithm utilizes a dictionary already built into users’ browsers that consists of almost 100,000 commonly used phrases and word fragments on the web. Due to this, it is possible to reduce the size of the files being processed.

You can now follow the steps below on the Orcacore website to set up Brotli Compression Ubuntu 20.04.

Steps To Install Brotli Compression on Ubuntu 20.04

To Install Brotli on Ubuntu 20.04, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 20.04.

In this guide, you will learn to install Brotli from the source. Follow the steps below to complete this guide.

Install Brotli Compression Ubuntu 20.04 From Source

First, you need to update your local package index with the command below:

sudo apt update

Install Required packages

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

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

Clone Brotli Repo From GitHub

At this point, you need to clone the Brotli repository from GitHub on Ubuntu 20.04 with the following command:

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

Switch to your Brotli directory:

cd brotli

Create a Manual Page for 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

Generate Autotools Configure File

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.

Build and Install Brotli Compression Ubuntu 20.04

At this point, you can build and install Brotli on Ubuntu 20.04 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 Ubuntu 20.04 by checking its version:

brotli --version

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

brotli -h
Brotli Compression Ubuntu 20.04

Conclusion

Data compression is a necessary component of developing and using the modern web. File sizes can skyrocket due to the rich and complex file types you’ll use to piece together a website. All of them need some form of compression.

Brotli compression bases its technology on the same foundation as GZIP but includes some performance-enhancing benefits.

At this point, you have learned to Install Brotli Compression on Ubuntu 20.04.

Hope you enjoy it. You may also interested in these articles:

Install PHP 8.2 on Ubuntu 20.04

Install Python 3.11 on Ubuntu 20.04

Set up SmartGit on Ubuntu 20.04

Install and Configure XWiki on Ubuntu 20.04

How to secure Nginx with Let’s Encrypt on Ubuntu 20.04

Installing CouchDB on Ubuntu 20.04

Install Slack on Ubuntu 20.04

Install and Secure Odoo14 on Ubuntu 20.04

FAQs

How do I compress a file using Brotli?

You can use the command below:
brotli input.txt

How do I decompress a Brotli file?

You can use the command below:
brotli -d input.txt.br

Can Brotli be used for non-web applications?

Yes! Brotli can compress log files, data archives, and other text-based files efficiently.

Share your love

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!