@@ -6,8 +6,51 @@ tags: ["docker", "linux", "nextcloud"] # TAG names should always be lowercas
66description : Docker Compose code to install nexcloud on docker
77---
88
9- ## Docker Compose code to install nexcloud on docker
9+ # Docker Compose code to install nexcloud on docker
1010
11+ ## Install Docker and Docker Compose
12+ ### Install Docker:
13+ ```
14+ sudo apt update
15+ sudo apt install docker.io -y
16+ ```
17+ ### Install Docker Compose:
18+
19+ ```
20+ sudo apt install docker-compose -y
21+ Start and Enable Docker:
22+ ```
23+ ```
24+ sudo systemctl start docker
25+ sudo systemctl enable docker
26+ ```
27+ ### Add Your User to the Docker Group (Optional):
28+
29+ ```
30+ sudo usermod -aG docker $USER
31+ Log out and back in for this to take effect.
32+ ```
33+ 1 . Install Portainer
34+ - Run Portainer Using Docker:
35+ ```
36+ docker volume create portainer_data
37+ docker run -d -p 8000:8000 -p 9443:9443 --name portainer \
38+ --restart=always -v /var/run/docker.sock:/var/run/docker.sock \
39+ -v portainer_data:/data portainer/portainer-ce:latest
40+ ```
41+ - Access Portainer:
42+
43+ Open a browser and go to https://<your-server-ip >:9443.
44+ Follow the setup process to create an admin user.
45+
46+ 4 . Set Up Nextcloud Using Docker Compose in Portainer
47+ - Step 1: Create a Docker Compose Stack
48+ Log in to Portainer.
49+ Navigate to Stacks > Add Stack.
50+ Name your stack, e.g., nextcloud-stack.
51+
52+ - Step 2: Add the Compose Configuration
53+ Paste the following Docker Compose configuration in the editor:
1154```
1255version: '3.8'
1356
@@ -24,21 +67,36 @@ services:
2467 - MYSQL_HOST=db
2568 - MYSQL_DATABASE=nextcloud
2669 - MYSQL_USER=nextclouduser
27- - MYSQL_PASSWORD=Mehraj@#2011
70+ - MYSQL_PASSWORD=your_password
2871
2972 db:
3073 image: mariadb:latest
3174 container_name: nextcloud_db
3275 restart: always
3376 environment:
34- - MYSQL_ROOT_PASSWORD=Mehraj@#2011
77+ - MYSQL_ROOT_PASSWORD=your_root_password
3578 - MYSQL_DATABASE=nextcloud
3679 - MYSQL_USER=nextclouduser
37- - MYSQL_PASSWORD=Mehraj@#2011
80+ - MYSQL_PASSWORD=your_password
3881 volumes:
3982 - db_data:/var/lib/mysql
4083
4184volumes:
4285 nextcloud_data:
4386 db_data:
87+ Replace your_password and your_root_password with secure passwords.
4488```
89+ - Step 3: Deploy the Stack
90+ Click Deploy the Stack.
91+ Portainer will pull the required images and start the containers.
92+ - 5 . Access Nextcloud
93+ Open your browser and navigate to http://<your-server-ip >:8080.
94+
95+ Complete the Nextcloud setup wizard:
96+ Database host: db
97+ Database name: nextcloud
98+ Database user: nextclouduser
99+ Database password: your_password
100+ - 6 . Secure with HTTPS (Optional)
101+
102+ To secure Nextcloud, you can set up a reverse proxy with Nginx or Traefik using Let's Encrypt. Let me know if you want guidance on that!
0 commit comments