快速搭建Nextcloud+OnlyOffice私有云办公平台

原作者:迈克·史密斯  转载来源:https://serenity-networks.com/how-to-install-onlyoffice-document-server-for-nextcloud-fast-easy/

快速搭建Nextcloud+OnlyOffice私有云办公平台

我浪费了大量时间试图将Collabora / LibreOffice / CODE平台与我的Nextcloud 11服务器集成。我想要进行Google Docs风格的编辑,但结果却让人头疼。有一天,在偶然的情况下,我偶然发现了OwnCloud的OnlyOffice插件。经过一番挖掘后,我发现它也适用于NextCloud。不到15分钟后,我在第二台Ubuntu 16.04服务器上安装了OnlyOffice Document Server软件包,它与我的NextCloud服务器完全集成。

先决条件

对于本指南,您最终需要以下内容:

  • 两台的Ubuntu 16.04或16.10 服务器
  • 有效的SSL证书(A FREE LetsEncrypt证书都行)
  • 有效的DNS条目用于两个服务器(本指南,您需要使用onlyoffice.yourdomain.tld,定制OnlyOffice域超出本指南的范围)

 

安装依赖项

OnlyOffice需要一些依赖项。主要是nodejs,postgresql和nginx。此外,我们还需要为最新的t tf-mscorefonts-installer软件包启用一个repo

首先,让我们继续添加所需的回购。

echo "deb http://archive.ubuntu.com/ubuntu precise main universe multiverse" | sudo tee -a /etc/apt/sources.list
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -

接下来,安装postgresql。

sudo apt-get install postgresql

对于本指南的范围,数据库必须仅被调用,并且用户名和密码都需要设置为onlyoffice。我建议配置防火墙,例如UFW,以保护您的服务器。

创建onlyoffice数据库并分配用户名和密码,请执行以下操作:

sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

接下来,安装redis进行缓存。

    sudo apt-get install redis-server

最后,安装rabbitmq

   sudo apt-get install rabbitmq-server

 

安装OnlyOffice文档服务器

 要安装OnlyOffice文件服务器的软件包,我们需要增加回购,以及它的GPG密钥

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5

sudo echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list

 更新 Apt包管理器的可用包列表。

sudo apt-get install onlyoffice-documentserver

 现在,我们可以安装OnlyOffice文件服务器的软件包。

sudo apt-get install onlyoffice-documentserver

 所有的软件包安装完成后,你应该能够浏览通过您OnlyOffice文档服务器的http://yourdomain.tld(HTTP 小号是尚未设定),虽然你不能直接对它做任何事以后验证这是工作。它看起来像这样。

 

 

OnlyOffice文件服务器的服务名称是主管。此服务需要配置为在启动时启动,以及redis-server,rabbitmq和nginx。

sudo systemctl enable redis-server

sudo systemctl enable rabbitmq-server

sudo systemctl enable supervisor

sudo systemctl enable nginx

这些服务现在将在启动时自动启动。接下来,您需要获取SSL证书(我建议使用certbot从Let Encrypt获取它们)。获取证书后,可以通过执行以下操作在OnlyOffice文档服务器上启用SSL。

sudo nano /etc/nginx/conf.d/onlyoffice-documentserver.conf

 选择此文件中的所有内容删除。文件完全空白后,粘贴或将以下内容添加到文件中。请务必编辑红色项目,这些项目与您的服务器名称和SSL证书位置有关。

 

include /etc/nginx/includes/onlyoffice-http.conf;
## Normal HTTP host
server {
listen 0.0.0.0:80;
listen [::]:80 default_server;
server_name onlyoffice.yourdomain.tld;
server_tokens off;
## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
}
#HTTP host for internal services
server {
listen 127.0.0.1:80;
listen [::1]:80;
server_name localhost;
server_tokens off;
include /etc/nginx/includes/onlyoffice-documentserver-common.conf;
include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf;
}
## HTTPS host
server {
listen 0.0.0.0:443 ssl;
listen [::]:443 ssl default_server;
server_name onlyoffice.yourdomain.tld;
server_tokens off;
root /var/www/html;

ssl on;
ssl_certificate /etc/letsencrypt/live/onlyoffice.yourdomain.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/onlyoffice.yourdomain.tld/privkey.pem;

ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES12$
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security max-age=31536000;
add_header X-Content-Type-Options nosniff;

######  The lines below will allow LetsEncrypt and/or Certbot to obtain & renew SSL certificates
location ~ /.well-known/acme-challenge {
root /var/www/onlyoffice/;
allow all;
}
include /etc/nginx/includes/onlyoffice-documentserver-*.conf;
}

保存并退出,然后重新启动nginx和主管

sudo systemctl restart nginx

sudo systemctl restart supervisor

现在,你应该能够浏览到您的OnlyOffice文件服务器使用SSL / HTTPSHTTP 小号://yourdomain.tld

接下来,您需要将OnlyOffice插件添加到NextCloud Server。为此,请通过SSH连接到NextCloud服务器,然后下载插件。

cd apps /
git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice

打开Web浏览器并登录NextCloud服务器,然后转到设置>管理员> OnlyOffice。输入您的OnlyOffice文件服务器地址(请务必使用https

https:// yourdomain.tld


现在,单击 NextCloud服务器上的文件单击加号按钮。您现在应该可以选择创建新的字处理器,电子表格和演示文稿文档。请享用!

 完成后,您将在NextCloud服务器上集成自己的Google Docs / Office 365类型的应用程序!

如果您有任何疑问,请随时在下面的评论中提问。感谢阅读,并有一个很棒的一天!

 

PS: 通过虚拟机镜像快速搭建私有云办公平台

OwnCloud+OpenOffice: https://appcenter.software-univention.de/univention-apps/current/onlyoffice-ds/Univention-App-onlyoffice-ds-virtualbox.ova

NextCloud+OpenOffice:https://appcenter.software-univention.de/univention-apps/current/onlyoffice-ds/Univention-App-onlyoffice-ds-nextcloud-virtualbox.ova

 

猜你喜欢

转载自blog.csdn.net/Aria_Miazzy/article/details/85028247
今日推荐