Build Your Own Cloud Server

You’ll Need this UBUntU 12.04 SerVer edition ownCloud runs as a service on an existing server. We’ll be using Ubuntu on a virtual machine. Download the ISO at www.ubuntu.com/download/server.
ownCloUd We’re using the download archive at http://owncloud.org/install. VirtUalBox For the virtual machine, we’ll beusing VirtualBox, available at www.virtualbox.org.

Build your own castle in the sky and snuggle all of your data into one cozy place. The promise
of cloud storage on the Internet has, to a large extent, been delivered. We’ve got free services of
all shapes and sizes, but is this a dream come true or the start of a nightmare?
We’re leaning toward the latter, as cloud storage certainly offers an easy way for the government to rifle through your data for no good reason and share its findings with all of its buddy
services. Of course, that’s without any consent or knowledge from you, because we’re all OK
with that, right?

But you probable think that building your own cloud storage is a hard, costly, and tiresome
endeavor. You would be wrong. An awfully clever group of people have built a system called
ownCloud (http://owncloud.org), a web service that’s designed to run on most web servers.
Getting ownCloud installed does require Linux and a little console action, but once it’s up and
running, it’s largely a web-interface affair.
You may very well be screaming: “Why do we need to run this on Linux and not Windows?”
It’s an understandable lament, but the reality is that a near-default install of a Linux server
comes with a pile of useful web-based tools, protocols, and services. The ownCloud project
uses standard web server, PHP, and MySQL services to offer you an easy-to-use cloud system,
and without Linux it’d be next to impossible or just very expensive to have it developed. For this
tutorial you’ll need to download the Ubuntu server ISO from www.ubuntu.com.

Set Up a VirtUal linUx SerVer

To make this less scary,
we’re going to run it all wrapped up in a virtual machine. We’re
using VirtualBox from Oracle. If you haven’t already, download
it from www.virtualbox.org and install it.
» For the Ubuntu server, create a new machine with at least 1GB
of memory and add storage of say 100GB for the primary hard drive.
You’ll need to point the CD optical drive to the Ubuntu Server ISO
image you downloaded. We also suggest for the virtual machine that
under Network you select a bridged connection (image a), as this
provides the VM with its own real IP address, making accessing it
more straightforward.

» When the VM starts, it will boot the CD ISO and start the installation. You need to create a new root user account. At Partition
Disks, select Guided and set up LVM. Remove anything already
there and choose to use all but 4GB of the available space. This creates a large work partition and a small swap partition, just in case.
» Don’t worry about HTTP proxy, select security updates, and at
Software selection, ensure you select OpenSSH server and LAMP
server (image B). You’ll be asked for a new MySQL password—we
suggest you use one different from your main user account, but
don’t forget it! Install the GRUB boot loader and then continue on to
the ownCloud installation.
» At this stage you should be logged into the VM at a Linux
command prompt. Now we need to add PHP5 and Curl libraries,
then download and extract the ownCloud system. This process will
involve entering a number of commands, but don’t worry—you’ll
be done soon. Note that the commands below will work for the
version of ownCloud that’s current as of publication. You can (and
should) go to http://owncloud.comand check for a more current
download URL.

» Enter the following:
Sudo su
apt-get install php5 php5-gd php-xml-parser php5-intl php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl mysql-server
wget http://download.owncloud.org/community/owncloud-5.0.11.
tar.bz2

tar xjf owncloud-5.0.11.tar.bz2
mv owncloud/ /var/www/owncloud
» Next, we need to make a Data folder and set read/
write permissions:
mkdir data
chown -r www-data:www-data data
chown -r www-data:www-data config
chown -r www-data:www-data apps
» At the terminal, type:
sudo vi /etc/apache2/sites-enabled/000-default
This is the crazy terminal text editor. Press [I] to edit and under the section, set AllowOverride to
All. You’ll need to press [Esc] to end editing, then press [W]
to write the file and [Q] to quit. Two more useful commands
are sudo a2enmod rewrite and sudo a2enmod headers.
» Lastly, type service apache2 restart to make the web
server changes live. At this point,you can finish the installation by typing http://<vm.ip.address>/owncloud into a
browser’s address bar. The final ownCloud page will appear. Use any username and password and click Advanced.
Enter root as the SQL username, along with the password
you chose and a database name such as ownCloud.

Configure ownCloud

You’re now looking at the
main (and rather empty) browser interface (image
C). You’ll see the Settings section is at the top-right
of the screen. It contains a number of useful options, so
select it and then click Users. This enables you to add, remove, and control account access to the cloud system. Just
type a name and password, add a group, and give it a suitable quota.
» OwnCloud enables you to synchronize a whole
bunch of stuff with PC, Mac, and Linux systems, including documents, photos, contacts, and calendars. To get
started, install the desktop tool from http://owncloud.org/
sync-clients. To log in, type http://<vm.ip.address>/owncloud
then supply the username and password. The tool will minimize to your notification area. 
» The primary use of the desktop app is to sync folders and files to the ownCloud server. You can choose as
many folders and files as you like—you’ll just need to create unique alias names on the server side of things and let
them synchronize (image d). Remember to add some MP3s
to enable the music player, and do the same for pictures.

» OwnCloud has mobile apps for both Android and iOS.
They’re not perfect, as they seem to synchronize the entire
folder tree, which can take a while if you have a lot of files.
Otherwise,this makes it easy to upload and download files
from your ownCloud server. The alternative is to just use
the browser interface, which isn’t bad at all.

Gain SSl SeCurity

To secure your server with encryption, you should enable HTTPS access. Back at the console,
type the following commands to enable SSL on the Apache
server: sudo su, then a2enmod ssl, and finally,ß service apache2
restart. You can then check that the changes are working correctly
by typing netstat -tap | grep httpsand make sure the result is set
to HTTPS LISTEN.
» The following command copies the default config and launches
the terminal editor:
cp /etc/apache2/sites-available/default-ssl
/etc/apache2/sites-available/ownCloud-ssl

then
vi /etc/apache2/sites-available/ownCloud-ssl
» Press [I] to edit and change the top line’s
xxx to your server’s IP address (image e). Press [Esc] to stop editing.
» Press [W] to save and [Q] to quit. Finally,we have three
more commands to make the ownCloud host the default instance:
a2dissite default-ssl, then a2ensite ownCloud-ssl, and service
apache2 reload
. You’re now able to log on with the client using http://<vm.ip.address>/owncloud for an encrypted connection.
You’ll get a certificate warning, which is standard.
» External connections rely on your router to forward the correct
ports. You should select a random port between 49152 and 65535—
say, 57001, for example. Set the router to forward port 57001 to port
443 at your VM’s local network IP address. You can then connect externally to your home broadband’s IP like this:
https://<broadband.ip>:57001/owncloud

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.