Create Your Own Personal Cloud Server



Whether it is Dropbox, Google Drive, Skydrive or iCloud, I am sure that we all have our favorite cloud server. Cloud Servers are great because they allow us to easily sync files between all the devices on our network and access content from anywhere. However, a growing concern over cloud servers is privacy. You could be banned from hosting certain content and companies could easily sort through what you are uploading and create targeted ads based on it. Also, each service provides only a limited amount of free space that is quickly filled.

Whatever your situation may be, you should try to create your own personal cloud server. It gives you all the privacy that you want and does not limit you in terms of storage. In order to build an effective cloud server you will need a device that can be always on. For this reason, I am going to use the raspberry pi. You can keep it running all year long and it hardly has any noticeable impact on your electric bill. Of course you could also use any desktop computer that you might have sitting around. We are going to use the popular software OwnCloud. Owncloud is very easy to setup, but only works on machines running Linux. However, you can connect a client to any operating System on desktop and mobile.

What You Will Need:

  • A computer running Linux
  • Wired or Wireless Network

Step 1: Static all the way

First you will need to setup a static IP address, so that whenever you access your cloud it will always use the same address. Imagine having 20 clients connected to the server and the address changes; you would have to manually reconnect all of those clients! To do this, you can either go through your router settings (the simplest way) or change the network interfaces. To change the network interface type in:

ifconfig

This will display the eth0, broadcast and mask address. Take note of all of these. Then to get the internet IP and gateway type in:

netstat -nr

Make sure to record this information somewhere. Now go  into network interfaces and fill in the information you obtained. Also remember to change dhcp to static.

nano /etc/network/interface

Type CRTL +O to save and CRTL + X to exit.

Then reboot your computer/raspberry pi for the changes to take effect.

Step 2: Packages

If you have not already, update your packages.

sudo apt-get update

Now, time to download and install a crapload of stuff. Here is what you need (Thanks inscrutables for providing all of this on one line):

sudo apt-get install apache2 php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl4-openssl-dev php5-curl php5-gd php5-cgi php-pear php5-dev build-essential libpcre3-dev php5 libapache2-mod-php5 php-apc gparted

Step 3: PHP Accelerator

To make things go a little faster, you are going to want to install the PHP accelerator:

sudo pecl install apc

Just hit enter to use the default options for everything it asks.

Step 4: Max Defaults:

Now let’s set the max file upload and post size. Type in:

nano /etc/php5/apache2/php.ini

Then change the max upload size to whatever you desire. I am going to use 4096M (4 GB). Do the same for the max post size.  Then go to the part of the file that says extensions and add in the following:

extension=apc.so

Then close and save the file (CRTL + O and CRL + X).

Step 5: SSL

Next you need to setup the SSL certificate.

sudo nano /etc/apache2/sites-enabled/000-default

Step 6: Setting up Owncloud

Now, time to download and setup owncloud. To download tpye in:

wget <a href="https://download.owncloud.org/community/owncloud-8.0.3.tar.bz2">https://download.owncloud.org/community/owncloud-8.0.3.tar.bz2</a>

Then unzip it:

sudo tar -xfj owncloud....

And move it to the web root:

Finally, change the ownership:

sudo chown -R www-data:www-data /var/www/owncloud/

Now, change the htcaccess file in the web root to match the upload size that you specified earlier:

sudo nano /var/www/owncloud/.htaccess

Remember to save the file.

Step 7: Storage

If you have not already, connect the device that you are using for storage. I am connecting a 500GB hard drive to my raspberry pi. Using the program GParted (or whatever partition software you desire) format and partition the drive. It does not matter whether you use EXT 3/4 or NTFS.

Now mount the drive. My drive is listed as sda2 but your drive letter might be different. Make sure to check with fdisk -l.

mkdir /mnt/cloudDrive

mount /dev/sda2 /mnt/cloudDrive

Now, let’s make some edits so that it will automatically mount on boot. Type in:

sudo nano /etc/fstab

Add the drive followed by the mount directory along with 0 0 for the defaults.

Step 8: Logging In

You can now log in to your owncloud server. In any browser, type in the IP address of the computer that owncloud is running on. It will prompt you to create a username and password.

Step 9: One last thing

There is one small thing that we have to do before we are done. We have to point tot he drive that we want to contain the data for owncloud. First, stop the web service:

sudo /etc/init.d/apache2 stop

Then navigate to the owncloud config file:

In the data directory, specify the directory that you want to use. I am going to point to a folder that does not exist yet. Finally, move all the existing content to that subfolder.

Step 10: Finish

And you are done. All that is left is to isntall clients on your Windows, Mac, Linux or Android device and connect to the server. If you want to connect to the server outside of your local network than use port-forwarding or setup a VPN. If you have any questions or comments feel free to leave them below.