Cozy on Raspberry Pi

Lead Image © dfriesen, Linux New Media

Cozy Up to Cloud

Transform Raspberry Pi B 2 into a versatile and user-friendly cloud server with Cozy.

Using Raspberry Pi as a small, energy-efficient, personal cloud server is not a new idea, and plenty of web applications and tools can transform the tiny machine into a platform that can handle any task you throw at it: from serving files and sharing photos, to aggregating RSS feeds and streaming music. Deploying individual applications makes it possible to configure a Raspberry Pi-based cloud server just the way you want it, but the approach has its share of drawbacks.

First, you need to install and configure each application individually, which requires time and sometimes technical skills. The resulting server is essentially a collection of disparate applications with no unifying interface that ties everything together. Second, maintaining the server and keeping all apps updated can be a time-consuming chore.

Enter Cozy [1], an easy-to-deploy and user-friendly personal cloud platform. Although Cozy can be installed on practically any Linux-based machine, the project provides a ready-made image for Raspberry Pi B 2, which makes it a perfect choice for setting up a versatile cloud server in a matter of minutes (Figure 1).

Figure 1: Cozy can transform a Raspberry Pi into a private cloud server in a matter of minutes.

Installing Cozy

To create a bootable microSD card with Cozy software on it, download the compressed image archive using the wget tool:


Install then the p7zip utility required to extract an image file from the archive. On Debian and Ubuntu, this can be done by running the

apt-get install p7zip

command as root. Next, uncompress the archive with:

7zr e 2015-06-16-cozy-raspberry-pi2.img.7z

Insert and mount a microSD card and run the mount command to list all mounted devices. Note the microSD card's path, which should look something like /dev/sdc1. To write the resulting image to the card, use the following command as root:

dd bs=4M if=2015-06-16-cozy-\
  raspberry-pi2.img of=/dev/sdc

Insert the prepared microSD card into your Raspberry Pi and boot it. Wait while Cozy is up and running (this may take a while). Then, point the browser to [UCC:x15-l-italic][/UCC] (replace [UCC:x15-l-italic][/UCC] with the actual IP address of the Raspberry Pi), and you should be greeted with Cozy's initial page. Create a new user account, and you are good to go.

Cozy is frequently updated, and it's almost certain that you'll receive an update notification as soon as you log in to your Cozy instance. So, before you start using Cozy, it's a good idea to upgrade your installation. To do this, switch to the Status section and press Update all in the Platform section. Now you are ready to explore Cozy.

It's All About Apps

All functionality in Cozy is implemented via apps, and the platform comes with its own store, which lets you browse and install apps with consummate ease. The list of apps currently available in the store is rather short, but it does offer apps for most probable usage scenarios. This includes the official Files and Photos apps that instantly turn the Raspberry Pi running Cozy into a capable file storage and photo publishing platform, so these are the apps you might want to install right away. Installing apps in Cozy couldn't be easier. Just click on the desired app entry in the store, review the required permissions, and hit Install (Figure 2).

Figure 2: Installing Cozy apps is as easy as pie.

Both Files and Photos are no-frills apps, but they provide essential tools for managing files and publishing photos. The Files app lets you easily upload individual files and entire folders using the appropriate buttons (Figure 3). Alternatively, you can drag and drop files and folders onto the Files page to upload them. To manage files and folders efficiently, you can assign tags to them. To do this, select the item you want to tag, click the [UCC:x15-l-italic]Tag[/UCC] icon and add as many tags as you need.

Figure 3: The Files app has all the necessary tools for managing files and documents.

Sharing files and folders is equally straightforward (Figure 4). Click on the Share icon, copy the generated sharing link, and press OK. You can then send the link to other users to give them direct access to the shared file or folder. Instead of sending the link, you can share the file or folder with specific users by adding their email addresses in the Sharing dialog. When doing this, you can define access rights for each added email address. When you press OK, the system automatically sends email notifications to specified recipients.

Figure 4: Sharing files is a straightforward affair.

The Photos app is not overloaded with features either, but it's adequate for publishing and sharing photos (Figure 5). Photos in the app are organized into albums, and creating an album is as easy as pressing the Create a New Album button. Give the album a name and a short description and upload photos using the appropriate button or by simply dragging and dropping them onto the page. If you already have photos in the Files app, you don't need to upload them again. Press the dedicated button and choose the photos from the Files app.

Figure 5: The Photos app offers an easy way to publish, view, and share photos.

