Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OwnCloud:
- Share and sync
- Take charge of your data by creating your own cloud service.
- Do you want the convenience of an omnipresent
- Dropbox-like storage service without doling out wads
- of cash and your data to a third party? OwnCloud is
- one of the best pieces of open source software to help you
- create your own private and protected cloud-sharing service.
- Using OwnCloud, you can sync and share your private data,
- and access it from any device connected to the internet. For
- added security, OwnCloud can also encrypt your files. The
- software can handle files in a variety of formats and you can
- extend its usability by adding a number of other apps.
- As with other online cloud storage services, you can sync
- files on OwnCloud either using the web browser or a desktop
- client on Windows, Mac and Linux, as well as mobile clients
- for Android and iOS devices. Furthermore, your OwnCloud
- server keeps older versions of all changed files and enables
- you to revert to an older version without much effort.
- In this tutorial, we’re setting up the OwnCloud server on
- top of the Raspbian distribution for the Raspberry Pi. The
- server software has modest requirements and it performs
- well even on the Raspberry Pi Model B in certain small and
- controlled environments, such as your house. You also need a
- USB portable disk for storing the data. For maximum
- reliability and performance, it’s best to use a self-powered
- disk that doesn’t draw power from the Raspberry Pi. Before
- OwnCloud has a well designed browser-based dashboard
- that exposes a lot of features but is still easy to operate.
- To view some
- stats on the APC
- cache, copy its
- script to your
- DocumentRoot
- with cp /usr/
- share/doc/phpapc/
- apc.php /var/
- www/ and then
- view it in the
- web browser on
- http://localhost/
- apc.php.
- Quick
- tip
- COMPATIBILITY
- All Pi’s
- best on
- Pi 2
- WorldMags.net
- WorldMags.net
- Projects
- Raspberry Pi Projects | 53
- snappier. Pull in the components with sudo apt-get install
- php-apc and then open APC’s configuration file and add:
- $ sudo nano /etc/php5/conf.d/20-apc.ini
- extension=apc.so
- apc.enabled=1
- apc.shm_size=12M
- Then bring the cache online by restarting Apache with:
- $ sudo apachectl restart.
- Now that the server is set up and configured, it’s time to
- prepare the storage medium. Plug the USB disk into the Pi
- and enter sudo blkid in a terminal. The USB disk is probably
- be mounted as /dev/sda1 if you don’t have any other USB
- disks attached. Make a note of the corresponding UUID,
- which looks something like 6154-F660. Now create a
- directory to mount this drive using:
- $ sudo mkdir /media/owncloud
- Then mount the drive with:
- $ sudo mount -t vfat -o umask=007,auto,uid=33,gid=33 /dev/
- sda1 /media/owncloud
- The above command assumes your drive has a FAT32
- filesystem and is mounted at /dev/sda1. Once the drive is
- mounted correctly, you can edit the fstab file to make sure
- it’s automatically mounted:
- $ sudo nano /etc/fstab
- UUID=6154-F660 /media/owncloud/ vfat
- rw,umask=007,auto,uid=33,gid=33 0 0
- Configure the cloud
- That’s all there is to installing the server components. You’re
- now all set to configure your cloud. Launch a web browser
- and navigate to the OwnCloud installation instance at
- 192.168.3.111/owncloud. Because this is a brand new
- installation, you are asked to create a new user account for
- the OwnCloud administrator.
- Next, we need to ask OwnCloud to use the MySQL
- database and store files under the mounted USB drive. For
- this, click on the Storage & Database pull-down menu. Then
- enter /media/owncloud/data in the text box corresponding
- to the Data Folder entry and select the MySQL/MariaDB
- option in the Database section. You’re asked to enter the
- connection details of the database serve, so just enter
- localhost as the host and root as the username, along with
- the password you configured when the database was pulled
- in along with OwnCloud.
- That’s it – you’ve set up OwnCloud. You can now log into
- your cloud server as the administrator using the credentials
- you have just created for OwnCloud. While you can start using
- the server to upload and download files straight away, let’s
- take a moment to get the house in order. For starters, when
- you log into the OwnCloud server, click on the pull-down
- menu next to your username and click on Personal. Here you
- can change the settings for your account, such as the login
- password and display name. You can also add a profile picture
- and configure how you would like to be notified about certain
- actions. Also, if your cloud is going to be used by multiple
- people, it’s advisable to add users and organise them into
- different groups. To do this, select the Users option from the
- pull-down menu. While adding users, you can restrict their
- storage space and even share your admin responsibilities
- with other users, and mark certain users as admins for a
- particular group.
- Upload and share files
- You’re now all set to upload data into your OwnCloud server.
- After you’ve logged in, you are in the Files section. To upload a
- file, click on the arrow button. To organise files into folders,
- click on the button labelled New, and select the Folder option
- from the drop-down menu to create a new folder.
- If you’ve uploaded a file in a format that OwnCloud
- understands, you can click on its name to view and edit the
- file. OwnCloud can visualise the data it houses in different
- views. For example, click on the Files pull-down menu in the
- top-left corner of the interface, and select the Pictures option.
- This view helps you view images in your cloud by filtering out
- all other types of content.
- Another way to upload files to the server is by using the
- WebDAV protocol, with which you can access your cloud
- server from your file manager. For example, in the Files file
- manager, press Ctrl+L to enable the location area. Here you
- can point to your OwnCloud server, such as
- dav://192.168.3.111/owncloud/remote.php/webdav.
- Once authenticated, the OwnCloud storage is mounted and
- you can interact with it just like a regular folder.
- To share uploaded files, go to the Files section in the web
- interface and hover over the file or folder you wish to share.
- This displays several options, including Share, which enables
- you to select which users or groups you want to share the
- item with and whether you want to give them permission to
- edit and delete the files. You can also share with someone
- who isn’t registered with your OwnCloud server. Click on
- Share with Link, and OwnCloud displays a link to the item that
- you can share with anybody on the internet. You can also
- password-protect the link and set an expiration date.
- While you can interact with the cloud using the web
- interface, it’s far easier to use one of its official clients.
- OwnCloud has clients for all the major desktop and mobile
- If your drive has
- an NTFS partition,
- install the NTFS
- driver with sudo
- apt-get install
- ntfs-3g and use
- -t ntfs-3g in the
- mount command.
- Quick
- tip
- Ready-made solutions
- Although it doesn’t take too much effort to install
- and configure the OwnCloud server from scratch,
- there’s a couple of ways to save time and effort.
- The chaps behind PetRockBlog have written a
- script that automates the whole installation
- process.
- The script downloads and sets up an
- OwnCloud installation on top of a Raspbian
- distribution. However, unlike the tutorial, the
- script uses the Nginx web server instead of the
- Apache web server. To use the script, install the
- required components with:
- $ sudo apt-get install git dialog
- Then download the script with:
- $ git clone git://github.com/petrockblog/
- OwncloudPie.git
- which creates a directory called OwncloudPie.
- Move into this directory:
- $ cd OwncloudPie
- Make the script executable:
- $ chmod +x owncloudpie_setup.sh
- Then execute it:
- $ sudo ./owncloudpie_setup.sh
- Now give it some time to download all the
- components and configure your server. Once
- you’ve installed OwnCloud from the script, you
- can run it again to update the installation
- whenever a new
- platforms. These clients also help you synchronise folders
- from the desktop to your OwnCloud server with ease.
- Set up clients
- Most desktop distros host the Linux client in their
- official repos. You can also grab the latest version by
- adding the corresponding repo for your distro from here:
- http://bit.ly/1HZxhOy.
- The page has instructions for popular distros including
- Debian, Fedora, Ubuntu, OpenSUSE, and more. To download
- clients for other platforms, head to the downloads page on
- OwnCloud’s website (https://owncloud.org/
- install/#install-clients). Mobile clients are best fetched
- from either Apple’s App Store or Google’s Play Store.
- Once the client is installed, it prompts you for your login
- credentials in order to connect to the OwnCloud installation.
- Once connected, the Linux clients create a local sync folder
- named owncloud under the home directory, such as
- /home/bodhi/owncloud. Any files you move into this
- directory are automatically synced to the server. You can also
- specify one or more directories on a local machine to sync
- with the OwnCloud server. If a directory is shared with several
- users, when anyone makes a change to a file on one
- computer, it automatically flows across to the others.
- When collaborating with other users, you’ll appreciate
- OwnCloud’s version control system, which creates backups of
- files before modifying them. These backups are accessible via
- the Versions pull-down option corresponding to each file,
- along with a Restore button to revert to an older version.
- In addition to files, you can also sync your calendar and
- address book with your OwnCloud server. Follow the
- walkthrough opposite to enable the Calendar and Contacts
- apps. Once you’ve enabled both, the top-left pull-down menu
- now includes the Calendar and Contacts option.
- Now you need to import your contacts and calendar from
- your existing apps into your cloud server. OwnCloud supports
- the popular vCard file format (which has the .vcf file
- extension) and almost every popular email app, including
- online ones such as Gmail, export their address books in this
- format. Similarly, calendars can be imported in the popular
- iCal format. Before proceeding further, make sure you
- download both the .vcf and .ical files from your existing
- contacts and calendar apps.
- Now head to Contacts in OwnCloud and click on Import
- Contacts. In the pop-up window, click on Upload File and
- point it to the .vcf file. Once the contacts have been imported,
- you can sync them with your email clients using CardDAV
- links. Head to the Contacts section in OwnCloud, click on the
- gears icon at the bottom, hover over the name of the address
- book you imported and click on the Chain icon. This spits out
- a CardDAV link for this address book that you can feed to your
- desktop or mobile address book client.
- Sync and share your calendar
- Similarly, you can use OwnCloud to manage your calendar
- and tasks. To create an event in your calendar, head over to
- the Calendar app. You can view the calendar for the entire
- month or for the current week. To add a new event, click on
- the appropriate date in the calendar. This brings up a window,
- which gives you several options to configure the event. To
- import an existing client, simply upload the .ical file to your
- cloud server. When you click on the file in OwnCloud’s web
- interface, the server recognises the file and offers to import it
- into an existing calendar or into a new one. Select the option
- that best suits you.
- After you’ve imported the calendar, you can use
- OwnCloud to share it with other users. Click on the Share
- Calendar icon corresponding to the calendar you wish to
- share. This brings up a pull-down menu, which enables you to
- select the users or the group of users you wish to share the
- calendar with. Furthermore, just like address books,
- OwnCloud can also sync your calendars with desktop and
- mobile apps that can read this information from CalDAV links.
- To get the CalDAV link for your calendar, click on the Gears
- button and then on the Chain icon corresponding to the
- calendar you wish to sync. This displays the link that you can
- pass on to the clients to keep them in sync with the
- OwnCloud calendar.
- There’s a lot more you can do with OwnCloud. Follow the
- walkthrough opposite to flesh out the default installation with
- new apps to extend the functionality of your cloud.
- Universal access
- The real advantage of commercial cloud
- services such as Dropbox is that you can access
- data stored within them from any computer
- connected to the internet. However, by default, a
- self-hosted OwnCloud installation is only
- accessible from computers and devices within
- the local network,
- That’s not to say that you can’t access your
- private cloud from the internet, though. The
- trickier and expensive solution is to get a static
- IP address from your ISP and then poke holes in
- your router’s firewall. Or, you can set up Dynamic
- DNS in your router or local machine. The
- smarter way, however, is to use a tunnelling
- service, such as PageKite. The service uses a
- pay- what- you-want model. As a non- commercial
- user, you can use the service for free by filling
- out a form once a month, telling PageKite how
- you use the service. But it’s definitely worth
- more than the $3 per month minimum they
- request from individuals.
- First you need to install PageKite. Launch a
- terminal and enter:
- $ curl -s https://pagekite.net/pk/ | sudo bash
- When it’s done, make your local web server
- public with the following command:
- $ pagekite.py 80 mycloudserver.pagekite.me
- Remember to replace mycloudserver with
- the name you want for your OwnCloud server.
- Now you can access your own personal
- OwnCloud instance by heading over to
- http://mycloudserver.pagekite.me from any
- computer anywhere in the world. The first time
- you run this command, PageKite runs you
- through its brief sign-up process and asks for
- your email address.
- WorldMags.net
- WorldMags.net
- Projects
- Raspberry Pi Projects | 55
- 1 Enabled apps
- You can extend your default OwnCloud installation by adding (or
- removing) a bunch of apps. Bring up the pull-down menu in the top-left
- of the interface and click on Apps. By default, you are shown a list of
- apps that are already enabled on your installation. You can browse
- through this list and read their descriptions to understand them better.
- You can also disable any enabled app from this section.
- 2 Documents app
- Once you’ve browsed through this list, head to the Recommended
- section, which lists a number of apps that are recommended by the
- OwnCloud developers. These haven’t been enabled by default as they
- might not be of use on all OwnCloud deployments. The Documents
- app enables you to edit and collaborate on documents in various
- formats within OwnCloud itself, without the need for an external app.
- 3 Bookmarks app
- The other productivity app that you should enable is Bookmarks. This
- app lets you store and manage bookmarks in your OwnCloud server.
- You can add bookmarks by adding them directly, or by importing a
- bookmark file from your web browser. The app also has a bookmarklet
- that you can add to your browser’s bookmarks. Press the bookmarklet
- to add a website to OwnCloud’s list of bookmarks.
- 4 Calendar and Contacts
- Scroll down and click on the PIM tab on the left. This section lists two
- apps. You can enable either or both the Calendar and Contacts apps.
- Once enabled, the apps let you pull in your existing contacts and
- calendars, which you can sync with the PIM apps from your OwnCloud
- installation, as explained in the tutorial. Some OwnCloud apps also
- have the option to enable them for specific users.
- 5 More apps
- In addition to the apps listed in the Apps section on your OwnCloud
- installation, there are others that you can install from the OwnCloud
- website. Scroll down the Apps section and click on the More Apps…
- link. This takes you to the OwnCloud app store at http://apps.
- owncloud.com. You can download any app from here and extract it
- under the /var/www/owncloud/apps folder inside the Pi.
- 6 News and storage usage
- Two other useful apps are the News and Storage Usage apps. The
- former is an RSS reader and the latter visualises the storage space on
- your cloud with a variety of charts. Once you’ve downloaded them
- from the website and extracted them under the apps folder, head back
- to the Apps section in your OwnCloud installation. These and any
- other downloaded apps are listed under the Not Enabled section.
Add Comment
Please, Sign In to add comment