Own Your Own Cloud with C.H.I.P.!

Not a cloud in the sky, except owncloud on C.H.I.P.

Not a cloud in the sky, except owncloud on C.H.I.P.

Take back ownership of the cloud with ownCloud, a USB thumb drive, and C.H.I.P. on your home network. It’s easy to setup on C.H.I.P. with ownCloud and you’ll be able to share files, photos, address books, and even calendars all from hardware that’s yours.

Chris Watterston’s sticker popularized a common jab at all the cloud computing hype: “There is no cloud, it’s just somebody else’s computer.” Maybe. But with ownCloud and C.H.I.P. the cloud is yours!

1. Flash C.H.I.P.

Use the online flashing tool to update your C.H.I.P. with the 4.4. Headless image. The flasher has built-in instructions, requires only a USB micro cable and paperclip, and takes only a few minutes.

Note: Flashing overwrites all the data on C.H.I.P., so backup any personal files you want to keep. For an easy backup, use a USB thumb drive or try your hand at SCP.


2. Add a Monitor & Keyboard

Connect a keyboard and monitor to C.H.I.P. for easy access to the command-line. Once you have everything setup on C.H.I.P., you can unplug the keyboard and monitor and deploy your cloud anywhere you can give it power.

Note: Alternatively, you could use a USB-to-Serial cable to connect to C.H.I.P. and forgo the monitor and keyboard. Consult the C.H.I.P. docs for more on this option.


3. Setup WiFi

From the command-line, use the nmcli utility to setup a network connection. In the command below, replace SSID_NAME and WIFI_PASSWORD with your home network information.
sudo nmcli device wifi connect 'SSID_NAME' password 'WIFI_PASSWORD' ifname wlan0

Note: Do not add a line break between ‘WIFI_PASSWORD’ and ifname.


4. Install SSH

Use apt to update the Debian package information on your system and install SSH.
sudo apt update && sudo apt install ssh

Determine C.H.I.P.’s IP address so you can remotely connect to it.
ip addr show wlan0

On your laptop, use SSH and connect to C.H.I.P.. Linux and macOS have SSH clients built-in and accessible from the terminal. Windows users need to install an SSH client such as Putty.


5. Setup Locales

locales

Locales on C.H.I.P. define the region and language the software should use. For most packages, it doesn’t matter too much if locales are fully setup, but OwnCloud and many of its required packages require a properly configured system.

Type the command below and follow the on-screen steps.
sudo apt install locales && sudo dpkg-reconfigure locales && sudo locale-gen

Use the arrow keys and tab to move around, and spacebar to mark your desired selection. Many locations have multiple entries. Select your desired region with UTF8.

Note: In BASH, && is a way to connect two (or more) commands together. The second command will run only if the first command runs successfully.


6. Setup Avahi

Avahi enables you to connect to C.H.I.P. using the machine’s hostname, not just it’s IP address. It’s preinstalled on the 4.4 Headless image, so you just need to tweak a few configs. Create the file /etc/avahi/services/afpd.service using the text editor Nano.
sudo nano /etc/avahi/services/afpd.service

Note: For help with Nano, check out this great guide.
Populate the file with the following text, save it, and quit.

Open /etc/hostname with Nano and change chip to whatever new hostname you want to use.
sudo nano /etc/hostname

Open /etc/hosts and swap out chip with the same hostname you used in the /etc/hostname file.
sudo nano /etc/hosts

Restart the Avahi daemon so your new hostname takes effect.
sudo /etc/init.d/avahi-daemon restart


7. Install ownCloud

Use apt to install ownCloud and the MySQL database server.
sudo apt install owncloud mysql-server

When prompted to create a password for the MySQL root user, pick a password that’s different than your Debian root password –it’s never wise to reuse passwords.


8. Configure MySQL to work with ownCloud

Now that your C.H.I.P. has a running MySQL database server, you’ll need to create a database for ownCloud to use and set permissions for accessing the data. You’ll only need to deal with the MySQL command line once.

Access the MySQL command line as the MySQL root user and use the -p argument to force login with a password. Remember, the MySQL root password should be different than the Debian root password.
mysql -u root -p

A MySQL server can host multiple databases on the same system. Create a new database called owncloud specifically for use with ownCloud.
CREATE DATABASE owncloud;

Note: It’s a common practice to capitalize SQL keywords and, for me, it makes the commands easier to read.

Create a MySQL user named owncloud that has permission to access the database owncloud to write and request data. Replace YOUR_DB_PASSWORD with a custom password for the owncloud user.
CREATE USER owncloud@localhost IDENTIFIED BY 'YOUR_DB_PASSWORD';

Set the level of permission the owncloud user should have in the database.
GRANT ALL PRIVILEGES ON owncloud.* TO owncloud@localhost;

Reload the part of the database that keeps track of permissions so that all the changes you just made take effect.
flush privileges;

Quit the MySQL command line.
quit


