如何在Fedora 29上从源代码构建Brotli
圣地学子
・3 分钟阅读
使用不同的系统?
Brotli是一种比Gzip有更好压缩比的新压缩方法,它的源代码发布在github , 本指南将向你展示从Fedora29上的源代码构建Brotli所需的命令。
开始之前
检查Fedora版本。
cat /etc/fedora-release
# Fedora release 29 (Twenty Nine)
使用sudo
访问创建一个新的非root用户帐户,并且切换到它。
useradd -c"John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe
注:将johndoe
替换为你的用户名。
设置时区。
timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'
确保你的系统是最新的。
sudo dnf check-update; sudo dnf update -y
构建Brotli
安装构建工具和所需的包。
sudo dnf install -y gcc make bc sed autoconf automake libtool git
克隆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'配置文件,首先运行./bootstrap
命令。
./bootstrap
命令之后,你可以访问通常的C程序生成步骤: configure
,make
和make install
。
有关帮助,请运行./configure --help
命令。
现在,建立布罗特里。
./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
成功构建过程后,你可以检查版本。
brotli --version
# brotli 1.0.7
这就可以了,你已从源代码成功构建了Brotli ,现在可以在服务器上使用Brotli压缩格式压缩和解压缩文件。