JustToThePoint English Website Version
JustToThePoint en español
JustToThePoint in Thai

Servers: Samba, NFS, Webtop, and Nextcloud

  1. Prepare the hard drive (sdb1, let’s suppose a second hard drive). We can find its UUID (UUID stands for Universally Unique Identifier) by typing: ls -la /dev/disk/by-uuid […] root root 10 Mar 28 04:23 ece31d22-201d-4421-b540-4337b029d72f -> ../../sdb1. Let’s edit fstab: sudo vi /etc/fstab and add a line like this:
    UUID=ece31d22-201d-4421-b540-4337b029d72f (device or filesystem to be mounted) /media/mydisk (mount point for the filesystem) ext4 (it describes the type of the filesystem) nofail,auto (options: nofail, do not report errors for this device if it does not exist; auto, the filesystem can be mounted automatically) 0 (dump option. It is seldom used so if you are in doubt, just use 0) 0 (disable checking the file system at boot).
    
  2. sudo mount -a: it causes all filesystems mentioned in fstab to be mounted as indicated.
  3. Install Samba: sudo apt install samba. Arch: sudo pacman samba
  4. Configure Samba: sudo vi /etc/samba/smb.conf
        [pi] # Each section in the configuration file describes a shared resource
          path = /media/mydisk/samba # This is the shared resource's path     
          comment = My Samba Share # Comment string to be associate with the new shared resource     
          browseable = yes # The resource is seen in the list of available shares in a net view and in the browse list     
          read only = no # read only = no, and writable = yes allow all users to access and write     
          create mask = 0700     
          directory mask = 0700     
          writable = yes     
          valid users = nmaximo7 # It restricts access to specific users8. Create a user group: _sudo groupadd -r sambausers_
    
  5. Add my user (nmaximo7) to this group (sudo usermod -aG sambausers nmaximo7) and add a password to my user to use this service: sudo smbpasswd -a nmaximo7. Note: Samba uses a password separate from that of the Linux user accounts.
  6. Change the ownership and permissions of the samba directory: sudo chown -R root:sambausers /media/mydisk/samba, sudo chmod 1770 /media/mydisk/samba
  7. Restart the samba service (Pi): sudo service smbd restart. Enabling and starting services (Arch): sudo systemctl enable ‐‐now smb, sudo systemctl enable ‐‐now nmb
  8. Configure firewall (Arch): firewall-cmd ‐‐permanent ‐‐add-service={samba,samba-client,samba-dc} ‐‐zone=home
  9. On the client computer, access the shared folder from your file manager. If you are using Windows, open File Explorer and click Network on the left pane. If you are using GNU/Linux, open Nautilus, Other Locations, connect to server, and type smb://IP’s Samba Server.
  1. First, let’s create a folder in the home directory (mkdir webtop), go inside it, and create a folder (mkdir config) and a docker-compose.yml file (touch docker-compose.yml, vim docker-compose.yml)
  2. Let’s see the content of our docker-compose.yml
      ---
      version: "2.1"
      services:
        webtop:
          image: lscr.io/linuxserver/webtop:ubuntu-mate # The image provides various versions that are available via tags, e.g., latest (XFCE Alpine), ubuntu-mate (MATE Ubuntu), arch-i3 (i3 Arch), etc.
          container_name: webtop
          security_opt:
            - seccomp:unconfined #optional
          environment:
            - PUID=1000 # User PUID, just type in the terminal: id
            - PGID=1000 # Group PGID
            - TZ=Europe/Madrid # It sets the timezone for your location.
            - KEYBOARD=es-es-qwerty # Spanish keyboard
            - PASSWORD=ASecurePassword
          volumes:
            - /home/pi/webtop/config:/config # This is the bridge between the path for your data storage on your host container (/home/pi/webtop/config)/to the home directory in the Linux-based container running in the browser 
          ports:
            - 3000:3000 # -p <external>:<internal>, it exposes the (internal) port 3000 to be accesible from the host's IP on (external) port 3000 outside the container.
          devices:
            - /dev/dri:/dev/dri #optional
          shm_size: "2gb" # This is the memory limit.
          restart: unless-stopped
          privileged: true # The KDE and i3 flavors for Ubuntu need to be run in privileged mode.
    
  3. Next, we need to run the docker-compose.yml file: docker-compose up -d (d is for detached mode).
  4. Launch your favorite browser and type:
    http://[PI_ADDRESS]:3000 # If you don't remember your PI's IP address, type: hostname -I. By default, the user and password is abc/abc.
  1. Let’s install it with Docker. First, we pull an image of Nextcloud: docker pull nextcloud.
  2. Run your image as a container and start Nextcloud: docker run ‐‐name nextcloud -d -p 8080:80 nextcloud. Container images are configured using parameters passed at runtime: -p 8080:80 would expose port 80 from inside the container to be accessible from the host’s IP on port 8080 outside the container. -d is the detached mode: run the container in the background and print the new container ID. ‐‐name nextcloud: Assign the name “nextcloud” to the container.
  3. Using a browser navigate to https://ip-address:8080 (Remember: -p 8080:80) and start the Nextcloud setup screen. It uses SQLite by default. SQLite is an open-source, self-contained database engine designed to be embedded into an application, but it is not recommended, so we are going to use PostgreSQL instead of SQLite.
  4. We need to stop our running container: docker stop nextcloud (Remember: ‐‐name nextcloud). Next, we remove the container: docker rm nextcloud.
  5. Let’s pull an image of PostgreSQL (a free and open-source relational database management system): docker pull postgres.
  6. Next, we need to create a Docker network. It allows containers connected to the same bridge network to communicate, while providing isolation from containers which are not connected to that bridge network. Create a user-defined bridge network: docker network create ‐‐driver bridge nextcloud-net. ‐‐driver bridge is the default network driver. Bridge networks are usually used when your applications run in standalone containers that need to communicate. nextcloud-net would be the docker network’s name.
  7. Start the PostgreSQL container in the docker network: docker run ‐‐name postgres -e POSTGRES_PASSWORD=mysecretpassword ‐‐network nextcloud-net -d postgres (default user: postgres, POSTGRES_PASSWORD sets the superuser password for PostgreSQL: mysecretpassword).
  8. Start the Nextcloud container in the docker network: docker run ‐‐name nextcloud -d -p 8080:80 -v /home/pi/nextcloud:/var/www/html ‐‐network nextcloud-net nextcloud. -v /home/pi/nextcloud:/var/www/html: /var/www/html is the folder where all Nextcloud data lives, /home/pi/nextcloud is our “mounted” host directory in the docker container.
  9. Using a browser navigate to https://ip-address:8080. Create an admin Account. Configure the database: Switch the database type to PostgreSQl and type the credentials: Database user (postgres), Database password (mysecretpassword), Database name (postgres), change localhost to postgres (the name of the container).
  10. Install client apps to sync your files (Desktop, Android or iOS). Download, install, and login (Server address: https//dirIPRaspberryPi). Install some apps so you can add all sorts of functionality to your Nextcloud server: OnlyOffice (real-time document editing and collaborative capabilities), News (a RSS/Atom feed reader), Passwords (a Password Manager), Music, AppOrder, etc.
  1. Install the nfs-kernel-server package: sudo apt install nfs-kernel-server. NFS will translate any root operations on the client to the nobody:nogroup credentials: sudo chown -R nobody:nogroup /mnt/discoExterno/nfsShare/ where nfsShare is the folder that we want to share.
  2. Configure the NFS configuration file: sudo vi /etc/exports:
    /mnt/discoExterno/nfsShare 192.168.1.0/255.255.255.0(rw,sync,insecure,all_squash,anonuid=1000,anongid=1000)
    
    The syntax is as follows: Directory_to_share (/mnt/discoExterno/nfsShare) client (192.168.1.0/255.255.255.0, the private network) options (rw: It gives the client computer both read and write access; sync: It forces NFS to write changes to disk before replying; insecure, all_squash, anonuid=1000, anongid=1000: macOS specific).
  3. Restart the NFS server: sudo systemctl restart nfs-kernel-server.
  4. Allow NFS Access through the Firewall: sudo ufw allow from 192.168.1.0/24 to any port nfs
  5. Client (macOS). Is the resource available in the NFS server? showmount -e 192.168.1.48 (192.168.1.48 is the NFS server’s IP). In Finder, press cmd + k and enter the path to the NFS server/share: NFS

    NFS

  6. macOS’s specific configuration (Sierra): sudo vi /etc/auto_master:
      /-    auto_nfs    -nobrowse,nosuid
    
    sudo vi /etc/auto_nfs:
    /../Volumes/my_mount    -fstype=nfs,noowners,nolockd,noresvport,hard,bg,intr,rw,tcp,nfc nfs://nmaximo7@192.168.1.48:/mnt/discoExterno/nfsShare
    

sudo automount -cv. Finally, add /Volumes/nfsShare to System Settings, Users & Groups, Login Items.

Bitcoin donation

JustToThePoint Copyright © 2011 - 2024 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.