9. Configure a USB Thumb Drive for ownCloud

Create a directory where all of your ownCloud data should live. You can specify a directory on C.H.I.P.’s built-in storage or you can specify USB thumb drive.
sudo mkdir /media/owncloud

Determine the UUID of the USB drive and write it down.
sudo blkid

Open /etc/fstab and type in the text below. Replace YOUR_UUID_HERE with the output from the command above.
sudo nano /etc/fstab

UUID=YOUR_UUID_HERE /media/owncloud vfat auto,users,uid=33,gid=33,dmask=027,fmask=137,utf8 0 0

NOTE: The text above should be entered on one line.


10. Browse to Your Cloud

1stlogin

On your laptop open a web browser and surf over to your C.H.I.P. at HOSTNAME.local/owncloud. Replace HOSTNAME with what you called your C.H.I.P. in Step 3. Then simply fill out all the input fields and your setup is done.

  • Username: pick whatever you want
  • Password: pick whatever you want
  • Data folder: /media/owncloud/
  • Username: owncloud
  • Password: YOUR_DB_PASSWORD from Step 4
  • Database: owncloud
  • Host: localhost

11. File Browse

Own your own cloud with C.H.I.P. and ownCloud

Own your own cloud with C.H.I.P. and ownCloud

Now that your cloud is running on C.H.I.P., you’ll be able to access it while connected to the same home network. Easily transfer files from your phone to your laptop using ownCloud’s browser-based graphical interface.


BONUS STEP: Install an ownCloud Client on PocketC.H.I.P.

clientowncloud

To make ownCloud really useful you’ll want to setup a few of your devices with the dedicated client application. Installation is really straightforward, just follow the install instructions on the ownCloud site. All of the clients except the iOS and Android apps are completely free, but don’t worry, you can use the Linux client on PocketC.H.I.P. free of charge. ᕕ( ՞ ᗜ ՞ )ᕗ


chipLogo64x64

We want to see what you’re working on! Don’t wait until your project is finished to share it!

Pose with your project, take a quick snap, or describe it in writing, we love it all. You can find us on Twitter, reach us on Facebook, or, best of all, join the lively conversation in the forum.

About the Author

Posted by

I'm busy writing and editing content at Next Thing Co.

Categories:

C.H.I.P., Project

Tags:

18 Comments

Sweet project!

Just a comment. In your blogs, you sometimes give a command and then say there should be no line break at such and such a point. Where the line break appears depends on the width of the browser window.

For example, in the above post, in step 3 using nmcli, you mention not to add a line break before ifname. The way my browser is set up, the line break occurs after ifname. I think that might confuse readers not familiar with the command line and the commands in question. In step 9, you’ve a much clearer formulation given that this is html.

Keep the good articles coming!!

How to access Cloud from other netoworks or outside of local network. Should there be confirgured some ports, adress or else ?

Petrika,
It’s certainly possible to set this up, but you’d need to configure port forwarding on your router and implement additional security on your network. Setup for both of these depends heavily on the type of router you are using, whether or not you have a public static-IP, a domain name, and how your home network routes traffic. There are simply too many variables for me to write a single project to account for the variety.

I don’t want to discourage you from trying, though. My best advice is to search for ‘how to access owncloud remotely’ in your favorite search engine and do a LOT of reading, and, of course, double-check all your security settings.

I followed all your steps. I just renamed Owncloud to my personal name Inotek but at the end when I try to log on my web browser I receive 404 Error.
Where is my mistake when I did all your steps

I tried connecting, but I got a “website refused to connect” error. Is there anything you know of that I should try in order to fix this?

Hi all,

I tried 2 times, but after install it when reboot chip it hangs after or when loading driver cfg80211,
What can be happening? Any ideias

Thank you in advance

Paulo

I am wondering if I missed something, I get the following error,

Error
Can’t create or write into the data directory /media/owncloud/

when configuring owncloud in step 10.

here are what the perms look like:
chip@chip:~$ ls -ld /media/owncloud/
drwxr-x— 2 www-data www-data 16384 Jan 1 1970 /media/owncloud/
chip@chip:~$

and here is what my fstab looks like:
chip@chip:~$ cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
# Owncloud FS
UUID=C47B-213A /media/owncloud vfat auto,users,uid=33,gid=33,dmask=027,fmask=137,utf8 0 1
chip@chip:~$ df -h /media/owncloud/
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 15G 16K 15G 1% /media/owncloud
chip@chip:~$

The instructions don’t tell you to run sudo mount /media/owncloud after editing the etc/fstab file. Rebooting causes it to mount, but that command would do it right away.

I am curious about the performance as well. Is there a limiting factor here?
So has anyone tried to stream HD MP4’s from this cloud configuration?
Also can you make this a DHCP server so you can have your own portable cloud?

Add a Response

Your name, email address, and comment are required. We will not publish your email.

The following HTML tags can be used in the comment field: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">