1.下载相关所需docker镜像

docker pull mysql
docker pull nextcloud
docker pull onlyoffice/documentserver

2 接下来安装mysql

创建docker 脚本

docker run -p 3306:3306 \
           --name mysql \
           -v $PWD/conf:/etc/mysql/conf.d \
           -v $PWD/logs:/logs \
           -v $PWD/data:/var/lib/mysql \
           -v /etc/localtime:/etc/localtime \
           -e MYSQL_ROOT_PASSWORD=1234qwer \
           -d mysql

设置mysql

[root@dream-node201 mysql]# docker exec  -it mysql  /bin/bash
root@80648e3d3df3:/# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.21 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all PRIVILEGES on *.* to root@'%' WITH GRANT OPTION;
####设置允许root用户登陆
Query OK, 0 rows affected (0.05 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED BY '1234qwer' PASSWORD EXPIRE NEVER;
#######修改root账号的密码验证插件类型为mysql_native_password这是mysql8之后的问题
Query OK, 0 rows affected (0.11 sec)

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '1234qwer';
Query OK, 0 rows affected (0.09 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)

mysql> 

3.安装nextcloud

创建docker 脚本

 docker run -d \
            -v $PWD/html:/var/www/html \
            -v $PWD/apps:/var/www/html/custom_apps \
            -v $PWD/config:/var/www/html/config \
            -v $PWD/data:/var/www/html/data \
            -v $PWD/themes:/var/www/html/themes \
            -v /etc/localtime:/etc/localtime \
            -p 8080:80 \
            --name nextcloud \
             nextcloud

然后可以网页访问
ip:8080
设置页面是这样的
4 安装onlyoffice

创建docker脚本

docker run -i -t -d -p 6060:80 --restart=always \
           -v $PWD/logs:/var/log/onlyoffice \
           -v $PWD/data:/var/www/onlyoffice/Data \
           -v $PWD/lib:/var/lib/onlyoffice \
           -v $PWD/db:/var/lib/postgresql onlyoffice/documentserver \
           -v /etc/localtime:/etc/localtime \
                                              

运行docker

浏览器打开 ip:6060 看下是否能打开
在这里插入图片描述
接下来设置nextcloud onlyoffice插件

打开nextcloud 然后打开应用
在这里插入图片描述
搜索onlyoffice
在这里插入图片描述
然后点击下载启用,zai
在这里插入图片描述
在设置——管理 选中onlyoffice 设置地址 并保存
在这里插入图片描述
新版本的nextcloud 这一步骤会出错 报错内容:Error when trying to connect (Host violates local access rules)

需要改下配置文件config.php
添加一行'allow_local_remote_servers' => true,

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oc9bz8p1ts3f',
  'passwordsalt' => 'B7Azxrqxic0khpWv7HFXssPXL6pcSm',
  'secret' => 'xnFuM8AGz0BfswYd5O6bEDXhcrqXRrnQoXPFCMTMGoxkqzCx',
  'trusted_domains' =>
  array (
    0 => '10.10.4.201:8080',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '19.0.1.1',
  'overwrite.cli.url' => 'http://10.10.4.201:8080',
  'dbname' => 'nextcloud',
  'dbhost' => '10.10.4.201:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_admin',
  'dbpassword' => '7RnYDNcDtOOZVFjshJ31vBpnVSudwH',
  'installed' => true,
  'allow_local_remote_servers' => true,##添加的配置
);

然后在设置onlyoffice 就可以了在这里插入图片描述
回到主页面的时候可以看下加载情况在这里插入图片描述
在这里插入图片描述
安装完毕结束。

在使用occ 命令同步出现错误时

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 438272 bytes) in /var/www/html/3rdparty/composer/autoload_real.php on line 37

修改config.php文件:
在末行插入:

  ini_set(
   "memory_limit","80M" 
);
~       ```
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