如何在Debian 9上从源代码构建Brotli
杨和超
・3 分钟阅读
使用不同的系统?
Brotli是一种比Gzip有更好压缩比的新压缩方法,它的源代码发布在github , 本指南将向你展示从Debian9上的源代码运行和构建Brotli所需的命令。
开始之前
查看Debian版本。
lsb_release -ds
# Debian GNU/Linux 9.6 (stretch)
确保你的系统是最新的。
apt update && apt upgrade -y
安装curl
,wget
和sudo
包; 如果还没有安装。
apt install -y curl wget sudo
使用sudo
访问创建一个新的非root用户帐户,并且切换到它。
adduser johndoe --gecos"John Doe"
usermod -aG sudo johndoe
su - johndoe
注:将johndoe
替换为你的用户名。
设置时区。
sudo dpkg-reconfigure tzdata
构建Brotli
安装构建工具和所需的包。
sudo apt install -y build-essential gcc make bc sed autoconf automake libtool git apt-transport-https
克隆Brotli存储库。
git clone https://github.com/google/brotli.git
导航到Brotli源目录。
cd brotli
为Brotli命令创建手册页。
sudo cp ~/brotli/docs/brotli.1 /usr/share/man/man1 && sudo gzip /usr/share/man/man1/brotli.1
检查手册页。
man brotli
要生成Autotools configure
文件,首先运行./bootstrap
命令。
./bootstrap
命令之后,你可以访问通常的C程序生成步骤: configure
,make
和make install
。
有关帮助,请运行./configure --help
命令。
现在,建立布罗特里。
./configure --prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib/brotli --libdir=/usr/lib/brotli --datarootdir=/usr/share --mandir=/usr/share/man/man1 --docdir=/usr/share/doc
make
sudo make install
成功构建过程后,你可以检查版本。
brotli --version
# brotli 1.0.7
这就可以了,你已从源代码成功构建了Brotli ,现在可以在服务器上使用Brotli压缩格式压缩和解压缩文件。