需求:为一台无法联网的纯净版 centos7 服务器安装指定字体
解决思路:
- 1.在虚拟机上安装一台纯净版的 centos7 系统。
- 2.从网上找出安装字体的流程:yum 过程中把用到的依赖包记录下来,并且下载下来放入到一个统一的文件夹里面:rpms
- 3.下载指定字体放入到一个文件夹里面:fonts
- 4.编写安装文件:install.sh
解决流程:
- 1.总体文件夹结构如下:

- 2.fonts 文件夹如下

- 3.rpms 文件夹如下

- 4.font.sh 内容如下:
#!/bin/bash
font_dir=/usr/share/fonts/website
rpm -Uvh rpms/*.rpm --nodeps --force
if [ ! -d "$font_dir" ]; then
mkdir font_dir
fi
cp -r -f fonts/* /usr/share/fonts/chinese
chmod -R 755 /usr/share/fonts/chinese
ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
if [ `grep -c "/usr/share/fonts/chinese" /etc/fonts/fonts.conf` -eq '1' ]; then
echo "has config in fonts.conf"
else
echo "has not config append to it"
sed -i '/^