lxc alpine下使用cloudreve 和 LibreOffice 的配置

接上一篇,在pve lxc下以cloudreve为核心搭建了nas https://dev.leiyanhui.com/pve/lxc-nas-core-cloudreve

下面需要配置 在线编辑功能,考虑到alpine的依赖问题,单独配置一个lxc容器来运行office部分

特权容器 安装docker 方法:查看这里

office的选择,肯定是选大名鼎鼎的LibreOffice,另外Office Online Server微软的 ,在部分授权情况下可以免费使用,但是需要window server主机。另外一个OnlyOffice 不知为什么我这里没成功

# 安装配置docker

基本配置和安装docker https://dev.leiyanhui.com/pve/alpine-docker

# 运行docker

因为Office Online Server收费,OnlyOffice的兼容性也没看到,并且我这里配置只能预览无法编辑,所以选择LibreOffice.

# 尝试使用 Collabora Online (LibreOffice Online)

建议用ubuntu22.04运行,直接安装 不使用docker。 创建一个lxc 至少需要2.8G 建议 5G。 内存要1G+

修改源 那些不用说了。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
export customer_hash=Example-413539ece39485afc35b4a469adfde0a279d2fd2

cd /usr/share/keyrings
wget https://collaboraoffice.com/downloads/gpg/collaboraonline-release-keyring.gpg
cat << EOF > /etc/apt/sources.list.d/collaboraonline.sources
Types: deb
URIs:https://www.collaboraoffice.com/repos/CollaboraOnline/22.05/customer-ubuntu2204-$customer_hash
Suites: ./
Signed-By: /usr/share/keyrings/collaboraonline-release-keyring.gpg
EOF
apt update 
apt install coolwsd collabora-online-brand
1
2
3
4
5
6
7
8
docker stop code && docker rm code
docker run -t -d -p 9980:9980 --name code --hostname code \
            -e TZ=Asia/Shanghai \
            -e dictionaries=zh-CN \
           -e "aliasgroup1=https://pan.jia.leiyanhui.com:5213" \
           -e "username=admin" \
           -e "password=admin" \
           --restart always collabora/code

# 配置ssl

我这里使用github actions集中管理的ssl证书 https://dev.leiyanhui.com/web/auto-get-ssl
直接下载回来 用 7z 带密码解压 (unzip部分发行版不支持密码)

1
2
3
wget https://github.com/joyanhui/ssl/raw/main/ssl.zip
apk  add p7zip
7z x ssl.zip  -p密码 #密码和p字母之间没有空格

安装nginx 处理ssl

1
2
3
4
5
apk add nginx
rc-update add nginx
rc-service nginx start
nginx -s reload # 重载
nano /etc/nginx/http.d/code.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
server {
 listen       8443 ssl;
 server_name  office.jia.leiyanhui.com;
 ssl_certificate /root/ssl/jia.leiyanhui.com.cer;
 ssl_certificate_key /root/ssl/jia.leiyanhui.com.key;

 # static files
 location ^~ /browser {
   proxy_pass https://127.0.0.1:9980;
   proxy_set_header Host $http_host;
 }


 # WOPI discovery URL
 location ^~ /hosting/discovery {
   proxy_pass https://127.0.0.1:9980;
   proxy_set_header Host $http_host;
 }


 # Capabilities
 location ^~ /hosting/capabilities {
   proxy_pass https://127.0.0.1:9980;
   proxy_set_header Host $http_host;
 }


 # main websocket
 location ~ ^/cool/(.*)/ws$ {
   proxy_pass https://127.0.0.1:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $http_host;
   proxy_read_timeout 36000s;
 }


 # download, presentation and image upload
 location ~ ^/(c|l)ool {
   proxy_pass https://127.0.0.1:9980;
   proxy_set_header Host $http_host;
 }


 # Admin Console websocket
 location ^~ /cool/adminws {
   proxy_pass https://127.0.0.1:9980;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "Upgrade";
   proxy_set_header Host $http_host;
   proxy_read_timeout 36000s;
 }
}
# 管理

https:///browser/dist/admin/admin.html

# 配置cloudreve

管理员登陆 ,到后台,参数设施 图像预览 WOPI 客户端 启用

# 进阶

# 安装中文字体

1
2
3
4
cd ~
wget -c https://ghproxy.com/https://github.com/joyanhui/file.leiyanhui.com/archive/refs/heads/windows_font.zip
unzip windows_font.zip
mv file.leiyanhui.com-windows_font   win_font

重建docker

1
2
3
4
5
6
7
8
9
docker stop code && docker rm code
docker run -t -d -p 9980:9980 --name code --hostname code \
          -v /root/win_font:/usr/share/fonts/win_font  \
          -e TZ=Asia/Shanghai \
          -e dictionaries=zh-CN \
          -e "aliasgroup1=https://pan.jia.leiyanhui.com:5213" \
          -e "username=admin" \
          -e "password=admin" \
          --restart always collabora/code

进入docker 继续处理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# docker exec -u 0 -it code /bin/bash  #必须带 -u 0
cat /etc/issue  # Ubuntu 18.04.6 LTS
apt update
fc-cache -fv
coolwsd-systemplate-setup /opt/cool/systemplate /opt/collaboraoffice

apt install collaboraofficebasis-zh-cn # 发现已经安装

apt -y install language-pack-zh-hans language-pack-zh-hans-base

exit
# docker restart code

本文参考官方手册:https://docs.cloudreve.org/use/wopi

https://sdk.collaboraonline.com/docs/installation/CODE_Docker_image.html#code-docker-image

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计