-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRPi NAS
171 lines (136 loc) · 7.84 KB
/
RPi NAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# How to build a Raspberry Pi NAS
# To ensure your Raspberry Pi is set up correctly for networking, run:
sudo rm -f /etc/systemd/network/99-default.link
sudo reboot
# To install OpenMediaVault, run:
sudo wget -O - https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash
# Setting up OpenMediaVault
Open the internet browser on your usual computer and type your Raspberry Pi’s IP address into the address bar.
# Sign in to OpenMediaVault using the following credentials:
Username: admin
Password: openmediavault
# Set up network access
# Select Storage and then Disks. All your attached storage, including the SD card, should show. If not, double-check everything is plugged in correctly and reboot the system.
# Next, navigate to Storage and File Systems. You likely won’t see anything here, so select Create. Here, you can select your storage device. We recommend selecting EXT4 for the drive format. Select OK and close.
# Select the file system to mount it and apply changes.
# Now, we need to create a shared folder.
# Navigate to Storage and Shared Folders and select Create. Here you can name the folder, select which drive it should exist on, and grant permissions to users. By default, the permissions should be correct, but you can tweak them if you prefer a different option for your network preferences. Save and apply changes.
# Lastly, we need to make sure computers on your network can find the folder.
# Navigate to Services and select SMB/CIFS.
# Under Settings, check the Enabled box and save. Under Shares, select Create, add your shared folder, and save.
# Your NAS system should now be ready to use.
# Steps to Install Docker Compose on Raspberry Pi;
# Assign the .local Domain to Your Raspberry Pi
# Assign your Raspberry Pi a .local domain if you use it to host on your network. A .local domain enables you to access your Pi using a simple web address. With the .local domain, you don’t have to remember the IP address.
# To create a .local domain, install Avahi Daemon on your Pi;
sudo apt-get install avahi-daemon
# Once complete, you don’t need to reboot the device. Raspberry Pi will begin to recognize local network queries for its hostname. By default, the hostname is raspberrypi.
# Install git
# Install git as you will need it later.
sudo apt install git
# Upgrade Packages
# Update your package list with the command:
Sudo apt update
# Check installed packages to upgrade:
apt list --upgradable
# Upgrade packages to latest version:
sudo apt full-upgrade
# 3. Install Docker
# You can install Docker using the convenience script offered at get.docker.com.
# Download and install Docker script
# To do this, run the command;
curl -fsSL https://get.docker.com -o get-docker.sh
# Whenever you download scripts from the internet, examine them before running locally.
# Run the Docker install script
# Execute installation script through;
sudo sh get-docker.sh
# 4. Include a Non-Root Account to the Docker Group
# Automatically, only root users or those with administrative privileges can run the containers. If you are logged out as the root, you can utilize the sudo prefix.
# To execute docker commands and avoid typing the sudo each time, you can also add on-root users to the docker group.
# The syntax to add more accounts to the Docker group is:
sudo usermod -aG docker $pi
# To enhance the permissions to the existing user run:
sudo usermod -aG docker $pi
# Check whether it’s running:
groups $pi
# 5. Log Out then Back In
# If you run the command in (c) above, reboot Raspberry Pi for changes to get applied. Alternatively, you can run the command;
sudo su - $pi
# 6. Test Docker
# To confirm that Docker installed correctly, take a look at the Docker version.
# Run the command by typing;
# docker version.
# The output will show the Docker version and some extra information. If you'd like information about the whole system, that is, the kernel version, number of containers and images, and a more comprehensive description, type:
docker info
# Alternatively, you can run the hello-world image. The best way to test whether the Docker setup is correct is to run the Hello World container.
# You can do this by typing the command:
docker run hello-world
# The software will get in touch with the Docker daemon, pull the “hello-world” image, and generate a new container depending on that image.
# After completing all the steps, the output should let you know that your installation appears to be working correctly.
# To remove the image:
docker image rm hello-world
# 7. Install Docker-Compose
# You can install Docker Compose from pre-built binaries that you download from the release page for the project.
# To install Docker-Compose, you’ll need to use pip3. Therefore, you need to install python 3 and pip3. If it’s not present, execute the following commands;
sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip
# With pip3 and python3 installed, it’s possible to install Docker-Compose via the command;
sudo pip3 install docker-compose
# 8. Allow the Docker System Service to Launch your Containers on Boot
# Since it’s a great and crucial addition, you can customize your Raspberry Pi to run the service with the Docker system automatically when it starts up.
# Use the command
sudo systemctl to enable Docker
# to run the Docker anytime it boots up. Containers with a relaunch policy set to unless-stopped or always automatically restart following a reboot.
# Sample Docker Compose file
# Here is an example of a Docker – Compose file that launches three containers. When started, the containers will come up automatically when the Raspberry Pi gets full power cycled.
# Run this command to start the containers using Docker-Compose;
docker-compose -f docker-compose.yaml up -d
#Go to Docker Speed Test project HYPERLINK "https://github.com/robinmanuelthiel/speedtest" on GitHub to learn more about this sample.
==============================================================================================================================================================
https://www.pcmag.com/how-to/how-to-turn-a-raspberry-pi-into-a-nas-for-whole-home-file-sharing
Install Raspbian OS
sudo fdisk -l
#if you're using a terminal over SSH, you'll have to run:
umount /dev/sda1
#Depending on the drive, you may need to also run umount /dev/sda2, umount /dev/sda3, and so on, depending on how many partitions are on the drive from previous usage.
#Then, to erase and format your flash drive for Linux usage, run:
sudo parted /dev/sda
mklabel gpt
#If prompted to erase the drive, type y and press Enter. Then run:
mkpart
MyExternalDrive
ext4
0%
100%
quit
#Next, we'll need to format that partition. If your drive is located at /dev/sda, the new partition will be located at /dev/sda1 (if the drive is /dev/sdb, you'll use /dev/sdb1, and so on):
sudo mkfs.ext4 /dev/sda1
#Press y and Enter when asked if you want to proceed. Then run:
sudo e2label /dev/sda1 MyExternalDrive
sudo shutdown -r now
sudo chown -R pi /media/pi/MyExternalDrive
sudo apt update
sudo apt upgrade
sudo apt install samba samba-common
sudo nano /etc/samba/smb.conf
[MyMedia]
path = /media/pi/MyExternalDrive/
writeable = yes
create mask = 0775
directory mask = 0775
public=no
Ctrl+X Yes Enter
sudo smbpasswd -a pi
sudo systemctl restart smbd
Access Your Media
And everything should be ready to rock. Head to your Windows PC, open a File Explorer window
and type \\raspberrypi\MyMedia in the address bar (replacing MyMedia with whatever your share is called).
If you press Enter, you should be able to enter your Samba username (pi) and password and see your shared drive.
If you run into trouble, you might have to use the Pi's IP address, like \\192.168.1.10\MyMedia instead.
To connect on a Mac, open Finder and click Go > Connect to Server, typing in smb://raspberrypi when prompted.