• About
  • Advertise
  • Privacy & Policy
  • Contact
Raspberry Pi Developing
  • Home
  • Getting Started
    Getting started with Node.js and Raspberry Pi: Controlling an LED with Node.js Webserver

    Getting started with Node.js and Raspberry Pi: Controlling an LED with Node.js Webserver

    All About Batteries

    All About Batteries

    What’s The Difference Between DC, Servo & Stepper Motors?

    What’s The Difference Between DC, Servo & Stepper Motors?

    Which OS is Best for Raspberry PI ?

    Which OS is Best for Raspberry PI ?

  • Pi Projects

    Raspberry Pi UV Sensor using the VEML6075

    Raspberry Pi Nvidia Shield: Stream Games using Moonlight

    Raspberry Pi Accelerometer using the ADXL345

    Raspberry Pi Accelerometer using the ADXL345

    Raspberry Pi Humidity Sensor using the DHT22

    Raspberry Pi Humidity Sensor using the DHT22

  • How to
    Setting up Home Assistant on the Raspberry Pi

    Setting up Home Assistant on the Raspberry Pi

    How to Install PHPMyAdmin on the Raspberry Pi

    How to Install PHPMyAdmin on the Raspberry Pi

    Setup a Raspberry Pi MYSQL Database

    Setup a Raspberry Pi MYSQL Database

    How to Upgrade Raspbian Stretch to Raspbian Buster

    How to Upgrade Raspbian Stretch to Raspbian Buster

    How to Setup Raspberry Pi RecalBox

    Play Retro Games with Raspberry Pi RetroPie

    Trending Tags

    • Arduino Projects
      RS-485 Serial Communication between Raspberry Pi and Arduino Uno

      RS-485 Serial Communication between Raspberry Pi and Arduino Uno

      Installing and Testing Mosquitto MQTT Broker on Raspberry Pi for IoT Communication

      Installing and Testing Mosquitto MQTT Broker on Raspberry Pi for IoT Communication

      The 2019 Thermostat ReThink

      The 2019 Thermostat ReThink

      Tracked Arduino Robot

      Tracked Arduino Robot

    • News
      New report shows how IoT devices remain under ‘constant’ attack

      New report shows how IoT devices remain under ‘constant’ attack

      BlackBerry, Telus, L-Spark among those to launch programme for Canadian IoT startups

      BlackBerry, Telus, L-Spark among those to launch programme for Canadian IoT startups

      Raspberry Pi Comparison Table

      Raspberry Pi Kernel Updated to 4.19

      Apple Watch Series 2 Is Swimproof and Comes With Built-In GPS

      To regain advertiser trust, Facebook is tracking ads by the millisecond

      National Academy of Sciences endorses embryonic engineering

      Trending Tags

      No Result
      View All Result
      • Home
      • Getting Started
        Getting started with Node.js and Raspberry Pi: Controlling an LED with Node.js Webserver

        Getting started with Node.js and Raspberry Pi: Controlling an LED with Node.js Webserver

        All About Batteries

        All About Batteries

        What’s The Difference Between DC, Servo & Stepper Motors?

        What’s The Difference Between DC, Servo & Stepper Motors?

        Which OS is Best for Raspberry PI ?

        Which OS is Best for Raspberry PI ?

      • Pi Projects

        Raspberry Pi UV Sensor using the VEML6075

        Raspberry Pi Nvidia Shield: Stream Games using Moonlight

        Raspberry Pi Accelerometer using the ADXL345

        Raspberry Pi Accelerometer using the ADXL345

        Raspberry Pi Humidity Sensor using the DHT22

        Raspberry Pi Humidity Sensor using the DHT22

      • How to
        Setting up Home Assistant on the Raspberry Pi

        Setting up Home Assistant on the Raspberry Pi

        How to Install PHPMyAdmin on the Raspberry Pi

        How to Install PHPMyAdmin on the Raspberry Pi

        Setup a Raspberry Pi MYSQL Database

        Setup a Raspberry Pi MYSQL Database

        How to Upgrade Raspbian Stretch to Raspbian Buster

        How to Upgrade Raspbian Stretch to Raspbian Buster

        How to Setup Raspberry Pi RecalBox

        Play Retro Games with Raspberry Pi RetroPie

        Trending Tags

        • Arduino Projects
          RS-485 Serial Communication between Raspberry Pi and Arduino Uno

          RS-485 Serial Communication between Raspberry Pi and Arduino Uno

          Installing and Testing Mosquitto MQTT Broker on Raspberry Pi for IoT Communication

          Installing and Testing Mosquitto MQTT Broker on Raspberry Pi for IoT Communication

          The 2019 Thermostat ReThink

          The 2019 Thermostat ReThink

          Tracked Arduino Robot

          Tracked Arduino Robot

        • News
          New report shows how IoT devices remain under ‘constant’ attack

          New report shows how IoT devices remain under ‘constant’ attack

          BlackBerry, Telus, L-Spark among those to launch programme for Canadian IoT startups

          BlackBerry, Telus, L-Spark among those to launch programme for Canadian IoT startups

          Raspberry Pi Comparison Table

          Raspberry Pi Kernel Updated to 4.19

          Apple Watch Series 2 Is Swimproof and Comes With Built-In GPS

          To regain advertiser trust, Facebook is tracking ads by the millisecond

          National Academy of Sciences endorses embryonic engineering

          Trending Tags

          No Result
          View All Result
          Raspberry Pi Developing
          No Result
          View All Result

          Raspberry Pi OwnCloud: Your Own Personal Cloud Storage

          tibi by tibi
          March 16, 2019
          Home How to
          Share on FacebookShare on Twitter
          Raspberry Pi Owncloud

          In this project, we’re going to make a Raspberry Pi Owncloud server this can act as your very own personal cloud storage.

          As the protection of your privacy becomes harder and harder, you may be thinking of moving your files to a private cloud storage. If this is the case, then this tutorial is perfect for you.

          It is important to remember that since your data will be stored on your local network, you will end up with using more bandwidth if uploading and downloading files from outside your network.

          This tutorial will take you through everything you need to know to get Owncloud setup and accessible.

          If you’re curious and want to learn more about the Owncloud software, then be sure to check out their website over at Owncloud.org.

           Equipment

          I made use of the following equipment for this personal cloud storage setup.

          Recommended:

           Raspberry Pi

           SD Card (8GB+ Recommended) or Micro SD Card if you’re using a Raspberry Pi 2 or B+

           Ethernet Cord or Wifi dongle

           External Hard drive or USB Drive

          Optional

           Raspberry Pi Case

           USB Keyboard

           USB Mouse

           Note: It is highly likely that the USB ports on the Raspberry Pi will be unable to power an external hard drive so you may need to invest in a powered USB hub.

           Video

          If you’re a visual person and would like to see our video on how to put this tutorial together, then check out the video below.

          It will take you through everything you need to know get your Raspberry Pi Owncloud server up and running.

           Setting up The Raspberry Pi Owncloud Server

          Firstly, you will need to have a Raspberry Pi with Raspbian installed. If you haven’t installed Raspbian, then check out our guide on how to install Raspbian via NOOBS (New Out of the Box Software).

          There are quite a few ways you’re able to install Owncloud onto your Raspberry Pi. In this particular tutorial, we’re going to be downloading a web server (Nginx) and Owncloud.

          1. Firstly, in either The Pi’s command line or via SSH we will need to update the Raspberry Pi and its packages, do this by entering:

          sudo apt-get update
          sudo apt-get upgrade

          2. Now we need to open up the Raspi Config Tool to change a few settings.

          sudo raspi-config

          3. In here we will need to change a few settings.

          • Change Locale to en_US.UTF8 in internationalization options -> change local.
          • Change memory split to 16m in Advanced options -> Memory split.
          • Change overclock to medium.

          4. Add the www-data user to the www-data group.

          sudo usermod -a -G www-data www-data

          These instructions have been updated to work with Raspbian Stretch, if you’re on an earlier version then I highly recommend you upgrade to Stretch.

          5. If you’re on the latest version, Raspbian Stretch, we need to install all the required packages and PHP7.

          sudo apt-get install nginx openssl ssl-cert php7.0-cli php7.0-sqlite php7.0-gd php7.0-common php7.0-cgi sqlite3 php-pear curl libapr1 libtool curl libcurl4-openssl-dev php7.0-xml php7.0 php7.0-dev php7.0-curl php7.0-gd php7.0-fpm memcached php7.0-memcache php7.0-zip php7.0-intl php7.0-mbstring varnish

          6. Now we need to create an SSL certificate you can do this by running the following command:

          sudo openssl req [email protected] -new -x509 -days 730 -nodes -out /etc/nginx/cert.pem -keyout /etc/nginx/cert.key

          Just enter the relevant data for each of the questions it asks you.

          7. In addition to the SSL certificate we also need to generate ourselves a custom dhparam file, this file helps ensure that our SSL connections are kept secure, by default this would use a default one that isn’t nearly as secure.

          To generate a 4096 byte long DH Param run the following command on your Raspberry Pi.

          sudo openssl dhparam -out /etc/nginx/dh4096.pem 4096

          8. Now we need to chmod the three cert files we just generated.

          sudo chmod 600 /etc/nginx/cert.pem
          sudo chmod 600 /etc/nginx/cert.key
          sudo chmod 600 /etc/nginx/dh4096.pem

          9. Let’s clear the server config file since we will be copying and pasting our own version in it.

          sudo sh -c "echo '' > /etc/nginx/sites-available/default"

          10. Now let’s configure the web server configuration so that it runs Owncloud correctly.

          sudo nano /etc/nginx/sites-available/default

          11. Now simply copy and paste the following code into the file. Replace my IP (192.168.1.116) at server_name (There is 2 of them) with your Raspberry Pi’s IP.

            upstream php-handler {
                server 127.0.0.1:9000;
                server unix:/var/run/php/php7.0-fpm.sock;
            }
          
            server {
                listen 80;
                server_name 192.168.1.116;
          
                #Allow letsencrypt through
                location /.well-known/acme-challenge/ {
                    root /var/www/owncloud;
                }
          
                # enforce https
                location / {
                    return 301 https://$server_name$request_uri;
                }
            }
            
            server {
                listen 443 ssl http2;
                server_name 192.168.1.116;
            
                ssl_certificate /etc/nginx/cert.pem;
                ssl_certificate_key /etc/nginx/cert.key;
          
                ssl_session_timeout 5m;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:AES256+EDH';
                ssl_dhparam /etc/nginx/dh4096.pem;
                ssl_prefer_server_ciphers on;
                keepalive_timeout    70;
                ssl_stapling on;
                ssl_stapling_verify on;
            
                add_header X-Content-Type-Options nosniff;
                add_header X-Frame-Options "SAMEORIGIN";
                add_header X-XSS-Protection "1; mode=block";
                add_header X-Robots-Tag none;
                add_header X-Download-Options noopen;
                add_header X-Permitted-Cross-Domain-Policies none;
            
                root /var/www/owncloud/;
            
                location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
                }
            
                # The following 2 rules are only needed for the user_webfinger app.
                # Uncomment it if you're planning to use this app.
                #rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
                #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
            
                location = /.well-known/carddav {
                    return 301 $scheme://$host/remote.php/dav;
                }
                location = /.well-known/caldav {
                    return 301 $scheme://$host/remote.php/dav;
                }
            
                # set max upload size
                client_max_body_size 512M;
                fastcgi_buffers 8 4K;
                fastcgi_ignore_headers X-Accel-Buffering;
            
                gzip off;
            
                error_page 403 /core/templates/403.php;
                error_page 404 /core/templates/404.php;
            
                location / {
                    rewrite ^ /index.php$uri;
                }
            
                location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
                    return 404;
                }
                location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
                    return 404;
                }
            
                location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
                    fastcgi_split_path_info ^(.+\.php)(/.*)$;
                    include fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
                    fastcgi_param PATH_INFO $fastcgi_path_info;
                    fastcgi_param HTTPS on;
                    fastcgi_param modHeadersAvailable true;
                    fastcgi_param front_controller_active true;
                    fastcgi_read_timeout 180;
                    fastcgi_pass php-handler;
                    fastcgi_intercept_errors on;
                    fastcgi_request_buffering off; #Available since NGINX 1.7.11
                }
            
                location ~ ^/(?:updater|ocs-provider)(?:$|/) {
                    try_files $uri $uri/ =404;
                    index index.php;
                }
            
                location ~ \.(?:css|js)$ {
                    try_files $uri /index.php$uri$is_args$args;
                    add_header Cache-Control "max-age=15778463";
                    # Before enabling Strict-Transport-Security headers please read into this topic first.
                    #add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
                    add_header X-Content-Type-Options nosniff;
                    add_header X-Frame-Options "SAMEORIGIN";
                    add_header X-XSS-Protection "1; mode=block";
                    add_header X-Robots-Tag none;
                    add_header X-Download-Options noopen;
                    add_header X-Permitted-Cross-Domain-Policies none;
                    access_log off;
                }
            
                location ~ \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg|map)$ {
                    add_header Cache-Control "public, max-age=7200";
                    try_files $uri /index.php$uri$is_args$args;
                    access_log off;
                }
            }
          

          12. Now simply save and exit.

          13. Now that is done there is a few more configurations we will need to update, first open up the PHP config file by entering.

          sudo nano /etc/php/7.0/fpm/php.ini

          14. In this file, we want to find and update the following lines. (Ctrl + w allows you to search)

          upload_max_filesize = 2000M
          post_max_size = 2000M

          15. Once done save and exit. Now we need to edit the conf file by entering the following:

          sudo nano /etc/php/7.0/fpm/pool.d/www.conf

          16. Update the listen line to the following:

          listen = 127.0.0.1:9000

          17. Once done, save and then exit. Now we also need to edit the dphys-swapfile. To do this open up the file by entering:

          sudo nano /etc/dphys-swapfile

          18. Now update the conf_swapsize line to the following:

          CONF_SWAPSIZE = 512

          19. Restart the Pi by entering:

          sudo reboot

          20. Once the Pi has restarted, you will need to install Owncloud onto the Raspberry Pi. Do this by entering the following commands:

          sudo mkdir -p /var/www/owncloud
          sudo wget https://download.owncloud.org/community/owncloud-10.0.9.tar.bz2
          sudo tar xvf owncloud-10.0.9.tar.bz2
          sudo mv owncloud/ /var/www/
          sudo chown -R www-data:www-data /var/www
          rm -rf owncloud owncloud-10.0.9.tar.bz2
          

          21. Now we need to open up the .user.ini file to enforce some of the changes we made earlier in the tutorial

          sudo nano /var/www/owncloud/.user.ini

          22. In here update the following values so they are 2000M:

          upload_max_filesize=2000M
          
          post_max_size=2000M
          
          memory_limit=2000M

          23. Now that is done we should be able to connect to Owncloud at your PI’s IP address.

          Before you set up the admin account, you might want to mount an external drive, so you have lots of disk space for your Raspberry Pi Owncloud Server. Just follow the instructions in the next section.

           Mounting & Setting up a drive

          Setting up an external drive while should be relatively straightforward but sometimes things don’t work as correctly as they should.

          These instructions are for mounting and allowing Owncloud to store files onto an external hard drive.

          1. Firstly if you have an NTFS drive we will need to install an NTFS package by entering the following:

          sudo apt-get install ntfs-3g

          2. Now let’s make a directory we can mount.

          sudo mkdir /media/ownclouddrive

          3. Now we need to get the GID, UID, and the UUID as we will need to use these soon. Enter the following command for the GID:

          id -g www-data

          4. Now for the UID enter the following command:

          id -u www-data

          5. Also if we get the UUID of the hard drive, the Pi will remember this drive even if you plug it into a different USB port.

          ls -l /dev/disk/by-uuid
          UUID Hard Drive

          Copy the light blue letters and numbers of the last entry (Should have something like -> ../../sda1 at the end of it).

          6. Now let’s add your drive into the fstab file so that it will boot with the correct permissions.

          sudo nano /etc/fstab

          7. Now add the following line to the bottom of the file, updating UID, GUID and the UUID with the values we got above. (The following should all be on a single line)

          UUID=DC72-0315 /media/ownclouddrive auto nofail,uid=33,gid=33,umask=0027,dmask=0027,noatime 0 0

          8. Reboot the Raspberry Pi, and the drives should automatically be mounted. If they are mounted, we’re all good to go.

          Note: If you get an error stating the Pi is in emergency mode at boot up then this likely means a problem with the fstab entry. Just edit the fstab file (sudo nano /etc/fstab) and remove the added line or look for a mistake and fix it.

           Basic First Setup

          I will briefly go through the basics of setting up Owncloud Raspberry Pi here. If you want more information I highly recommend checkout out the manuals on their website, you can find them at the Owncloud manual site here.

          1. In your browser enter your Pi’s IP address in my case it is 192.168.1.116.

          2. Once you go to the IP you’re like to get a certificate error, simply add this to your exception list as it will be safe to proceed.

          3. When you first open up ownCloud you should be presented with a simple setup screen and no errors.

          4. Enter your desired username and password.

          5. Click on storage & database and enter your external drive /media/ownclouddrive (Skip this step if you didn’t setup an external drive).

          6. Click finish setup.

          Owncloud Signup

          If you ever need to update and you find the internal updater is not working this likely means, you will need to do it manually. You can find a detailed process on how to update over at owncloud’s update manual page.

           Port Forwarding & External Access

          If you want to have access to your cloud drive outside your local network, then you will need to setup port forwarding and make a few changes to our config files.

          Firstly, we need to go back to the default file and change the server_name values (There is 2 of them). Update these to your external IP address. You can get your IP at what is my IP.

          If you have a dynamic IP you may want to set up a dynamic DNS and use that as your address. You can find information on this in my guide to port forwarding.

          Enter the following to bring up our default server file:

          sudo nano /etc/nginx/sites-available/default

          Once you have updated the IP’s in the server file, you will need to add the external IP to your trusted IP list and make sure Owncloud doesn’t overwrite it. To do this open up the Owncloud config file and enter:

          sudo nano /var/www/owncloud/config/config.php

          In here add a new item to the trusted domains array (This will be your external IP address). Your new entry should look something like this (x are just placeholders).

          1 => 'xxx.xxx.xxx.xxx',

          Finally update the URL of the overwrite.cli.url line to your IP Address. It should look something like this.

          'overwrite.cli.url' => 'https://xxx.xxx.xxx.xxx',

          Below is an example of the completed config.txt file.

          External IP Change Example

          Once done, restart the Nginx service by entering the following:

          sudo service nginx restart

          Be sure to check out my guide on port forwarding and use the following port 443 for internal, and I recommended a random port for the external port. Make sure when setting up the external port that it isn’t already reserved for a specific program.

          When connecting to the Owncloud server externally, you will need to make sure you use https otherwise you will get an invalid request in your browser.

          Setting up port forwarding is super easy to do and allows you to have access to your personal cloud on the go. Also after you have done this, you can still connect via your local IP as well.

          I hope this tutorial has helped you make your very own Raspberry Pi OwnCloud. If you have any troubles, want to leave feedback or if I have missed anything feel free to drop us a comment below.

          Tags: cloudowncloudpersonalraspberrystorage
          tibi

          tibi

          Next Post
          Raspberry Pi TorrentBox: Build an Always-On Torrent Machine

          Raspberry Pi TorrentBox: Build an Always-On Torrent Machine

          Comments 1

          1. J man says:
            1 year ago

            doesn’t work. Basically from the php step and /etc/nginx/dh4096.pem no such file or directory

            Reply

          Leave a Reply Cancel reply

          Your email address will not be published. Required fields are marked *

          Recommended.

          Watch Dogs 2 Update Coming This Week, Here’s What It Does

          More proof that 2017 is just ‘Black Mirror’ IRL: Bee drones

          Trending.

          How to Setup a Raspberry Pi Nextcloud Server

          How to Setup a Raspberry Pi Nextcloud Server

          March 14, 2019
          How to Setup a Raspberry Pi NAS (Network Attached Storage)

          How to Setup a Raspberry Pi NAS (Network Attached Storage)

          April 13, 2019
          Raspberry Pi TorrentBox: Build an Always-On Torrent Machine

          Raspberry Pi TorrentBox: Build an Always-On Torrent Machine

          March 16, 2019
          Setup a Raspberry Pi MYSQL Database

          Setup a Raspberry Pi MYSQL Database

          July 28, 2019
          Raspberry Pi Humidity Sensor using the DHT22

          Raspberry Pi Humidity Sensor using the DHT22

          May 14, 2019
          Raspberry Pi Developing

          PI Guide Developing is where you can find some of the coolest Raspberry Pi projects and guides on the web. You can check them all out right here.

          Follow Us

          Categories

          • Arduino Projects
          • Getting Started
          • How to
          • News
          • Pi Projects

          Tags

          about adding Apple Watch 2 arduino beginners Best iPhone 7 deals build Buying Guides camera CES 2017 clock digital display drive email games getting guide install installing iOS 10 iPhone 7 learn linux mount mysql network Nintendo Switch phpmyadmin Playstation 4 Pro python raspberry Raspbian sense sensor server setting setup Sillicon Valley simple started storage system tutorial using

          Recent News

          Setting up Home Assistant on the Raspberry Pi

          Setting up Home Assistant on the Raspberry Pi

          March 22, 2020
          How to Install PHPMyAdmin on the Raspberry Pi

          How to Install PHPMyAdmin on the Raspberry Pi

          July 28, 2019
          • About
          • Advertise
          • Privacy & Policy
          • Contact

          © 2019 PI GUIDE - Premium PI Guide PI GUIDE.

          No Result
          View All Result
          • Home
          • Getting Started
          • How to
          • Pi Projects
          • Arduino Projects
          • News

          © 2019 PI GUIDE - Premium PI Guide PI GUIDE.