The background,

Nextcloud is a personal cloud storage service, providing cloud storage services, built-in Office documents, photo albums, calendar contacts, two-step verification, file management, RSS reading and other rich applications. Can be installed in the local or cloud host, this article uses Docker for deployment, one is directly deployed on the host, there is too much software to install, and the Nextcloud official Docker image.

Docker deployment

Because Nextcloud also needs the support of database, if docker is used alone, two containers need to be manually run one by one, so docker-compose deployment is used (in fact, almost all docker applications of the author prefer this method). Docker-comemess. yml file contains the following contents:

# nextcloud docker-compose file # by Late Lee<[email protected]> version: '2' services: mysql: image: Mysql :5.7 container_name: nextmysql restart: always volumes: # -mysql_root_password =ll123456 -mysql_password =ll123456 -mysql_database =nextcloud -mysql_user =nextcloud networks: - nextcloud-net nextcloud: image: nextcloud:apache container_name: nextcloud restart: always ports: Foreign USES port 8008-8008:80 # links: # - mysql to connect to the database volumes: - / nextcloud: / var/WWW/HTML networks: - nextcloud -.net networks: nextcloud-net: driver: bridgeCopy the code

A few notes about the docker-comemage.yml file:

  • 1. Data is mirroredMysql: 5.7, the service name is not the latest versionmysql, which is the database host to which Nextcloud is connected — not the container name, note. You also need to set the database name, user, and password, because Nextcloud will use.
  • 2. Nextcloud uses imagesnextcloud:apache, integrated with Apache services. Port 8008 is provided externally, because port 80 of the author cloud host needs to be used as reverse proxy.
  • 3. Both containers mount directories for persistent storage.

Run the docker-compose up -d command to start the service. If the image does not exist, it will be automatically downloaded. Note that two mirror images are large and take some time. For large mirror, if you use Ali Cloud host, you can submit to Ali’s mirror warehouse, so that the subsequent use will be very fast.

After the service is successfully started, view its status:

$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8fff850ff996 nextcloud:apache "/entrypoint.sh ap..." 42 minutes ago Up 42 minutes 0.0.0.0:8008->80/ TCP nextCloud 09d7cd30812c mysql:5.7 "... 42 minutes ago Up 42 minutes 3306/tcp nextmysqlCopy the code

As you can see, Nextcloud opens port 8008 (mapped to internal port 80), while mysql only opens port 3306 internally. As it is deployed on the public network and does not operate the database directly, the port is not opened.

Nextcloud service

Use a browser to open http://

:8008, enter the administrator account and password, select Mysql data, enter the parameters set in docker-comemess. yml file, and click “Installation completed”. As shown in Figure 1:

The Nextcloud home page is shown in Figure 2:

Click on the icon in the upper right corner to set various Settings, such as picture, email address, change password, and so on. There are hints on these pages, so I won’t go over them in this article.

Nextcloud client

Nextcloud provides clients, including Windows, MacOS and Linux, as well as mobile apps for download at nextcloud.com/install/#in… . The installation process is very simple and is omitted here.

As a result, the server has, the client has, in use with the common network disk is not too big difference, however, there are no more than a few network disks left now, so, they build their own network disk is very necessary. The client interface is shown in Figure 3.

Note: The client supports multiple users. The server and local directory can be set and switched at any time.

Five, the summary

Theoretically, it is best to use HTTPS protocol to open addresses to the public network, but the author has not solved some problems, so this article does not cover.

Password Resetting Method

Nextcloud uses a command line example:

Docker exec --user www-data < container ID> PHP ocCCopy the code

For example, to view system users:

$docker exec --user www-data cab517edc9b0 PHP occ user: list-latelee: litch-test: testCopy the code

Reset the password according to the tutorial:

$ docker exec --user www-data cab517edc9b0  php occ user:resetpassword latelee
Interactive input or --password-from-env is needed for entering a new password!
Copy the code

Add –password-from-env

docker exec --user www-data cab517edc9b0  php occ --password-from-env user:resetpa 
ssword latelee
--password-from-env given, but OC_PASS is empty!
Copy the code

However, setting the OC_PASS value in the container or on the host does not work. So it ended in failure.

The appendix

Nextcloud official image: hub.docker.com/_/nextcloud…

Li Chi 2019.10.17 Thursday, quit job hunting period