Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Workshop Raspberry Pi NAS with Windows Share

682 views

Published on

Raspberry Pi 4 with Rasbian and Samba for Windows shares.

Published in: Devices & Hardware
  • Be the first to comment

  • Be the first to like this

Workshop Raspberry Pi NAS with Windows Share

  1. 1. Workshop NAS on Raspberry Pi 4 Michael Plate 08.12.2019
  2. 2. Agenda • Hardware requirements • Software requirements • Install Raspbian • Additional configuration of Raspbian • Setup external HDD • Setup Samba Server
  3. 3. Hardware requirements • Raspberry Pi 4 Computer Modell B, 1GB RAM • Adapter cable from micro HDMI (Type D) to HDMI (Type A) • official Raspberry Pi USB-C power supply 5,1V / 3,0A • piece heat sink set for Raspberry Pi 4 • microSDHC 32GB • SEAGATE Expansion Portable, 5TB HDD, 2.5 Zoll, extern • PC with card reader • USB Keyboard for Raspberry Pi
  4. 4. Software requirements • Raspian Buster Lite We don't need a desktop for a server, so the Lite version is a good choice. • balenaEtcher Flash OS images to SD cards & USB drives
  5. 5. Install Raspbian • Download Raspian Buster Lite Link: https://downloads.raspberrypi.org/raspbian_lite_latest • Download balenaEtcher Link: https://www.balena.io/etcher/ • flash Raspian Buster Lite image to sd card Link: http://www.linuxandubuntu.com/home/etcher-burn-images-to-sd- card-make-bootable-usb
  6. 6. Install Raspbian • Connect your Raspberry pi with your monitor, network (LAN) and keyboard • Insert the SD card into the raspberry pi • Connect the power supply and watch the output on the monitor. • First the SD card is prepared, and a restart is required. • Log in with the login pi and password raspberry. NOTE: On a german keyboard z and y are swapped! • For remote access you must activate ssh manually with follows commands sudo systemctl enable ssh sudo systemctl start ssh
  7. 7. Install Raspbian • Shutdown your raspberry pi with sudo poweroff • You can now remotely access the Raspberry Pi using SSH. • Disconnect your monitor and keyboard from raspberry pi • Startup your raspberry pi
  8. 8. Additional configuration of Raspbian • Start a terminal on your computer and execute the following command: ssh pi@<ip-address> • You still have to change other configurations such as password. Use command: sudo raspi-config • Checklist: • Change hostname • Change password • Change your keyboard settings
  9. 9. Setup external HDD • Setup and use the LogicalVolume Manager (LVM) sudo apt-get install lvm2 • Connect your external HDD to USB 3 Port (blue) and wait for a moment • With the following command you should see your drive. sudo lsblk –f
  10. 10. Setup external HDD • Hard disk is set up with LVM. PV_DEV="/dev/sda2“ sudo umount "${PV_DEV}“ sudo pvcreate "${PV_DEV}“ VG_NAME="vhd1“ sudo vgcreate "${VG_NAME}" "${PV_DEV}“ sudo vgdisplay Based on https://howto.biapy.com/en/debian-gnu-linux/system/setup/setup-and-use-the-logical-volume-manager-lvm-on-debian
  11. 11. Setup external HDD LV_NAME="backup-var“ VG_NAME="$(sudo vgdisplay | sudo grep "VG Name" | sudo head --lines=1 | sudo cut --characters=25-)“ sudo lvcreate -n "${LV_NAME}" -l100%FREE "${VG_NAME}“ sudo mkfs -t ext4 "/dev/${VG_NAME}/${LV_NAME}“ sudo mkdir /media/backup-var Based on https://howto.biapy.com/en/debian-gnu-linux/system/setup/setup-and-use-the-logical-volume-manager-lvm-on-debian
  12. 12. Setup external HDD sudo blkid | grep vhd1-backup--var open file with sudo nano /etc/fstab and insert this line at the end. UUID=f843cba9-8aec-4dd7-831d-7383ea49bd1d /media/backup-var ext4 defaults 0 0 Based on https://howto.biapy.com/en/debian-gnu-linux/system/setup/setup-and-use-the-logical-volume-manager-lvm-on-debian
  13. 13. Setup Samba Server • Install Samba Server sudo apt-get update sudo apt-get install samba samba-common smbclient • Check Samba Server sudo service smbd status sudo service nmbd status • Basic configuration of the Samba server sudo mv /etc/samba/smb.conf /etc/samba/smb.conf_old sudo nano /etc/samba/smb.conf
  14. 14. Setup Samba Server • The Content of /etc/samba/smb.conf [global] workgroup = WORKGROUP security = user encrypt passwords = yes client min protocol = SMB2 client max protocol = SMB3
  15. 15. Setup Samba Server • Check configuration with testparm If you see the following messages, then you should still execute this here. Open config file with: sudo nano /etc/security/limits.conf And add at the end * - nofile 16384 root - nofile 16384 reboot your raspberry pi
  16. 16. Setup Samba Server • Create a folder for samba share: sudo mkdir /media/backup-var/backup sudo chown root:root /media/backup-var/backup sudo chmod 777 /media/backup-var/backup • Open smb.conf sudo nano /etc/samba/smb.conf • Add this at end [backup] comment = Samba-Backup-Share path = /media/backup-var/backup read only = no
  17. 17. Setup Samba Server • Close file and check this file with testparm • Restart Samba Server with: sudo service smbd restart sudo service nmbd restart
  18. 18. Setup Samba Server • Add user to linux and Samba Server sudo useradd -M pi-share sudo smbpasswd -a pi-share • open yourWindows Explorer and visit nas-01backup <ip-address>backup
  19. 19. Setup Samba Server At this point you have a simple Windows share installed on the Raspberry Pi. !!! Please note that this configuration exists only for this workshop and is not intended for the productive environment. !!!

×