Armbian linux as nas
Step by step configuration linux as nas
🚀 Step-by-Step Guide for Setting Up Your Debian Server
1. Install sudo
Command
- Switch to root user:
su -
- Install
sudo
:apt-get install sudo
- Add user to sudo groups:
usermod -aG sudo username
- Check user groups:
id username
- Logout and login SSH again.
2. 🐋 Install Docker & Portainer 2.0 on Debian-Based Distros
-
Install Docker:
sudo apt install docker.io sudo systemctl start docker
-
Download and run Portainer 2.0:
sudo docker pull portainer/portainer-ce sudo docker run --restart=always --name=portainer -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce
-
Access Portainer at http://[WORKSTATION_IP_ADDRESS]:9000 and create a username and password.
-
Give user permission for Docker:
sudo groupadd docker sudo usermod -aG docker $USER logout & login ssh
3. 📦 Install Docker Compose v2
-
Create the directory for Docker CLI plugins:
sudo mkdir -p /usr/local/lib/docker/cli-plugins
-
Download Docker Compose v2:
- For x86 device:
sudo curl -SL https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-x86_64 -o /usr/local/lib/docker/cli-plugins/docker-compose
- For ARM device:
sudo curl -SL https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-aarch64 -o /usr/local/lib/docker/cli-plugins/docker-compose
- For x86 device:
-
Make it executable:
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
-
Verify installation:
docker compose version
4. 👤 Add a New User and Assign to sudo
and docker
Groups
-
Add a new user:
sudo adduser new_username
Follow the prompts to set the user’s password and other details.
-
Add the user to the
sudo
group:sudo usermod -aG sudo new_username
-
Add the user to the
docker
group:sudo usermod -aG docker new_username
-
Check user groups to confirm:
id new_username
5. 💾 Mount Hard Disk in Armbian
-
Check hard disk:
lsblk sudo blkid
-
Mount hard disk:
sudo mkdir /mnt/wd sudo chown -hR $(whoami):$(whoami) /mnt/wd
-
Edit
/etc/fstab
to auto-mount on boot:sudo blkid sudo nano /etc/fstab
Add:
UUID="ID From blkid" /mnt/wd ext4 rw,user,auto 0 0
-
Reboot:
sudo reboot
6. 🗂️ Set up Samba Shares
-
Install Samba:
sudo apt-get install samba samba-common-bin
-
Edit Samba configuration:
sudo nano /etc/samba/smb.conf
Add:
[mynas] comment = Samba on My NAS path = /mnt/wd read only = no browsable = yes
-
Create shared directory:
sudo mkdir -p /mnt/wd sudo chown nobody:nogroup /mnt/wd sudo chmod 0775 /mnt/wd
-
Add Samba user:
sudo smbpasswd -a $(whoami) sudo smbpasswd -a anotheruser
-
Restart Samba:
sudo service smbd restart
-
Connect to the share:
- From Windows:
\\IP address of NAS
- From Linux:
smb://IP address of NAS
- From Windows:
-
If you are unable to access from Windows, try rebooting your Windows machine and test again.
-
Verify Samba status:
sudo systemctl status smbd
-
Troubleshooting:
- Ensure firewall allows SMB traffic.
- Verify SELinux or AppArmor settings.
- Check user permissions and passwords.
- Look at logs in
/var/log/samba/
.
7. 🌐 View Linux Machines from a Windows 10 Network
-
Install WSD on Ubuntu:
cd /tmp wget https://github.com/christgau/wsdd/archive/master.zip unzip master.zip sudo mv wsdd-master/src/wsdd.py wsdd-master/src/wsdd sudo cp wsdd-master/src/wsdd /usr/bin sudo cp wsdd-master/etc/systemd/wsdd.service /etc/systemd/system sudo nano /etc/systemd/system/wsdd.service
Comment out:
; User=nobody ; Group=nobody
-
Reload daemon and start WSDD:
sudo systemctl daemon-reload sudo systemctl start wsdd sudo systemctl enable wsdd
-
Check service status:
sudo service wsdd status
-
Reboot Windows and Ubuntu machines if necessary.
8. ❌ Disable ZRAM (Optional)
-
Edit configuration:
sudo vim /etc/default/armbian-zram-config
Uncomment:
SWAP=false
-
Reboot:
sudo reboot
Add New Raid to system Debian
-
Install mdadm
First, you’ll need to install the mdadm package if it’s not already installed.
sudo apt update sudo apt install mdadm
-
Identify the Disks
Identify the disks you want to use for the RAID array. You can use lsblk or fdisk -l to list all available disks.
lsblk
Make a note of the device names (e.g., /dev/sdb, /dev/sdc, etc.).
-
Create the RAID Array
Use mdadm to create the RAID array. The following example creates a RAID 1 array (mirroring) with two disks:
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
- /dev/md0 is the RAID device name.
- –level=1 specifies the RAID level (RAID 1 in this case).
- –raid-devices=2 specifies the number of devices in the array.
- /dev/sdb and /dev/sdc are the disks to be used in the RAID array.
-
Create a Filesystem
Once the RAID array is created, you need to create a filesystem on it. For example, to create an ext4 filesystem:
sudo mkfs.ext4 /dev/md0
-
Mount the RAID Array
Create a mount point and mount the RAID array:
sudo mkdir -p /mnt/raid
sudo mount /dev/md0 /mnt/raid
-
Update /etc/fstab
To ensure the RAID array is mounted automatically at boot, add an entry to /etc/fstab. First, get the UUID of the RAID array:
sudo blkid /dev/md0
Add the following line to /etc/fstab, replacing UUID= with the actual UUID:
UUID=<your-uuid> /mnt/raid ext4 defaults 0 0
-
Verify the RAID Array
You can check the status of the RAID array using:
sudo mdadm --detail /dev/md0
10. ⚙️ Mount RAID 0 on Debian
-
Install
mdadm
:sudo apt-get update sudo apt-get install mdadm
-
Assemble RAID array:
sudo mdadm --assemble --scan
-
Verify RAID array:
cat /proc/mdstat
-
Mount RAID array:
sudo mkdir -p /mnt/raid0 sudo mount /dev/md0 /mnt/raid0
-
Verify mount:
df -h lsblk
-
Auto-mount on boot:
sudo blkid /dev/md0 sudo nano /etc/fstab
Add:
UUID=your-raid-uuid /mnt/raid0 ext4 defaults 0 0
Replace
your-raid-uuid
with UUID fromblkid
command.
🎉 Your server is now set up and ready to use! Enjoy!