A dedicated Home Server is a useful thing to have if you’re a hacker. You can use it as a remote repository for all your code, for hosting your website, dumping all your media and accessing it with any other device and even printer sharing. This post gives a detailed procedure of making (in my opinion) a near perfect home server using a Cubieboard!
Benefits of using a Cubieboard
Low Cost : For $50, the Cubieboard is like the cheapest computer in the world. Complete with 1GB RAM, 4GB space, 10/100 Ethernet port, two USB ports, SDcard slot, camera interface, audio out, HDMI AND along with all this awesomeness, it also has a complete SATA port. It also comes with a nice glass box for protection.
Low Power : The low cost doesn’t just end there with the pricing, the average power consumption of the Cubieboard is 8W, which if compared to standard low power servers is 5 times less! So it just doesn’t cost less, it consumes less as well!
You will need a functional operating system with SSH and Ethernet ports enabled on the Cubieboard before installing the server stack.In case you haven’t seen already, I have described how to do that in this post. Make sure you have followed the steps and installed a headless Debian on your Cubieboard before reading further. I have released the latest kernel images with fixed patches and SATA power enabled over here.
Now that the SATA is enabled, you can now easily connect a HDD, thus removing any space constraint on your server. (NOTE: The SATA works for a 2.5 inch drive only, for other HDD types, you will need external power source)
To ensure that the SATA interface works on boot, just type this command in your terminal (on the Cubieboard, of course!)
echo "sw_ahci_platform" >> /etc/modules
After connecting the Ethernet port, make sure you note down the IP of your server. You can do that by using the DHCP list or just doing a shell login with the TTL pins and running ifconfig, you will get all the network connection details including the IP.
Now that we have all the hardware and Operating System stuff settled, we consider our server stack options. One of the interesting options is the Napkin Server. It is based on JRuby, Sinatara and Neo4j graph database. The Napkin server offers a REST API with predefined services for storing and retrieving configuration information and collecting time series data from client devices. A plug-in model provides extensibility in HTTP handling and periodic processing of stored data. It is a very interesting project, you can refer to the wiki for Cubieboard installation here.
The second option would be to go for the more traditional LAMP stack. The installation is a very simple 3-step process.
Step 1: Installing Apache 2 and PHP 5
Apache is usually the go-to choice for most linux based servers. You can easily install Apache and configure it with PHP 5 with the package manager tool like this:
root@cubie:~# apt-get install apache2 php5 libapache2-mod-php5
The folder holding all the php pages by default is located in /var/www/
To check if php is properly installed, just open a sample php file:
root@cubie:~# vi /var/www/test_file.php
and add the following php code
After you have saved this file, you can test by opening a browser on a different machine and connect to the following link: http://%5Bcubieboard’s-ip%5D//test_file.php and you will see this :
Step 2 : Installing MySQL Database server
The next step would be installing the database backbone. Again, installing MySQL is an easy task with the package manager:
root@cubie:~# apt-get install mysql-server mysql-client php5-mysql
While installing, you will get be prompted to insert a root mysql password. You can add it there,but in case you forget you can even add it later like this:
mysql -u root mysql> USE mysql; mysql> UPDATE user SET Password=<your password> WHERE user="root"; mysql> FLUSH PRIVILEGES;
Step 3 : Installing PHPMyAdmin
PHPMyAdmin is an extremely easy-to-use web-tool to manage the databases on your server. It is a very handy tool to remotely manage databases on your server. To install it simply go:
root@cubie:~# apt-get install phpmyadmin
During the installation process, you will be prompted with a screen to choose your choice of web-server. In our case, it is Apache2
Once the installation is complete, to test it, open a browser on a different machine connected in the same network, and open the link : http://%5Bcubieboard’s-ip%5D/phpmyadmin
Doing so will result in this:
To enter, you must use the Cubieboard’s login details. Once you enter the correct values, it should lead you to a Dashboard, which is pretty self explanatory to use!
Now you have a fully functional web-server!! You can now start experimenting with your server, maybe by installing wordpress on it and using it as a host for your own website!