The Photos app features sharing capabilities, so you can share albums with the world. The viewing interface in the app lets you view photos, mark them as favorites, rotate, and delete them. A slideshow mode displays photos in the currently selected album as a slideshow.

A personal cloud server wouldn't be complete without calendar and email functionality, and Cozy has you covered on both counts. Like other Cozy apps, Calendar favors simplicity over functionality, but it does provide all essential tools for managing tasks and events (Figure 6). For starters, the app supports multiple calendars, and you can assign different color labels to them. You can switch between different views, including, [UCC:x15-l-italic]week[/UCC] , [UCC:x15-l-italic]month[/UCC] , and [UCC:x15-l-italic]list[/UCC] .

Figure 6: The Calendar app allows you to keep track of your tasks and appointments.

Adding a calendar entry is as easy as clicking on the desired date in the calendar. For each entry, you can specify start and end (or mark it as an all-day event), add a location, and assign guests. There is also an option to set up a reminder to notify you about the upcoming event. Finally, you can mark the entry as repeating and specify its recurrence.

In most cases, you'd want to sync your Cozy calendars with your mobile device, and Cozy provides a mechanism for that. To enable synchronization, you need to install the Sync app from the store. Once you've done that, launch the Sync app, and note the server info and credentials. Calendar synchronization in Cozy is performed using the CalDAV standard. If you happen to use an Android device, you need to install the open source DAVdroid app [2] that acts as a conduit between Cozy's Calendar app and the Android calendar. It's available as a paid app on the Google Play Store, but you can get it for free from F-Droid [3]. Because Cozy runs on a Raspberry Pi, the platform uses a self-signed certificate not recognized by Android.

In practical terms, this means that to make the DAVdroid work with your Cozy instance, you need to import the self-signed certificate to the Android device. The easiest way to do this is to use the CAdroid app [4]. Importing the certificate using CAdroid is easy, but you may receive an invalid certificate error message. A workaround is to generate a new certificate with the correct CN (common name entry). Connect to the Raspberry Pi running Cozy via SSH and run the commands:

cd /etc/cozy/
sudo openssl genrsa -out ./server.key 1024
sudo openssl req -new -x509 -days 3650 \
  -key ./server.key -out ./server.crt

The last command will ask you a series of questions, and you can simply press Enter to accept the default values, except the Common Name entry. Here, you enter [UCC:x15-l-italic][/UCC] (replace [UCC:x15-l-italic][/UCC] with the actual IP address of the Raspberry Pi). When specifying the URL of the Cozy server, use the [UCC:x15-l-italic][/UCC] address.

Once you've imported the certificate, launch the DAVdroid app and create a new synchronization profile. When prompted, choose the Login with URL and user name option and specify the required connection info. Visit the Calendar Synchronization [5] page for more detailed DAVdroid setup instructions.

The Emails app can come in particularly useful if you have multiple email accounts spread across several email service providers. This app is basically an email aggregator that pulls together several email accounts and provides a lightweight and functional webmail interface (Figure 7). As long as your email account supports the IMAP and SMTP protocols, it will work fine with the app. During the first run, Emails prompts you to configure at least one email profile. If you happen to use popular email services like Gmail or Yahoo! Mail, the app automatically fills out the required IMAP and SMTP settings.

Figure 7: The Emails app can handle multiple email accounts.

Emails' interface follows Cozy's main theme: essential functionality wrapped into a streamlined and user-friendly interface. All email threads are grouped into conversations, making it easier to keep track of correspondence with a specific recipient. You can star important email messages, and you can filter messages by several criteria. Using the date filtering functionality, it's possible to display messages for a certain period of time or even a specific date. Of course, the search feature can help you find email messages matching various criteria.

Besides the official apps built and maintained by the Cozy developers, several community apps deserve a closer look. If you want to host a blog on your Cozy server, the Ghost blog app is right up your alley. This open source blog engine provides a lightweight alternative to WordPress, and it's suitable for maintaining a simple personal blog.

The Cozic player will take care of your music streaming needs (Figure 8). Upload music files by dragging and dropping them on the player's interface, and you can play them right away. The player allows you to broadcast your current playlist. To do this, press the Broadcast button, and other users can then listen to your playlist using a provided public link.

Figure 8: The Cozic player lets you stream music and share it with others.

Several other useful third-party apps are available in the store, including my personal favorite, Weather. As the name suggests, the app displays current weather conditions and a five-day forecast for any location, and it does this in style (Figure 9).

Figure 9: Weather is a stylish weather forecast app.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content