部署Office Online Server为Seafile网盘提供在线编辑功能
因个人工作需求,需要外出的时候查看文档,试用了很多网盘的解决方案,最后选择了比较知名的seafile。而seafile支持与Office Online Server
集成,来支持在线编辑和协同编辑的高级功能。
Office Online Server
是一种 Office 服务器产品,它为 Office 文件提供基于浏览器的文件查看和编辑服务。服务器必须是 Windows Server 2012 R2 或 Windows Server 2016。(请注意,Windows Server 2016 需要 Office Online Server 2017 年 4 月或更高版本。)
微软要求安装Office Online Server
必须要有域控。并且Office Online Server
不能安装到域控制器上。
域控 windows2016 :
ad1.lzuvdi.com 192.168.80.100
ad2.lzuvdi.com 192.168.80.200
Office Online Server Windows 2016
office.lzuvdi.com 192.168.80.111
1,安装 Office Online Server 必备组件
以管理员身份打开 Microsoft PowerShell 提示符,然后运行下面的命令示例来安装必需的角色和服务
Windows 2012R2:
Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,InkandHandwritingServices,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,Server-Media-Foundation
Windows 2016:
Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,NET-Framework-Features,NET-Framework-45-Features,NET-Framework-Core,NET-Framework-45-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,Server-Media-Foundation
安装成功
2,安装以下软件:
a).NET Framework 4.5.2
b)Visual C++ Redistributable Packages for Visual Studio 2013
c)Visual C++ Redistributable for Visual Studio 2015
d)Microsoft.IdentityModel.Extention.dll
有些组件如果提示已安装,跳过即可。
3,安装 Office Online Server
复制下面的链接,下载最新版的Office Online Server
ed2k://|file|cn_office_online_server_last_updated_november_2017_x64_dvd_100181918.iso|770267136|0660AFCFE1AC9A62E749194874643E98|/
4,安装 Office Online Server 语言包
借助 Office Online Server 语言包,用户可以查看基于 Web 的 Office 多语言文件,无论是从 SharePoint 文档库打开,还是从 Outlook 网页版打开,都能查看。
点此下载Office Online Server 语言包,然后运行wacserverlanguagepack.exe
安装语言包
5,导入证书
如果只是在内网使用,导入内部的CA证书到个人证书即可。我是公网使用,我把公网的证书导入,并修改友好名称为office
6,部署 Office Online Server 场
New-OfficeWebAppsFarm -InternalUrl "https://office.lzuvdi.com" -ExternalUrl "https://office.mr-mao.cn" -CertificateName "office" -EditingEnabled
参数说明:
-InternalURL 是运行 Office Online Server 服务器完全限定的域名 (FQDN),
-ExternalURL 是可以在 Internet 上访问的 FQDN。
-CertificateName 是证书的友好名称。
-EditingEnabled 在 Office Online 中启用编辑。
部署成功,会提示如下信息:
浏览器中打开 https://office.mr-mao.cn/hosting/discovery
显示如下信息
7,为seafile集成office online server 功能
编辑seahub_settings.py
# Enable Office Online Server
ENABLE_OFFICE_WEB_APP = True
# Url of Office Online Server's discovery page
# The discovery page tells Seafile how to interact with Office Online Server when view file online
# You should change `http://example.office-web-app.com` to your actual Office Online Server server address
OFFICE_WEB_APP_BASE_URL = 'https://office.mr-mao.cn/hosting/discovery'
# Expiration of WOPI access token
# WOPI access token is a string used by Seafile to determine the file's
# identity and permissions when use Office Online Server view it online
# And for security reason, this token should expire after a set time period
WOPI_ACCESS_TOKEN_EXPIRATION = 30 * 60 # seconds
# List of file formats that you want to view through Office Online Server
# You can change this value according to your preferences
# And of course you should make sure your Office Online Server supports to preview
# the files with the specified extensions
OFFICE_WEB_APP_FILE_EXTENSION = ('ods', 'xls', 'xlsb', 'xlsm', 'xlsx','ppsx', 'ppt',
'pptm', 'pptx', 'doc', 'docm', 'docx')
# Enable edit files through Office Online Server
ENABLE_OFFICE_WEB_APP_EDIT = True
# types of files should be editable through Office Online Server
# Note, Office Online Server 2016 is needed for editing docx
OFFICE_WEB_APP_EDIT_FILE_EXTENSION = ('xlsx', 'pptx', 'docx')
然后重启seafile 和 seabub服务
8,测试在线编辑功能