Keep your data at home

While services like Dropbox or Box.com are great for collaborative work and stuff, I always feel kind of afraid putting more personal data in there.
But I want to satisfy my desire to keep important files and media with me, while keeping them in sync with my devices.
I want to have my own dropbox, serving my files from home.

So I started with buying a Raspberry Pi(Model B) and throwing Owncloud on it.
While installation and setup worked quite fluently, the performance was a desaster. A simple request to the webinterface of Owncloud on my Pi took about 20 seconds, which brings me to the conclusion, that Owncloud will be no fit for the Pi and it’s capabilities.

Fortunately there is a alternative to Owncloud which looks promising plus it’s open source and free for personal use.
It has a free app for Android as well, therefore I will give it a shot.

My next blog posts will be about setting up useful server applications on the Pi such as

  • Seafile - private Owncloud-like file sync
  • Mumble - encrypted, low-latency voice chat
  • maybe Jabber - XMPP

I will also cover and start with:

Disclaimer: I have no clue if the PI can handle the stuff I am going to install =)

Installing OpenWrt on WD MyNet N600

In order to access the PI from outside my local network I need to keep track of my home’s IP address. Since I have no static IP at home I’ll have to deal with DDNS.

I researched some dynamic DNS providers and was surprised to find, that only a few free solutions were left.
In the past I was very happy with dnydns.org, but they stopped their free plans.
Fortunately there is no-ip.org, which is keeping up with free plans for single users.

Sadly, the stock firmware which ships with my N600 only supports tzo and dyndns.org as providers for dynDNS which are not quite the same company I guess.
So no satisfying solution here.
Which forces me install some cool stuff on my router: OpenWrt

According to their website, installation should be straight forward:

1
2
3
4
5
6
7
1) Download the file openwrt-ar71xx-generic-mynet-n600-squashfs-sysupgrade.bin
2) Configure your computers IP address to 192.168.1.10 and connect to a LAN port in the router.
3) Turn the router off.
4) Using a paperclip, press and hold the reset button on the bottom of the router and turn it on. Hold the reset button for at least 15 seconds.
5) On your computer, visit http://192.168.1.1 NOTE: You will not be able to ping this address.
6) Upload the file openwrt-ar71xx-generic-mynet-n600-squashfs-sysupgrade.bin as downloaded earlier.
7) The router will now flash OpenWRT. This will take a couple of minutes to achieve. You can ping 192.168.1.1 and watch for ping replies to see when your router has rebooted into OpenWRT

Alright step 1 is easy. Step 2 can be tricky if you are using some linux-ish OS.
I did it on Mint with editing /etc/network/interfaces and adding following lines:

1
2
3
4
5
# /etc/network/interfaces
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1

Did a

1
sudo /etc/init.d/networking restart

after saving the file.

This enables me to connect my machine and the router directly via LAN.
Step 3 to 7 worked flawlessly.
After flashing OpenWrt ist done, you can telnet on the router.

1
telnet 192.168.1.1

Not lets install a web interface called LuCI.
Fortunately there are great step-by-step instructions already there!

1
2
3
4
5
6
7
opkg update
opkg install luci
opkg install luci-ssl
# Start the web server (uHTTPd)
/etc/init.d/uhttpd start
# Enable the web server (uHTTPd)
/etc/init.d/uhttpd enable

It just works, great.

Now we need DDNS support, since it is not avaiable out-of-the-box by luci.

1
2
opkg install luci-app-ddns
opkg install ddns-scripts

The DDNS service was disabled by default, so I turned it on via System -> Startup

Now after refreshing the page there should be a new tab called “Services” at the web interface’s navigation.
You can choose a ton of providers here. As mentioned, I will go ahead with no-ip.org.

After setting up the PI we will need these prerequisites to use our applications from outside our local network, e.g. with the smartphone.

But this should be it for now.

Please do not forget to set up a root password and all the other stuff like ssh and the wifi(if needed).

[Vim] Toggle between Vim and Shell

There is a binding I kind of use a lot in the past months. As you may know, you can switch to a shell from Vim with

1
:sh

in normal mode. If you type exit or hit CTR+D in your shell, you will get back to Vim. I like this behaviour when I am on a remote server via ssh.

Therefor I binded CTR+D in Vim to execute :sh, so I can toggle between shell and Vim with this shortcut.
To get it, include this snippet in your vimrc.

1
2
# ~/.vimrc
noremap <C-d> :sh<cr>