April 7, 2015 Hatem Ben Yacoub

Proof of concept : A $30 dollars DIY Personal Cloud Server

Personal cloud devices are available today in the market for different prices depending on the storage size, let’s say around $200 the 4TB. But it happens that I have already a storage device that I am happy with, and a mini PC in a stick (MK802) that came with Android 4.0 pre-installed.

You can find the Android mini PC in eBay for less than $30, and we will need just a micro SD card to install the operation system, so we can replace the Android with an embedded linux distribution. Finally I’ll transform it into a personal cloud server to sync my files from PC/Mac/Android …etc.

An easy way to do this is to install the system on an SD card then we can easily expand storage using USB drives. For example you can see actually in my MK802 I have already about 3G available for data :

It could be enough , or I can easily expand it for example using a 1T USB drive :

Hardware used :

  • MK802 : ARM based Cortex-A8 you can find it with 512MB, 1GB RAM
  • Micro SD card 4GB

Software :

  • Debian Wheezy
  • Sunxi-BSP
  • OwnCloud server

How to :

I used an Ubuntu 14.04 to get my system up and running, and it should be working fine with other version of Ubuntu, Debian, or any other Linux distribution. The next commands will be run as root, so (#sudo su) to switch to root.

First we need to get necessary packages to build our system :

The minimal Debian Wheezy plus the necessary packages to get my personal cloud running will need around 600MB, so a 1G image is enough for my rootfs :

The next command will install minimal Debian inside the image :

We can chroot now to our image and run the second stage of debootstrap :

In the second stage debootstrap will be unpacking and configuring different packages already installed. Notice that our new prompt indicate that the new system have “no name”, and we will fix all this shortly.

Let’s set the apt sources and install some essential stuff:

We don’t need the .deb files anymore, so we can remove them already :

Set a 123 root password 😛

Create a new /etc/fstab, which should look something like this:

Configure wireless so we can easily ssh our system by adding to /etc/interfaces:

To generate your wpa-psk you can replace yourssid and yourpassword below :

Then simply replace the asterisks with the psk value.

We can also set the new hostname in /etc/hostname and replace your current hostname with MK802 or the hostname of your choice:

Once you’re finished, leave the chroot environment with exit or <ctrl-d> and create a tarball of the newly created root filesystem:

The system we created is about 296M which give us a compressed rootfs of about 100M. I told you that our system will be about 600M, that’s the Apache, MySQL and PHP that we will install later.  For now I’ll just build the kernel and bootloader then load everything in our micro SD. The easiest way is to use sunxi-bsp :

If everything worked out fine, we will find an hwpack under sunxi-bsp/output/mk802-1gb_hwpack.tar.xz, so we are ready to write everything to SD card (which is /dev/sdb in my example):

Our system is ready, just plug the micro SD and boot the device.  You can see below the MK802 connected to my TV :

boot

The text is cropped in the beginning because the TV setting was in 16/9 while I am in ternminal, just changed the normal display and it’s fixed. You can see below that my MK802 is connected to internet :

wifi

MK802 is connected and identified, now I can ssh to my new system :

In the second part of the installation, we will simply install and configure apache, php and mysql :

Download and install ownCloud :

Now just point your browser to http://mk802/owncloud/ and if everything is okay you should see the installation page which is very straightforward. Follow instructions and your personal cloud is ready :

owncloud

I did not dig into installation details of the LAMP stack and ownCloud software, since it’s not the purpose of this article, but you can find in details installation instructions and recommendations in the ownCloud.org website. I used this installation at home and synced files from my desktop easily without any problems. ownCloud have Client available for PC/MAC/Linux/Android/iOS even if the mobile ones are paid ($1) but it’s totally worth it.

As I mentioned in the title, this is a proof of concept. It is not in anyway a recommendation for the MK802 or for Debian Wheezy, or for the ownCloud stack. Lots of boards available and could be easily used in the same way such as Raspi, PCDuino, or others. The same for the OS and the personal cloud software. However every time you have a device that will work permanently for a very long period, make sure you add heatsinks, and possibly a fan.

Feel free to share your experience.

Tagged: , , , ,

About the Author

Hatem Ben Yacoub Energy Engineer, Entrepreneur, ICT & eGov Consultant with over 15 years experience. Independent Open Data expert.

(HBY) Consultancy