部署Nextcloud+Onlyoffice
一、LAMP方式安装环境准备centos7.7操作系统:cnetos7.74核4G40G硬盘数据库版本:MariaDB10.2.37php版本:php7.3Apache版本:httpd 2.4.61、安装前准备关闭防火墙systemctl stop firewalld.servicesystemctl disable firewalld.service关闭SElinux##临时关闭setenfor
一、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
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)