当前位置:首页>科技>私有云盘搭建小型服务器NanoPiK2
发布时间:2026-07-21阅读(1)
上期和大家分享了 NanoPi K2 刷入 armbian 系统 做小型服务器 , 这期和大家分享下使用
小型服务器 NanoPi K2 搭建私有云盘

环境: anoPi K2 一台
软件: docker , nextcloud 镜像
为了简化安装流程,提高运行效率,这里小编使用docker 去部署
一、Armbian 更换国内源1、先查看系统版本
root@nanopik2-s905:~# lsb_release -a
No LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 20.04.1 LTSRelease: 20.04Codename: focal
2、修改源
#先备份原先的源
root@nanopik2-s905:~# cp /etc/apt/sources.list /etc/apt/sources.list-bak
root@nanopik2-s905:~# vim /etc/apt/sources.list
#把列表里面的deb开头用#注释掉,然后再添加进去以下的国内源
#到目前2020/12/6 还是可用的
小编使用的下面的,华为云镜像站
163镜像站 deb http://mirrors.163.com/debian/ buster main non-free contribdeb http://mirrors.163.com/debian/ buster-updates main non-free contribdeb http://mirrors.163.com/debian/ buster-backports main non-free contribdeb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib deb-src http://mirrors.163.com/debian/ buster main non-free contribdeb-src http://mirrors.163.com/debian/ buster-updates main non-free contribdeb-src http://mirrors.163.com/debian/ buster-backports main non-free contribdeb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib华为云镜像站deb https://mirrors.huaweicloud.com/debian/ buster main contrib non-freedeb https://mirrors.huaweicloud.com/debian/ buster-updates main contrib non-freedeb https://mirrors.huaweicloud.com/debian/ buster-backports main contrib non-freedeb https://mirrors.huaweicloud.com/debian-security/ buster/updates main contrib non-free deb-src https://mirrors.huaweicloud.com/debian/ buster main contrib non-freedeb-src https://mirrors.huaweicloud.com/debian/ buster-updates main contrib non-freedeb-src https://mirrors.huaweicloud.com/debian/ buster-backports main contrib non-free 腾讯云镜像站deb http://mirrors.cloud.tencent.com/debian/ buster main non-free contribdeb http://mirrors.cloud.tencent.com/debian-security buster/updates maindeb http://mirrors.cloud.tencent.com/debian/ buster-updates main non-free contribdeb http://mirrors.cloud.tencent.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.cloud.tencent.com/debian-security buster/updates maindeb-src http://mirrors.cloud.tencent.com/debian/ buster main non-free contribdeb-src http://mirrors.cloud.tencent.com/debian/ buster-updates main non-free contribdeb-src http://mirrors.cloud.tencent.com/debian/ buster-backports main non-free contrib中科大镜像站deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-freedeb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-freedeb https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-freedeb https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ buster main contrib non-freedeb-src https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-freedeb-src https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-freedeb-src https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free阿里云镜像站deb http://mirrors.aliyun.com/debian/ buster main non-free contribdeb http://mirrors.aliyun.com/debian-security buster/updates maindeb http://mirrors.aliyun.com/debian/ buster-updates main non-free contribdeb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian-security buster/updates maindeb-src http://mirrors.aliyun.com/debian/ buster main non-free contribdeb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contribdeb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib清华大学镜像站deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-freedeb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-freedeb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-freedeb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-freedeb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free兰州大学镜像站deb http://mirror.lzu.edu.cn/debian stable main contrib non-freedeb http://mirror.lzu.edu.cn/debian stable-updates main contrib non-freedeb http://mirror.lzu.edu.cn/debian/ buster-backports main contrib non-freedeb http://mirror.lzu.edu.cn/debian-security/ buster/updates main contrib non-free deb-src http://mirror.lzu.edu.cn/debian stable main contrib non-freedeb-src http://mirror.lzu.edu.cn/debian stable-updates main contrib non-freedeb-src http://mirror.lzu.edu.cn/debian/ buster-backports main contrib non-freedeb-src http://mirror.lzu.edu.cn/debian-security/ buster/updates main contrib non-free上海交大镜像站deb https://mirror.sjtu.edu.cn/debian/ buster main contrib non-freedeb https://mirror.sjtu.edu.cn/debian/ buster-updates main contrib non-freedeb https://mirror.sjtu.edu.cn/debian/ buster-backports main contrib non-freedeb https://mirror.sjtu.edu.cn/debian-security/ buster/updates main contrib non-free deb-src https://mirror.sjtu.edu.cn/debian/ buster-updates main contrib non-freedeb-src https://mirror.sjtu.edu.cn/debian/ buster-backports main contrib non-freedeb-src https://mirror.sjtu.edu.cn/debian/ buster main contrib non-freedeb-src https://mirror.sjtu.edu.cn/debian-security/ buster/updates main contrib non-free
附上官方全球镜像站列表地址:https://www.debian.org/mirror/list
3、更新:root@nanopik2-s905:~# apt-get updateroot@nanopik2-s905:~# apt-get upgrade
二、安装docker使用官方安装脚本自动安装,安装命令如下:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
也可以使用国内 daocloud 一键安装命令:
curl -sSL https://get.daocloud.io/docker | sh
安装好后,查看下安装的版本
root@aml:~# docker --versionDocker version 18.09.1, build 4c52b90
1、拉取官方镜像
root@aml:~# docker pull docker.io/nextcloudUsing default tag: latestTrying to pull repository docker.io/library/nextcloud ...latest: Pulling from docker.io/library/nextcloud802b00ed6f79: Already exists59f5a5a895f8: Pull complete6898b2dbcfeb: Pull complete8e0903aaa47e: Pull complete2961af1e196a: Pull complete71f7016f79a0: Pull complete5e1a48e5719c: Pull complete7ae5291984f3: Pull complete725b65166f31: Pull completee90b121f9520: Pull completeb5a272809bbd: Pull completef045f3ae0e2b: Pull complete7f51c9ea2d8e: Pull complete5aa9d0ed164a: Pull complete8eea44e2bfc7: Pull complete5302ebd5abce: Pull complete78f0335decb3: Pull complete1a2f85124682: Pull completeed4cec78a159: Pull completea68e1b656d3d: Pull completed0b66f00fda7: Pull complete45c9777c18b5: Pull completeDigest: sha256:c8d1091cc86051dc5e8de0114e3121fe0562cb417c56f2644ed92838008d8806Status: Downloaded newer image for docker.io/nextcloud:latest
2、启动容器
root@aml:~# docker run -d --restart=always --name nextcloud -p 9999:80 -v /nextcloud:/var/www/html nextcloud:latest
--name : 指定容器名称; -p 容器外端口:容器内端口 ; -v 容器外磁盘映射:容器内磁盘
root@aml:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESae96013c7f0a docker.io/nextcloud "/entrypoint.sh ap..." 6 seconds ago Up 6 seconds 0.0.0.0:9999->80/tcp nextcloud
这里可以看到已经在后台运行了,这就部署好了。
3、配置nextcloud
在浏览器地址栏输入你的IP地址:9999 可以访问到Nextcloud的Web页面。

接着完成完成网盘管理员账号的注册,使用默认数据库(当然,也可以起一个Mysql的容器来连接),然后完成注册,就可以登录了。

这样就愉快的搭建完成了

看下小编的最终效果图,已平稳运行200天


Copyright © 2024 有趣生活 All Rights Reserve吉ICP备19000289号-5 TXT地图HTML地图XML地图