Trying to create a self hosted internet connected storage

The following steps were taken to create a running instance of nextcloud

  1. Installed the following pre-req to NextCloud— Takes about 2-5 mins

    1. Installed mariaDB:: As part of nextcloud installation
    2. Installed Apache:: As part of nextcloud installation
    3. Installed PHP:: As part of nextcloud installation
    sudo apt update && sudo apt upgrade -y
    sudo apt install apache2 mariadb-server libapache2-mod-php php php-cli php-mysql php-gd php-bcmath php-curl php-mbstring php-intl php-xml php-zip php-apcu unzip wget -y
    
    
  2. Configured mariaDB and configured the root user

    sudo mysql_secure_installation
    sudo mysql -u root -p
    
  3. Created the admin user for nextcloud and created nextcloud’s default database. (This is later connected to nextcloud using nextcloud’s web interface)

    CREATE DATABASE nextcloud;
    CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'your_password';
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    
    
  4. Installed no-ip for Dynamic DDNS

    sudo apt update
    sudo apt install build-essential gcc make
    
    sudo wget <https://www.noip.com/client/linux/noip-duc-linux.tar.gz>
    tar -xvzf noip-duc-linux.tar.gz
    cd noip-2.1.9-1
    
  5. Created a domain name on no-ip and connected it to the no-ip client running on the raspberry pi for connecting the static ip provided by ISP to the the domain name created using no-ip.com

  6. Reserved the local IP for the raspberry pi

  7. Forwarded port 80 and 443 on TCP to connect through HTTP and HTTPS for the raspberry pi’s IP

  8. Install NextCloud

    1. Navigate to the Apache web root

      cd /var/www/html
      
    2. Download the latest nextcloud release

      sudo wget <https://download.nextcloud.com/server/releases/latest.zip>
      
    3. Unzip the downloaded file:

      sudo unzip latest.zip
      sudo mv nextcloud /var/www/html/
      
    4. Set the correct permissions

      sudo chown -R www-data:www-data /var/www/html/nextcloud
      sudo chmod -R 750 /var/www/html/nextcloud
      
  9. Configured nextcloud to listen to associate both with the raspberry pi’s local IP and no-ip.com domain name

  10. Obtained security certificates for HTTPS for the external domain name

  11. Configured nextcloud to force http connections to be https

  12. Installed a firewall

  13. Using NextCloud’s web interface, connected mariaDB and the default user to nextcloud

  14. Logged in as admin

  15. Once inside nextcloud, I enabled External Storage Support

  16. Mounted the External storage to the raspberry pi. As this was NTFS formatted disk, extra configurations were required for successful connection

  17. Once mounted, I connected the external storage to nextcloud from the admin panel within NextCloud’s web interface shared only to the administrator