My own raspberry pi cloud

When I was first working with computers, I used to build and upgrade my own desktop PCs.  This was back when finished PCs were pricey and it was cheaper to build your own if you were willing to put in the time and effort.  There were times of frustration but ultimately a sense of accomplishment when you were finished.  A lot of knowledge of the inner workings of a PC as well as tuning tips and tricks were earned as well.

Many years later, hardware is still relatively cheap, but a finished PC is as well.  Laptops have also replaced desktops in many situations now that their pricing has become more affordable.  Now it is typically game players and hobbyists whom still actually build desktops.

I gave up building my own desktops long ago, but I still have one old Gateway PC for playing old FPS games like Doom when I’m feeling nostalgic.  When it finally conks out, I will probably have to set up a virtual machine or two for this task.

I started playing with virtual machines back when I wanted to work with versions of Oracle when they were first introduced.  As any Oracle veteran knows, the AIX, Unix, and Linux versions would always be rolled out first and it would be much later when the Windows versions were introduced.  Not wanting to wait for the Windows versions, I started using VMWare and eventually VirtualBox to start working with the Unix versions.

Over the years, I have massed quite a lot of VMs, not wanting to create them over and over to work with specific Oracle products and operating systems.  Colleagues have asked me for copies of some of these VMs from time to time and the size of them makes it difficult to post or send them.  This is also true for files, scripts, and toolkits that we as consultants carry around with us between client engagements.

The introduction of the Raspberry Pi has opened a new world of low-cost computing power that can be used in a variety of ways and I see new projects posted all the time – everything from weather stations to smart home devices.

I recently saw a project for a home cloud using a raspberry pi device that can be configured to upload and download files remotely and saw this as a way to post my VMs for my colleagues that were interested.  Since I have an old (version 2) raspberry pi laying around that I unsuccessfully tried to turn into a NAS, I thought it would be perfect for this use.

The process to create my own cloud was found here – https://pimylifeup.com/raspberry-pi-owncloud/ and the process allowed me to get my own cloud set up.

A word of caution, though.  Since this is not a highly-secured platform, do not place any sensitive files on this cloud.  If it is on your home network, it will require a port forward setting on your router to enable outside access.  On the positive side, you can have links secured with passwords for both folders and individual files to share with others.

Update 12/17/19

While having the personal cloud was great, there was a problem uploading large files to my cloud.  The files in question would be several GB in size and the upload process through the web interface just could not handle them.  I found a blog on manually adding files to owncloud (https://bartsimons.me/manually-add-files-to-owncloud/), but after adding the files, the occ scan command to add the new files to the owncloud database failed with the message “This version of ownCloud is not compatible with PHP 7.3 You are currently running PHP 7.3.0.”.  The next higher available version of owncloud, 10.3.2, seemed to have the same problem according to my online research.

At the time of creating this environment, owncloud was on version 10.2.14 and I had also installed PHP 7.3 as well as PHP 7.2, with 7.3 being the default version in use. Version 7.2 did not seem to have this problem on owncloud, so I had to alter the rapsberry pi Debian environment to use PHP version 7.2 instead.

Logged into the rapsberry pi as the default pi user, I started with the “which php” command to find where it was executing PHP from.  It pointed to /usr/bin/php, which then pointed to the link /etc/alternatives/php, and finally to /usr/bin/php7.3.

As PHP version 7.2 was also installed, the php7.2 executable was also located under /usr/bin.  I then removed the /etc/alternatives/php link with a simple rm command, then created a new link pointing to the 7.2 executable – “ln -s /usr/bin/php7.2 /etc/alternatives/php

To test the process, I manually copied files to the external drive using this process:

  • Power down the raspberry pi, remove my external USB drive
  • Copy a folder into the files# directory of the default user account on the USB drive.  The name of this user is the admin account that was set up during initial owncloud configuration.
  • Plug the USB drive back into the raspberry pi and power it up.
  • Log in as the pi user account, open a terminal, and go to /var/www/owncloud
  • Execute the scan command “sudo -u www-data php occ files:scan –all” (two hyphens before the all option)
  • At the end of the scan, the new files were visible through the owncloud web interface

Update 1/10/20

After finding the process above for manually adding files to the external drive, I thought about have the file scan process execute on boot up to save time when adding files.  I created a file under /usr/bin on my raspberry pi called file-scan with permissions 744 as root with the following two commands:

cd /var/www/owncloud

sudo -u www-data php occ files:scan --all

I then edited the /etc/rc.local file and added the line /usr/bin/file-scan and now the file scan process executes every time I boot up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s