Quantcast
Channel: 懒得折腾
Viewing all articles
Browse latest Browse all 764

OWN YOUR OWN CLOUD WITH C.H.I.P.!

$
0
0

OWN YOUR OWN CLOUD WITH 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 asPutty.


5. SETUP LOCALES

localesLocales 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/hostnamefile.
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 databaseowncloud 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

1stloginOn your laptop open a web browser and surf over to your C.H.I.P. atHOSTNAME.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

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.

clientowncloudTo 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. ᕕ( ՞ ᗜ ՞ )ᕗ



Viewing all articles
Browse latest Browse all 764

Trending Articles