OpenMediaVault Install NextCloud
I. Create the configuration folder required by nextcloud
nextcloud shared folder
Access Rights Management -> Shared Folders
, create a folder named nextcloud
.
After OMV creates the shared folder, it will map the shared folder to a file path of /sharedfolders
, so you have two paths to access the shared folder you just created, one is the path to your disk One is a path under the public /sharedfolders
. The operations under both paths are valid. You can choose one at will.
For example, the shared folder of nextcloud that I just created. If I want to find it, I can find it in both paths.
Subfolders required by nextcloud
db
: Database for persistent data that nextcloud depends onhtml
: Nextcloud resource configuration folderdata
: personal sync file for nextcloud (the data of your network disk will be stored here later)onlyoffice
: log and data folders for onlyoffice office suite
II. Database Preparation
By default, NextCloud uses a SQLite database for data storage, which is only suitable for testing and lightweight single-user settings without client synchronization. When there are multiple users, multiple devices, and large amounts of data, SQLite is not suitable. NextCloud supports multiple databases such as MySQL, MariaDB, Oracle 11g, and PostgreSQL. And it is recommended to use MySQL / MariaDB. So for the sake of once and for all, use MySQL instead. MariaDB is a branch of the MySQL source code. Here MariaDB is used as the database support.
- Install mariadb
Here we install mariadb using docker. Open your terminal and copy the following command to create the mariadb container.
docker run -d --name db_nextcloud \
-p 3307:3306 \
-e PUID=1000 \
-e PGID=100 \
-e MYSQL_ROOT_PASSWORD=123456 \
-e MYSQL_DATABASE=nextcloud \
-e MYSQL_USER=nextcloud \
-e MYSQL_PASSWORD=123456 \
--restart=unless-stopped \
-v /sharedfolders/nextcloud/db:/var/lib/mysql \
mariadb
Explanation of command parameters
(for specific parameter definitions, please see mariadb official images site ):
-p 3307:3306
: Open port of the container service, the former is the port of the host machine, the latter is the port of the service inside the container
-e PUID, -e PGID
: the permission set id of the user running the container
-e MYSQL_ROOT_PASSWORD
: The password of the database root user
-e MYSQL_DATABASE=nextcloud
: Create a database named nextcloud
-e MYSQL_USER
: Create a user named nextcloud
-e MYSQL_PASSWORD
: The password of the user named nextcloud
--restart=unless-stopped
: restart the container when the container is stopped
-v
: data volume binding The former is the address of the host machine, the latter is the location of the container machine
For example: -v /sharedfolders/nextcloud/db:/var/lib/mysql
Hang the contents of the container /var/lib/mysql
to the location of the host /sharedfolders/nextcloud/db
Following is the log I run
qinkangdeid@omv:~$ docker run -d --name db_nextcloud \
> -p 3307:3306 \
> -e PUID=1000 \
> -e PGID=100 \
> -e MYSQL_ROOT_PASSWORD=123456 \
> -e MYSQL_DATABASE=nextcloud \
> -e MYSQL_USER=nextcloud \
> -e MYSQL_PASSWORD=123456 \
> --restart=unless-stopped \
> -v /sharedfolders/nextcloud/db:/var/lib/mysql \
> mariadb
Unable to find image 'mariadb:latest' locally
latest: Pulling from library/mariadb
38e2e6cd5626: Pull complete
705054bc3f5b: Pull complete
c7051e069564: Pull complete
7308e914506c: Pull complete
35e6984cb587: Pull complete
3a173c4702b4: Pull complete
efd003ff8e24: Pull complete
ba5d30791443: Pull complete
f3e943c9e01d: Pull complete
e5243a434e4f: Pull complete
910d8b012ee8: Pull complete
1fb787f18e3d: Pull complete
7a0cfbee5299: Pull complete
6fa7c8911619: Pull complete
Digest: sha256:eb6acf7f599f39c42582e11b1de3866c3934da84cc45190c0aac3e8d046e4053
Status: Downloaded newer image for mariadb:latest
`1be6b4e5f24539e8fc40ca7036a567104b067072044f878a3f4d71104ee8ee9a`
qinkangdeid@omv:~$
Check the docker running container and see that db_nextcloud
is running under theNAMES
column. You can also see the port we configured.
qinkangdeid@omv:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1be6b4e5f245 mariadb "docker-entrypoint.s…" 14 seconds ago Up 8 seconds 0.0.0.0:3307->3306/tcp db_nextcloud
5b9d858e08ab opengg/aria2 "/init.sh" 24 minutes ago Up 23 minutes 0.0.0.0:6800->6800/tcp aria2
Another way to verify the installation is using telnet
III. Install NextCloud
The installation of NextCloud is also simple. Still using docker, copy the following command to the terminal and run it. Remember that the first part of -v is the address of your host machine.
docker run -d --name nextcloud \
-p 8088:80 \
--restart=unless-stopped \
-v /sharedfolders/nextcloud/html:/var/www/html \
-v /sharedfolders/nextcloud/data:/var/www/html/data \
nextcloud
Explanation of command parameters
(For specific parameter definitions, please see nextcloud official images site ):
-p 8088:80
: The port opened by the container service, the former is the port of the host machine, and the latter is the port of the service inside the container
--restart=unless-stopped
: restart the container when the container is stopped
-v
: data volume binding The former is the address of the host machine, the latter is the location of the container machine
Nextcloud installation and all data (file upload, etc.) outside the database are stored in the container address /var/www/html
. If you want to persist your data, you can view it without going through nextCloud, it should be mapped to the host machine Somewhere
There are still a lot of volume configurations for Nextcloud, such as config, data, themes, etc.
Some volume addresses of nextcloud:
/var/www/html
home folder required for update
/var/www/html/custom_apps
manually installed application location
/var/www/html/config
Local configuration file location
/var/www/html/data
Where your network disk data is stored
/var/www/html/themes/<YOU_CUSTOM_THEME>
theme file location
For the above volume mapping, I only extracted the data here. All other configurations are placed in the location of /var/www/html
by default.
Following is the log I run
qinkangdeid@omv:~$ docker run -d --name nextcloud \
> -p 8088:80 \
> --restart=unless-stopped \
> -v /sharedfolders/nextcloud/html:/var/www/html \
> -v /sharedfolders/nextcloud/data:/var/www/html/data \
> nextcloud
Unable to find image 'nextcloud:latest' locally
latest: Pulling from library/nextcloud
5e6ec7f28fb7: Pull complete
cf165947b5b7: Pull complete
7bd37682846d: Extracting [===========================================> ] 58.49MB/67.44MB
7bd37682846d: Pull complete
99daf8e838e1: Pull complete
ae320713efba: Pull complete
ebcb99c48d8c: Pull complete
9867e71b4ab6: Pull complete
936eb418164a: Pull complete
5d9617dfb66b: Pull complete
8dd7afaae109: Pull complete
8f207844da7e: Pull complete
adb3ae5e4987: Pull complete
44d7d07029db: Pull complete
fb91064652b0: Pull complete
50923e16d552: Pull complete
a7cb9c70c5d2: Pull complete
728e578e40fa: Pull complete
4c3163d09df1: Pull complete
842c4700643d: Downloading [===========================================> ] 35.98MB/41.57MB
842c4700643d: Pull complete
cc1964f4bb3e: Pull complete
125e01596295: Pull complete
Digest: sha256:a2f2bd57fcfd92b3b6c23b6f34f65d59c9b25e7cc883b1ac67fff01229325692
Status: Downloaded newer image for nextcloud:latest
b2b8cb3a61967ba08cb64490c6c8d2a173882560ae22fb0a6a45f895dea36912
also, see container running:
qinkangdeid@omv:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b2b8cb3a6196 nextcloud "/entrypoint.sh apac…" 42 seconds ago Up 38 seconds 0.0.0.0:8088->80/tcp nextcloud
cb81622828c1 mariadb "docker-entrypoint.s…" 7 minutes ago Up 5 minutes 0.0.0.0:3307->3306/tcp db_nextcloud
5b9d858e08ab opengg/aria2 "/init.sh" About an hour ago Up 5 minutes 0.0.0.0:6800->6800/tcp aria2
Visit NextCloud
I mapped the nextcloud service port to the host’s port 8088. After nextcloud starts, the browser can enter http://your IP:8088
to access nextcloud.
The interface at the beginning is as follows:
-
The first configuration is to configure an administrator username and password to access nextcloud in the future
-
The second item is the data directory. We have specified the location when we run the container, so we do n’t need to move here.
-
The third item is to configure the connection information of the external database. Fill in the information we created before
mariadb
. In fact, you can also connect the previous mariadb container when you install nextcloud. Here you fill it in manually. It should be noted that if the service port of the database is different from the host port, the port of the host must be written here. For example, the service port 3306 of my mariadb container is mapped to the port 3307 of the host. The port is 3307.
After all the information is filled in, click Install to complete. This step will take time. Nextcloud needs to create a database table and some initial configuration information.
Click Install
After the installation is complete, the following site will be displayed automatically
There will be some default example files
At this point nextcloud has been installed, you can continue to explore the features of NextCloud.
IV. NextCloud Extended Installation Method
Automatic configuration via environment variables
. You can pre-configure everything asked on the installation page when the nextcloud container is run for the first time. To enable automatic configuration,Database connections can be set through the following environment variables. But only one database type can be used!
The environment variables that Nextcloud currently supports are automatically configured as follows:
-
Configure database environment variables
-
For the parameters of the selected SQLITE_DATABASE database:
- SQLITE_DATABASE: The name of the database when using the SQLite database (we do not use this database so we do not need to take this parameter)
-
For the parameters of MYSQL / MariaDB database:
- MYSQL_DATABASE: The name of the database to use. The database of the mariadb container created here and before has been db_nextcloud
- MYSQL_USER: database username
- MYSQL_PASSWORD database username password
- MYSQL_HOST: The name of the configured database container docker run -d –name db_nextcloud The name specified by the –name parameter, which is db_nextcloud
-
For the parameters of the PostgreSQL database:
- POSTGRES_DB: the name of the postgres database
- POSTGRES_USER: postgres database username
- POSTGRES_PASSWORD password of the postgres database user (corresponds to the password of the username above)
- POSTGRES_HOST: the name of the configured database container
-
-
Configure environment variables for Nextcloud administrator user password
- NEXTCLOUD_ADMIN_USER: administrator username
- NEXTCLOUD_ADMIN_PASSWORD: Administrator password
-
Configure environment variables for Nextcloud data file address and table name prefix
- NEXTCLOUD_DATA_DIR: Nextcloud data storage location (default path is: / var / www / html / data) If this is not set, we can also use the -v parameter to map
- NEXTCLOUD_TABLE_PREFIX: database table table name prefix that nextcloud depends on (default: "") Optional
So the way to create the nextcloud container
is slightly changed. You can add it freely according to the above environment variables. The environment variables are appended with -e
. I only configure the database environment variables here, as shown in the following command:
docker run -d --name nextcloud \
--link db_nextcloud:db_nextcloud \
-p 8088:80 \
-p 4433:443 \
-e PUID=1000 \
-e PGID=100 \
-v /sharedfolders/nextcloud/html:/var/www/html \
-v /sharedfolders/nextcloud/data:/var/www/html/data \
-e MYSQL_DATABASE=nextcloud \
-e MYSQL_USER=nextcloud \
-e MYSQL_PASSWORD=123456 \
-e MYSQL_HOST=db_nextcloud \
--restart=unless-stopped \
nextcloud
My execution log:
root@omv:/sharedfolders/nextcloud# docker run -d --name nextcloud \
> --link db_nextcloud:db_nextcloud \
> -p 8088:80 \
> -e PUID=1000 \
> -e PGID=100 \
> -v /sharedfolders/nextcloud/html:/var/www/html \
> -v /sharedfolders/nextcloud/data:/var/www/html/data \
> -e MYSQL_DATABASE=nextcloud \
> -e MYSQL_USER=nextcloud \
> -e MYSQL_PASSWORD=123456 \
> -e MYSQL_HOST=db_nextcloud \
> --restart=unless-stopped \
> nextcloud
Unable to find image 'nextcloud:latest' locally
latest: Pulling from library/nextcloud
27833a3ba0a5: Already exists
2d79f6773a3c: Already exists
f5dd9a448b82: Already exists
95719e57e42b: Already exists
cc75e951030f: Already exists
78873f480bce: Already exists
1b14116a29a2: Already exists
887fc426d9b4: Pull complete
e8a2a7e68e47: Pull complete
44116bd4b499: Pull complete
5a7ed133cf7c: Pull complete
a0cc2e7ce3b9: Pull complete
3ea943f2a6e6: Pull complete
dc6fe404fa96: Pull complete
2970a87ebdd8: Pull complete
632923a6d419: Pull complete
78f88b7ec6fe: Pull complete
a62deb12226c: Pull complete
30d2885ecc94: Pull complete
5c72c2211abe: Pull complete
Digest: sha256:e4c59de7d564a7cec680d32ebed64bb7a7c53859d1c9dd6ef21912183719b203
Status: Downloaded newer image for nextcloud:latest
8aa333d93a38589c758efd44db429b28e65301205516d940c5e772212ce09b77
root@omv:/sharedfolders/nextcloud#
After nextcloud starts, the following screen appears when you access nextcloud for the first time:
Database and data volume configuration is gone, just need to create an administrator account
V. Install onlyoffice
onlyoffice is an online office suite that includes viewers and editors for text, spreadsheets and presentations, is fully compatible with Office Open XML formats: .docx, .xlsx, .pptx
and supports real-time collaborative editing. onlyoffice official website https://www.onlyoffice.com/
Document Management, Project Management, CRM, Calendar, Mail, and Enterprise Networks
.You no longer have to switch back and forth between multiple applications to perform different tasks.
A centralized, multi-functional system will help you organize every step of your management work, thereby increasing productivity and success.
If you want to get the online preview editing function of the document, then it is recommended that you install onlyoffice online office suite.
NextCloud’s application store has integrated onlyoffice. We only need to install and configure it to connect to the specified onlyoffice document server
. Now all we need to do is install onlyoffice document server
.
We still install the onlyoffice document server via docker:
docker run -i -t -d --name onlyoffice \
-p 8000:80 \
-e PUID=1000 \
-e PGID=100 \
--restart=unless-stopped \
-v /sharedfolders/nextcloud/onlyoffice/logs:/var/log/onlyoffice \
-v /sharedfolders/nextcloud/onlyoffice/data:/var/www/onlyoffice/Data \
onlyoffice/documentserver