Docker+Nextcloud快速部署我的網盤

各位大佬好,,,萌新顧北清又回來更新了,今天要快速部署一我的網盤。
有多快呢,,,5分鐘吧,由於咱們使用Docker部署。
Docker基礎能夠看看我以前的博文。(點這裏點這裏
那麼,,,開始吧。php

實驗環境:小夥伴的阿里雲服務器,安裝的是Centos7的系統,要安裝的網盤叫Nextcloud
若是是debain,須要先修改一下源。
在/etc/apt/sources.list文件下添加一條源html

deb http://http.debian.net/debian jessie-backports main

而後執行apt-get update命令更新源。linux

下面開始安裝
第一步
老規矩,先安裝Docker環境.
命令以下:git

[root@izt8mvnno1ny1dz ~]# yum install -y docker
Loaded plugins: fastestmirror
base                                                                                                                                    | 3.6 kB  00:00:00
epel                                                                                                                                    | 3.2 kB  00:00:00
extras                                                                                                                                  | 3.4 kB  00:00:00
updates                                                                                                                                 | 3.4 kB  00:00:00
Loading mirror speeds from cached hostfile
Package 2:docker-1.13.1-74.git6e3bb8e.el7.centos.x86_64 already installed and latest version
Nothing to do

我這裏已經安裝完成就不重複安裝了。
啓動docker並設置自啓:web

[root@izt8mvnno1ny1dz ~]# systemctl start docker
[root@izt8mvnno1ny1dz ~]# systemctl enable docker

第二步
查找Nextcloud網盤的鏡像sql

[root@izt8mvnno1ny1dz ~]# docker search nextcloud
INDEX       NAME                                      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
docker.io   docker.io/nextcloud                       A safe home for all your data                   561       [OK]
docker.io   docker.io/linuxserver/nextcloud           A Nextcloud container, brought to you by L...   81
docker.io   docker.io/greyltc/nextcloud               Nextcloud: a safe home for all your data. ...   38                   [OK]
docker.io   docker.io/wonderfall/nextcloud            All-in-one alpine-based Nextcloud image.        36                   [OK]
docker.io   docker.io/rootlogin/nextcloud             Nextcloud docker image running on top of N...   17                   [OK]
docker.io   docker.io/lsioarmhf/nextcloud             ARMHF based Linuxserver.io image of nextcloud   9
docker.io   docker.io/arm32v7/nextcloud               A safe home for all your data                   8
docker.io   docker.io/benyanke/nextcloud              Fork of wonderfall/nextcloud, since it is ...   7                    [OK]
docker.io   docker.io/ownyourbits/nextcloudpi         NextCloud ARM docker container                  7
docker.io   docker.io/sameersbn/nextcloud             Dockerized Nextcloud                            7                    [OK]
docker.io   docker.io/ownyourbits/nextcloudpi-armhf   NextCloudPi ARM docker container                6
docker.io   docker.io/hoellen/nextcloud               Based on wonderfall/nextcloud                   5                    [OK]
docker.io   docker.io/aheimsbakk/nextcloud            DEPRECATED in favor of the Nextcloud webin...   2                    [OK]
docker.io   docker.io/crazymax/nextcloud              Nextcloud Docker image based on Alpine Lin...   1
docker.io   docker.io/lsioarmhf/nextcloud-aarch64     ARM64 based Linuxserver.io image of nextcl...   1
docker.io   docker.io/zerpex/nextcloud-ocdl           Nextcloud with ocDownloader pre-requiresites    1                    [OK]
docker.io   docker.io/avhost/docker-nextcloud         nextcloud as docker service                     0                    [OK]
docker.io   docker.io/bunix42/nextcloud               Docker Image for Nextcloud, based on the o...   0
docker.io   docker.io/dheaps/nextcloud-cron           Cron service for Nextcloud                      0                    [OK]
docker.io   docker.io/ftsystems/nextcloud             Nextcloud container based on the owncloud ...   0
docker.io   docker.io/gorlug/nextcloud                https://nextcloud.com/                          0                    [OK]
docker.io   docker.io/sesceu/nextcloud                nextcloud with cron and imap-auth               0                    [OK]
docker.io   docker.io/trollin/nextcloud                                                               0
docker.io   docker.io/whatwedo/nextcloud              Nextcloud powered by Apache                     0                    [OK]
docker.io   docker.io/zyrill/nextcloud                 Nextcloud v12 based on php:fpm-alpine          0

依舊老規矩,使用官方鏡像docker

第三步
拉取官方的Docker鏡像數據庫

[root@izt8mvnno1ny1dz ~]# docker pull docker.io/nextcloud
Using default tag: latest
Trying to pull repository docker.io/library/nextcloud ...
latest: Pulling from docker.io/library/nextcloud
802b00ed6f79: Already exists
59f5a5a895f8: Pull complete
6898b2dbcfeb: Pull complete
8e0903aaa47e: Pull complete
2961af1e196a: Pull complete
71f7016f79a0: Pull complete
5e1a48e5719c: Pull complete
7ae5291984f3: Pull complete
725b65166f31: Pull complete
e90b121f9520: Pull complete
b5a272809bbd: Pull complete
f045f3ae0e2b: Pull complete
7f51c9ea2d8e: Pull complete
5aa9d0ed164a: Pull complete
8eea44e2bfc7: Pull complete
5302ebd5abce: Pull complete
78f0335decb3: Pull complete
1a2f85124682: Pull complete
ed4cec78a159: Pull complete
a68e1b656d3d: Pull complete
d0b66f00fda7: Pull complete
45c9777c18b5: Pull complete
Digest: sha256:c8d1091cc86051dc5e8de0114e3121fe0562cb417c56f2644ed92838008d8806
Status: Downloaded newer image for docker.io/nextcloud:latest

鏡像拉取完成centos

第四步
容器拉取到本地以後,就該啓用容器了。瀏覽器

[root@izt8mvnno1ny1dz ~]# docker run -d --restart=always --name nextcloud -p 80:80 -v /root/nextcloud:/data docker.io/nextcloud
ae96013c7f0ab05194a4488d1fa61b1c6274c272a53b3d418418b56a88e2e230
[root@izt8mvnno1ny1dz ~]# docker ps -a
CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                NAMES
ae96013c7f0a        docker.io/nextcloud   "/entrypoint.sh ap..."   6 seconds ago       Up 6 seconds        0.0.0.0:80->80/tcp   nextcloud

這裏能夠看到已經在後臺運行了,這就部署好了。

第五步
在瀏覽器地址欄輸入你的IP地址,能夠訪問到NextcloudWeb頁面。

若是訪問不到,先重啓一下docker服務,命令以下:

[root@izt8mvnno1ny1dz ~]# systemctl restart docker

若是仍是不行,那麼就關閉防火牆服務吧。

[root@izt8mvnno1ny1dz ~]# systemctl stop firewalld
[root@izt8mvnno1ny1dz ~]# systemctl status firewalld    //查看一下防火牆狀態
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
    Docs: man:firewalld(1)

Sep 20 13:44:49 izt8mvnno1ny1dz systemd[1]: Starting firewalld - dynamic firewall daemon...
Sep 20 13:44:50 izt8mvnno1ny1dz systemd[1]: Started firewalld - dynamic firewall daemon.
Sep 20 13:44:57 izt8mvnno1ny1dz systemd[1]: Stopping firewalld - dynamic firewall daemon...
Sep 20 13:44:57 izt8mvnno1ny1dz systemd[1]: Stopped firewalld - dynamic firewall daemon.
Sep 20 15:33:49 izt8mvnno1ny1dz systemd[1]: Starting firewalld - dynamic firewall daemon...
Sep 20 15:33:49 izt8mvnno1ny1dz systemd[1]: Started firewalld - dynamic firewall daemon.
Sep 20 15:34:58 izt8mvnno1ny1dz systemd[1]: Stopping firewalld - dynamic firewall daemon...
Sep 20 15:34:58 izt8mvnno1ny1dz systemd[1]: Stopped firewalld - dynamic firewall daemon.

接着完成完成網盤管理員帳號的註冊,使用默認數據庫(固然,也能夠起一個Mysql的容器來鏈接),而後完成註冊,就能夠登陸了。


這樣就愉快的搭建完成了,是否是五分鐘快速搭建!
最後扔下本身的我的博客連接 https://www.gubeiqing.cn/

相關文章
相關標籤/搜索