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!
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.
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.
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.
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.
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.
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.
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
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
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.
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.
Quit the MySQL command line.
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.
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.
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
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.
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. ᕕ( ՞ ᗜ ՞ )ᕗ
We want to see what you’re working on! Don’t wait until your project is finished to share it!