docker builds nextcloud private cloud disk

Posted by cardio5643 on Tue, 03 Mar 2020 08:27:27 +0100

Knowledge background

Nextcloud is a branch of ownCloud, which was created after Frank caliche, the original developer of ownCloud, left.

NextCloud is an open source network hard disk system. Anyone can get the NextCloud program freely, and build a private and free network hard disk in the home or company. It is a private, secure and fully functional file synchronization and sharing solution that is completely controlled by your users.

Next, I will introduce docker compose to install nextcloud service

Install docker and docker compose

docker installation link: https://docs.docker.com/install/linux/docker-ce/centos/

Docker compose installation link: https://docs.docker.com/compose/install/

Write docker compose file

version: '2'  
services:  
  db:  
    container_name: cloud_db  
    image: mysql:5.7
    volumes:  
      - /var/data/cloud/mysql:/var/lib/mysql
      - /etc/localtime:/etc/localtime 
    environment:  
      MYSQL_ROOT_PASSWORD: nextcloud
      MYSQL_DATABASE: nextcloud  
  nextcloud:  
    container_name: cloud_web  
    depends_on:  
      - db  
    image: nextcloud  
    volumes:  
      - /var/data/cloud/config:/var/www/html/config  
      - /var/data/cloud/data:/var/www/html/data  
      - /var/data/cloud/apps:/var/www/html/apps  
    ports:  
      - "8090:80"  
  onlyoffice:
    container_name: cloud_office
    image: onlyoffice/documentserver
    ports:
      - "9100:80"
networks:  
  default:  
    external:  
      name: nextcloud 

Create the path to store the file. This is / var/data/cloud

Create nextcloud network card before execution

docker network create nextcloud

To start the container service, you need to download the image when the startup process is slow. You can download the image you need before you execute it. The process does not need to be described in detail.

docker-compose up -d

After the service is started, start to initialize the nextcloud service

Browser access: http://ip: port (here I am http://192.168.0.150:8090)

After login, this interface is used to select Storage & database. We use mysqll database here

Complete according to options

User name: admin

Password: nextcloud

Select the default data directory: / var/www/html/data

Database password: nextcloud

Database instance: nextcloud

Port: db (because the database service written in our docker compose file is db)

Initialization will start after the completion, and it will take a few minutes.

After initialization, you can log in with the created account. The basic installation of this service is completed.

 

Install onlyoffice application, and operate word and other files online

Download the onlyoffice app: https://apps.nextcloud.com/apps/onlyoffice/releases?platform=18#18

I installed nextcloud18 here, and selected ONLYOFFICE 4.1.4 to download.

Put the downloaded file under / var/data/cloud/apps

Decompress: tar -zxvf / var/data/cloud/apps/onlyoffice.tar.gz

Enter the nextcloud container to modify the file users and groups of onlyoffice

docker-compose exec nextcloud bash
//Switch to apps file
root@766c5b93dbb4:/var/www/html# cd apps/
//View the users and groups of the file below
root@766c5b93dbb4:/var/www/html/apps# ls -l
total 0
drwxr-xr-x 11 www-data root 122 Mar  1 18:44 accessibility
drwxr-xr-x 10 www-data root 181 Mar  2 10:33 activity
drwxr-xr-x  5 www-data root  48 Mar  1 18:44 admin_audit
drwxr-xr-x  5 www-data root  63 Mar  2 10:33 cloud_federation_api
drwxr-xr-x  8 www-data root  97 Mar  2 10:33 comments
drwxr-xr-x 10 www-data root 109 Mar  1 18:44 dav
drwxr-xr-x 10 www-data root 109 Mar  1 18:44 encryption
drwxr-xr-x 10 www-data root 109 Mar  1 18:44 federatedfilesharing
drwxr-xr-x 10 www-data root 109 Mar  1 18:44 federation
drwxr-xr-x 11 www-data root 181 Mar  2 10:33 files
drwxr-xr-x 11 www-data root 137 Mar  2 10:33 files_external
drwxr-xr-x  9 www-data root  95 Mar  1 18:44 files_pdfviewer
drwxr-xr-x  7 www-data root 123 Mar  2 10:33 files_rightclick
drwxr-xr-x 10 www-data root 143 Mar  2 10:33 files_sharing
drwxr-xr-x  9 www-data root 114 Mar  2 10:33 files_trashbin
drwxr-xr-x  8 www-data root  81 Mar  1 18:45 files_versions
drwxr-xr-x  6 www-data root  75 Mar  2 10:33 files_videoplayer
drwxr-xr-x  9 www-data root 112 Mar  2 10:33 firstrunwizard
drwxr-xr-x 12 www-data root 207 Mar  2 10:33 logreader
drwxr-xr-x  5 www-data root  48 Mar  1 18:45 lookup_server_connector
drwxr-xr-x  8 www-data root  97 Mar  2 10:33 nextcloud_announcements
drwxr-xr-x  9 www-data root 143 Mar  2 10:33 notifications
drwxr-xr-x  8 www-data root  87 Mar  1 18:45 oauth2
drwxrwxr-x 13 root root 230 Jan 28 10:27 onlyoffice
drwxr-xr-x 10 www-data root 121 Mar  2 10:33 password_policy
drwxr-xr-x 10 www-data root 237 Mar  2 10:33 photos
drwxr-xr-x  9 www-data root 263 Mar  2 10:33 privacy
drwxr-xr-x  6 www-data root  59 Mar  1 18:45 provisioning_api
drwxr-xr-x  6 www-data root 111 Mar  2 10:33 recommendations
drwxr-xr-x  9 www-data root 146 Mar  2 10:33 serverinfo
drwxr-xr-x 10 www-data root 109 Mar  1 18:45 settings
drwxr-xr-x 10 www-data root 109 Mar  1 18:45 sharebymail
drwxr-xr-x 10 www-data root 110 Mar  1 18:45 support
drwxr-xr-x  9 www-data root 133 Mar  2 10:33 survey_client
drwxr-xr-x 10 www-data root 125 Mar  2 10:33 systemtags
drwxr-xr-x  9 www-data root 258 Mar  2 10:33 text
drwxr-xr-x  9 www-data root  93 Mar  1 18:45 theming
drwxr-xr-x  9 www-data root  98 Mar  1 18:45 twofactor_backupcodes
drwxr-xr-x  9 www-data root  98 Mar  1 18:45 updatenotification
drwxr-xr-x 12 www-data root 135 Mar  1 18:45 user_ldap
drwxr-xr-x  7 www-data root 165 Mar  2 10:33 viewer
drwxr-xr-x  9 www-data root  98 Mar  1 18:45 workflowengine
//Modify according to the users and groups of the original file
chown -R www-data:root onlyoffice/

Then access the service, click settings, an onlyoffice node will appear in the settings group, enter the service address of the created onlyoffice file, and save it

Then we can operate word and other documents online

 

 

Published 18 original articles, won praise 5, visited 8585
Private letter follow

Topics: Docker Database network MySQL