一键安装 ONLYOFFICE
netnr 2022-05-31
echo "### 安装 wget unzip"
yum install wget unzip -y
echo "### 移除旧的 oo"
docker stop oo -t 0
docker rm oo
docker rmi onlyoffice/documentserver # 删除 oo 镜像
rm -rf /home/onlyoffice/ # 清除目录
echo "### 创建 oo 目录映射"
mkdir -p /home/onlyoffice/logs && cd /home/onlyoffice/ && mkdir data lib db && pwd && ls # 创建目录
docker info
echo "### 拉取镜像"
docker pull onlyoffice/documentserver # 拉取镜像
docker images
echo "### 安装 oo"
docker run -i -t -d -p 9980:80 --restart=always --name=oo \
    -v /home/onlyoffice/logs:/var/log/onlyoffice  \
    -v /home/onlyoffice/data:/var/www/onlyoffice/Data  \
    -v /home/onlyoffice/lib:/var/lib/onlyoffice \
    -v /home/onlyoffice/db:/var/lib/postgresql  onlyoffice/documentserver
echo "### 创建字体存储临时目录"
cd /home/onlyoffice/logs/ && mkdir tmp && cd tmp # 创建字体存储临时目录
echo "### 下载字体包"
wget https://github.com/neroxps/Docker-Only-Office-Chinese-font/archive/refs/heads/master.zip # 下载字体包
echo "### 字体包解压"
unzip master.zip && mv Docker-Only-Office-Chinese-font-master oofont # 解压
echo "### 设高最大文件限制为 1G"
docker exec -it oo /bin/bash -c "sed -i /etc/onlyoffice/documentserver/default.json -e 's/104857600/1048576000/g'" # 替换
echo "### 拷贝字体"
docker exec -it oo /bin/bash -c "cp -r /var/log/onlyoffice/tmp/oofont/winfont /usr/share/fonts/" # 拷贝字体
echo "### 等待 15s 后更新字体"
sleep 15s
docker exec -it oo /bin/bash -c "fc-cache -f -v && /usr/bin/documentserver-generate-allfonts.sh" # 更新字体
echo "### 重启服务"
docker restart oo -t 0 # 重启服务
echo "Done , installed successfully"
登录写评论