部署Nextcloud+Onlyoffice

一、LAMP方式安装

环境准备
centos7.7
操作系统:cnetos7.7 4核4G 40G硬盘
数据库版本:MariaDB10.2.37
php版本:php7.3
Apache版本:httpd 2.4.6
1、安装前准备
关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

关闭SElinux

##临时关闭
setenforce 0
vim /etc/selinux/config
##把SELNUX=enforcing换成SELINUX=disabled
##使用sed命令通过模式匹配替换

sed -i 's/^SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

安装base源、EPEL源和REMI源(全部使用清华大学镜像)

[root@localhost nextcloud]# cat /etc/yum.repos.d/CentOS-Base.repo 
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.tuna.tsinghua.edu.cn/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=https://mirror.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@localhost nextcloud]# cat /etc/yum.repos.d/epel.repo 
[epel]
name=centos7-epel
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/
gpgcheck=0
[root@localhost nextcloud]# cat /etc/yum.repos.d/mariadb.repo 
[maraidb-10.2.37]
name=mariadb
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.2.37/yum/centos7-amd64/
gpgcheck=0

REMI源

yum install -y https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm
yum install yum-utils  ##安装yum工具包,里面提供了yum-config-manager命令
yum-config-manager --enable remi-php73  ##启用php7.3的源

2、安装LAMP(Linux+Apache+MySQL+PHP)
安装httpd

yum install -y httpd
systemctl start httpd 
systemctl enable httpd ##设为开机自启动

安装mariadb数据库
添加mariadb安装源,使用清华大学镜像,这里安装MariaDB10.2.37

[root@limesurvey ~]# cat /etc/yum.repos.d/mariadb.repo 
[maraidb-10.2.37]
name=mariadb
baseurl=https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.2.37/yum/centos7-amd64/
gpgcheck=0
##安装
yum install MariaDB-server -y
##启动数据库
systemctl start mariadb  
##设置开机启动
systemctl enable mariadb

配置数据库

[root@localhost ~]# mysql 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.2.37-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
##创建next_cloud数据库
MariaDB [(none)]> create database next_cloud character set utf8;
Query OK, 1 row affected (0.00 sec)
##创建数据库用户nextcloud,授予next_cloud数据库管理权限
MariaDB [(none)]> grant all privileges on next_cloud.* to nextclod identified by 'nextcloud117';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

安装PHP组件

yum install -y php  php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-soap php-ldap php-imap
##启动php-fpm服务
systemctl start php-fpm
systemctl enable php-fpm

安装next cloud
把安装包下载下来并上传到服务器上,这里放在了/opt目录下

##解压缩并复制到指定目录
[root@localhost opt]# unzip nextcloud-21.0.1.zip
[root@localhost opt]# ls
nextcloud  nextcloud-21.0.1.zip
[root@localhost opt]# cp -r nextcloud /var/www/html/
##设置权限
chown -R apache:apache /var/www/html/nextcloud

##重启http服务
systemctl  restart httpd

2、配置next cloud
在浏览器上输入网址10.10.100.117/nextcloud,然后会跳出配置页面

