How To Install Brotli Compression on Debian 11

In this tutorial, we intend to teach you How To Install Brotli Compression on Debian 11.

In a nutshell, Brotli is a data compression algorithm. It provides “lossless” compression and is developed by Google under an MIT license. The company is often at the forefront of web-advancing technology, so it’s no surprise that Brotli looks to take what GZIP does, improve on it, and offer an enhanced experience to users and sites.

Brotli compression uses the same core base technologies as GZIP compression, namely:

  • The LZ77 algorithm
  • Huffman encoding and decoding

In fact, if you combine these two technologies, you get the DEFLATE format that serves as the foundation for both GZIP and Brotli compressions.

How To Install Brotli Compression on Debian 11

To complete this guide, 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 Debian 11.

Install Brotli From Source on Debian 11

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

sudo apt update

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

At this point, you need to clone the Brotli repository from 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 Debian 11 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 Debian 11 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
Output
Usage: brotli [OPTION]... [FILE]...
Options:
-# compression level (0-9)
-c, --stdout write on standard output
-d, --decompress decompress
-f, --force force output file overwrite
-h, --help display this help and exit
-j, --rm remove source file(s)
-k, --keep keep source file(s) (default)
-n, --no-copy-stat do not copy source file(s) attributes
-o FILE, --output=FILE output file (only if 1 input file)
-q NUM, --quality=NUM compression level (0-11)
-t, --test test compressed file integrity
-v, --verbose verbose mode
-w NUM, --lgwin=NUM set LZ77 window size (0, 10-24)
window size = 2**NUM - 16
0 lets compressor choose the optimal value
--large_window=NUM use incompatible large-window brotli
bitstream with window size (0, 10-30)
WARNING: this format is not compatible
with brotli RFC 7932 and may not be
decodable with regular brotli decoders
-D FILE, --dictionary=FILE use FILE as raw (LZ77) dictionary
-S SUF, --suffix=SUF output file suffix (default:'.br')
-V, --version display version and exit
-Z, --best use best compression level (11) (default)
Simple options could be coalesced, i.e. '-9kf' is equivalent to '-9 -k -f'.
With no FILE, or when FILE is -, read standard input.
All arguments after '--' are treated as files.

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 learn to Install Brotli Compression on Debian 11.

Hope you enjoy it.

You may be interested in these articles:

How To Set up Apache Tomcat on Debian 11

Install and Configure Postfix Mail Server on Debian 11

How To Install and Configure Grafana on Debian 11

Install and Configure CSF Firewall on Debian 11

How To Install and Configure XAMPP on Debian 11

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular