基于Openmediavault(OMV)搭建私人NAS服务器

2019-02-09  本文已影响0人  syhc006

基于Debian操作系统安装OMV

cat <<EOF >> /etc/apt/sources.list.d/openmediavault.list
deb http://packages.openmediavault.org/public arrakis main
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis main
## Uncomment the following line to add software from the proposed repository.
# deb http://packages.openmediavault.org/public arrakis-proposed main
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis-proposed main
## This software is not part of OpenMediaVault, but is offered by third-party
## developers as a service to OpenMediaVault users.
# deb http://packages.openmediavault.org/public arrakis partner
# deb http://downloads.sourceforge.net/project/openmediavault/packages arrakis partner
EOF
export LANG=C
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
apt-get update
apt-get --allow-unauthenticated install openmediavault-keyring
apt-get update
apt-get --yes --auto-remove --show-upgraded \
    --allow-downgrades --allow-change-held-packages \
    --no-install-recommends \
    --option Dpkg::Options::="--force-confdef" \
    --option DPkg::Options::="--force-confold" \
    install postfix openmediavault
# Initialize the system and database.
omv-initsystem
wget http://omv-extras.org/openmediavault-omvextrasorg_latest_all4.deb
dpkg -i openmediavault-omvextrasorg_latest_all4.deb 
apt-get -f inall
apt-get -f install
apt update

基于OMV安装Virtual Box

apt-get install linux-headers-4.9.0-8-amd64

基于OMV安装Docker

基于FRP实现内网穿透-参考

wget https://github.com/fatedier/frp/releases/download/v0.20.0/frp_0.20.0_linux_amd64.tar.gz
tar -zxvf frp_0.20.0_linux_amd64.tar.gz
rm -f frpc
rm -f frpc.ini
[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443

dashboard_user = admin
dashboard_pwd = admin
dashboard_port = 7500
auth_token = 123
./frps -c frps.ini
wget https://github.com/fatedier/frp/releases/download/v0.20.0/frp_0.20.0_linux_amd64.tar.gz
tar -zxvf frp_0.20.0_linux_amd64.tar.gz
rm -f frps
rm -f frps.ini
[common]
server_addr = 云主机公网IP
server_port = 7000
auth_token = 123

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

[nas-admin]
type = http
local_ip = 内网NAS主机IP
local_port = 80
custom_domains = 自定义域名(可以是花生壳的域名,需要将此域名关联到云主机的公网IP)

[smb]
type = tcp
local_ip = 内网NAS主机IP
local_port = 445
remote_port = 6001
./frpc -c frpc.ini

FRP服务端docker镜像制作-参考

FROM ubuntu
MAINTAINER sunyu <sunyu-1987@qq.com>

ARG FRP_VERSION=0.20.0

RUN apt update \
    && apt install -y wget

WORKDIR /tmp
RUN set -x \
    && wget https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz \
    && tar -zxf frp_${FRP_VERSION}_linux_amd64.tar.gz \
    && mv frp_${FRP_VERSION}_linux_amd64 /var/frp \
    && mkdir -p /var/frp/conf \
    && apt remove -y wget \
    && apt autoremove -y \
    && rm -rf /var/lib/apt/lists/*

COPY conf/frps.ini /var/frp/conf/frps.ini

VOLUME /var/frp/conf

WORKDIR /var/frp
ENTRYPOINT ./frps -c ./conf/frps.ini
docker build -t frp-server .
docker run -d --name frp-server --net=host frp-server

FRP客户端docker镜像制作

FROM ubuntu
MAINTAINER sunyu <sunyu-1987@qq.com>

ARG FRP_VERSION=0.20.0

RUN apt update \
    && apt install -y wget

WORKDIR /tmp
RUN set -x \
    && wget https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz \
    && tar -zxf frp_${FRP_VERSION}_linux_amd64.tar.gz \
    && mv frp_${FRP_VERSION}_linux_amd64 /var/frp \
    && mkdir -p /var/frp/conf \
    && apt remove -y wget \
    && apt autoremove -y \
    && rm -rf /var/lib/apt/lists/*

COPY conf/frpc.ini /var/frp/conf/frpc.ini

VOLUME /var/frp/conf

WORKDIR /var/frp
ENTRYPOINT ./frpc -c ./conf/frpc.ini
docker build -t frp-client .
docker run -d --name frp-client --net=host frp-client
上一篇下一篇

猜你喜欢

热点阅读