在这里插入图片描述
创建管理员
在这里插入图片描述
配置数据库信息,填入上面创建的数据库用户名及密码等信息
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
安装完成后的效果
在这里插入图片描述
3、安装onlyoffice
配置office documentserver。本来想配置微软的office online,但是在配置WOPI插件时总是提示“Could not find urlsrc in WOPI,后来为了能实现文档的在线编辑功能,就安装onlyoffice,为了方便直接采用docker容器方式部署(配置docker环境请参考这篇文章

##拉取镜像
[root@localhost nextcloud]# docker pull onlyoffice/documentserver
Using default tag: latest
latest: Pulling from onlyoffice/documentserver
a70d879fa598: Pull complete 
c4394a92d1f8: Pull complete 
10e6159c56c0: Pull complete 
eaf4d7b423f6: Pull complete 
869f291080b7: Pull complete 
b99782fa755e: Pull complete 
8f6174fe617d: Pull complete 
Digest: sha256:220534708b40464cad6f515ef015473cc2840046ca0aa73ae246cd1ecfacae47
Status: Downloaded newer image for onlyoffice/documentserver:latest
docker.io/onlyoffice/documentserver:latest
##运行容器
[root@localhost nextcloud]# docker run -i -t -d -p 6060:80 --restart=always \
> -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
> -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \
> -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
> -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver
b7daa0e41b1c7c360b7074634cc1efbfc7e5cb91abe64ec909335a1a256aa0b3
[root@localhost nextcloud]# ss -ntl
State      Recv-Q Send-Q                                           Local Address:Port                                                          Peer Address:Port              
LISTEN     0      100                                                  127.0.0.1:25                                                                       *:*                  
LISTEN     0      128                                                  127.0.0.1:9000                                                                     *:*                  
LISTEN     0      128                                                          *:22                                                                       *:*                  
LISTEN     0      100                                                      [::1]:25                                                                    [::]:*                  
LISTEN     0      80                                                        [::]:3306                                                                  [::]:*                  
LISTEN     0      128                                                       [::]:6060                                                                  [::]:*                  
LISTEN     0      128                                                       [::]:80                                                                    [::]:*                  
LISTEN     0      128                                                       [::]:22                                                                    [::]:*                 

浏览器访问测试
在这里插入图片描述
说明onlyoffice部署成功
4、nextcloud配置onlyoffice
登录到netcloud,下载onlyoffice插件并配置
应用–office&text–右上角搜索onlyoffice,点击下载并启用。
在这里插入图片描述

管理–onlyoffice,配置onlyofiice服务地址,点击保存,如下图即配置成功

在这里插入图片描述
在这里插入图片描述
错误:
在配置onlyoffice出现以下错误
Error when trying to connect (Host violates local access rules)
解决
18以后的NextCloud版本有这个bug, 解决办法在config.php配置文件添加配置

'allow_local_remote_servers' => true,

在这里插入图片描述
重启http服务

现在回到主页面,点击如图加号,可以看到已成功加载office组件
在这里插入图片描述
打开一份文档进行测试
在这里插入图片描述

二、docker容器方式部署

1、镜像准备
netcloud、数据库及onlyoffice都采用容器方式部署,可以先拉取镜像到本地。

##拉取nextcloud镜像
##拉取mariadb镜像
##拉取onlyoffice镜像
[root@localhost nextcloud]# docker pull onlyoffice/documentserver
Using default tag: latest
latest: Pulling from onlyoffice/documentserver
a70d879fa598: Pull complete 
c4394a92d1f8: Pull complete 
10e6159c56c0: Pull complete 
eaf4d7b423f6: Pull complete 
869f291080b7: Pull complete 
b99782fa755e: Pull complete 
8f6174fe617d: Pull complete 
Digest: sha256:220534708b40464cad6f515ef015473cc2840046ca0aa73ae246cd1ecfacae47
Status: Downloaded newer image for onlyoffice/documentserver:latest
docker.io/onlyoffice/documentserver:latest

参考文档:
参考文章1
参考文章2
参考文章3

2、启动相关的容器服务

##启动数据库
docker run -d  -p 3306:3306 --name fno_mysql -v /usr/local/mysql/conf:/etc/mysql/conf.d \
-v /usr/local/mysql/logs:/logs \
-v /usr/local/mysql/data:/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
mariadb

##启动nextcloud
docker run -d \
    -v /app/nextcloud/html:/var/www/html \
    -v /app/nextcloud/apps:/var/www/html/custom_apps \
    -v /app/nextcloud/config:/var/www/html/config \
    -v /app/nextcloud/nextcloud/data:/var/www/html/data \
    -v /app/nextcloud/themes:/var/www/html/themes \
    -p 80:80 \
    nextcloud:17-apache

访问http://安装主机ip:8080/ 页面:

A: 创建管理员账号/密码;

B: 配置数据库;

C: 点击安装完成;

等待稍许分钟会安装完成:

访问 http://安装主机ip:8080/apps/files/ ,打开如下页面:

3、安装onlyoffice:

##启动onlyoffice
docker run -i -t -d -p 6060:80 --restart=always \
-v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \
-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \
-v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \
-v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver
  • 0
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 安装 Nextcloud: 首先,您需要在 CentOS 8 上安装 Nextcloud。执行以下命令以安装 Nextcloud: ``` dnf install httpd mariadb-server php php-mysqlnd php-json php-gd php-mbstring php-zip php-intl php-fpm php-opcache php-cli php-curl wget -y ``` 2. 配置 MariaDB: 在继续安装之前,您需要配置 MariaDB。首先启动 MariaDB 服务并设置 root 密码: ``` systemctl start mariadb mysql_secure_installation ``` 之后,您需要为 Nextcloud 创建一个新的数据库和用户。使用以下命令: ``` mysql -u root -p create database nextcloud; grant all privileges on nextcloud.* to 'nextclouduser'@'localhost' identified by 'password'; flush privileges; exit; ``` 3. 下载和安装 Nextcloud: 现在,您可以从 Nextcloud 的官方网站下载最新的稳定版本。使用以下命令: ``` cd /var/www/html wget https://download.nextcloud.com/server/releases/nextcloud-20.0.4.zip unzip nextcloud-20.0.4.zip ``` 接下来,将 Nextcloud 文件夹的所有权和权限设置为 Apache 用户: ``` chown -R apache:apache /var/www/html/nextcloud/ chmod -R 755 /var/www/html/nextcloud/ ``` 4. 配置 Apache: 现在,您需要配置 Apache 以在 Nextcloud 上运行。创建一个名为 nextcloud.conf 的新文件: ``` nano /etc/httpd/conf.d/nextcloud.conf ``` 在文件中添加以下内容: ``` <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/nextcloud/ ServerName nextcloud.example.com Alias /nextcloud "/var/www/html/nextcloud/" <Directory /var/www/html/nextcloud/> Options +FollowSymlinks AllowOverride All Require all granted <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/html/nextcloud SetEnv HTTP_HOME /var/www/html/nextcloud </Directory> ErrorLog /var/log/httpd/nextcloud_error.log CustomLog /var/log/httpd/nextcloud_access.log combined </VirtualHost> ``` 5. 启动 Apache: 保存并关闭文件后,重新启动 Apache 服务: ``` systemctl start httpd systemctl enable httpd ``` 6. 安装 OnlyOffice: 现在,您可以安装 OnlyOffice。执行以下命令以安装 OnlyOffice: ``` dnf install https://download.onlyoffice.com/repo/centos/main/noarch/onlyoffice-repo.noarch.rpm -y dnf install onlyoffice-documentserver -y ``` 7. 配置 OnlyOffice: 现在,您需要配置 OnlyOffice 以在 Nextcloud 上使用。编辑 OnlyOffice 配置文件: ``` nano /etc/onlyoffice/documentserver/default.json ``` 在文件中,将“docservice.url.portal”和“docservice.url.callback”更改为以下内容: ``` "docservice.url.portal": "https://nextcloud.example.com", "docservice.url.callback": "https://nextcloud.example.com" ``` 替换“nextcloud.example.com”为您的实际 Nextcloud 网址。 8. 启动 OnlyOffice: 保存并关闭文件后,重新启动 OnlyOffice 服务: ``` systemctl start onlyoffice-documentserver systemctl enable onlyoffice-documentserver ``` 9. 完成: 现在,您已经成功安装 NextcloudOnlyOffice,并将它们配置在一起。您可以通过访问您的 Nextcloud 网站来测试安装是否成功。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值