树莓派搭建文件服务器

1.树莓派镜像下载地址

https://www.raspberrypi.org/downloads/raspberry-pi-os/

1.png

2.烧录镜像到sd卡

安装 Etcher 之后启动 Etcher,插入 SD 卡、选择要安装的 img 文件、选择 SD 卡对应的磁盘分区
https://www.balena.io/etcher/

3.配置网络和ssh

① 新建一个ssh空白文件,放到root目录下,树莓派开机会自动启用
② 网络优先选择有线网络
③ 无线网络
将刷好 Raspbian 系统的 SD 卡用电脑读取。在 boot 分区,也就是树莓派的 /boot 目录下新建

wpa_supplicant.conf 文件,按照下面的参考格式填入内容并保存 wpa_supplicant.conf 文件。
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="WiFi-A"
psk="12345678"
key_mgmt=WPA-PSK
priority=1
}
 
network={
ssid="WiFi-B"
psk="12345678"
key_mgmt=WPA-PSK
priority=2
scan_ssid=1
}

具体详情看下面
https://shumeipai.nxez.com/2017/09/13/raspberry-pi-network-configuration-before-boot.html

4.ssh登陆

方法1:利用路由器软件查看IP地址

方法2:

ping raspberrypi.local

ssh连接默认用户名:pi 密码:raspberry

方法3:IP Scanner

5.修改软件镜像源

1.切换 root权限 sudo su
2.编辑下列文件

# 编辑 `/etc/apt/sources.list` 文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi

# 编辑 `/etc/apt/sources.list.d/raspi.list` 文件,删除原文件所有内容,用以下内容取代:
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
  1. 更新软件
sudo apt update  # 读取本地软件最新的版本信息
sudo apt upgrade # 软件升级到最新版本

6.修改hosts文件

连接raw.githubusercontent.com失败
step1 :
https://site.ip138.com/raw.Githubusercontent.com/
输入raw.githubusercontent.com查询IP地址
step2 :
sudo nano /etc/hosts
你查到的ip地址,香港的就行 raw.githubusercontent.com
比如:
151.101.76.133 raw.githubusercontent.com

7.执行安装脚本

OpenMediaVault项目地址:
https://github.com/OpenMediaVault-Plugin-Developers/installScript

执行安装脚本:

sudo wget -O - https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash

8.配置OpenMediaVault

step1:
输入树莓派的IP地址
初始用户名:admin
密码:openmediavault
step2:
1.连接硬盘
2.文件系统—>卸载硬盘
3.磁盘—>擦除
4.文件系统—>新建 文件系统选择EXT4
5.挂载—>应用
6.共享文件夹—>新建一个文件夹 设置权限
7.SMB/CIFS —>启用
8.共享—>添加共享

mac登陆
前往:连接服务器 smb://树莓派的ip地址
windows
我的电脑—>右键—>映射网络驱动器—>找到共享的文件夹

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。