Low power server using Cubieboard and LAMP

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!

Getting Started

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

 {codecitation}<?php phpinfo();?>{/codecitation} 

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 :

ScreenShot007-5

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

debian6-kde-2011-04-07-23-07-56

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:

ScreenShot012-3

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!

ScreenShot013-3

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!

Happy tinkering!

Advertisements
6 comments
  1. Hi Abhinav,
    Thanks for nice article. Can I use Cubieboard for my day to day software development activity in LAMP environment? I am in the search for a single board arm computer which can be used as both desktop as well as laptop just by replacing keyboard, mouse and monitor. In the desktop mode I will use large size keyboard, mouse & monitor and in the laptop mode I will use small size keyboard, mouse & monitor. I don’t want to use Raspberry PI as it is not having support of Android as well as SATA hard drive. Since Cubieboard is having both the support of Android as well as SATA hard drive and so I am planning to purchase it. I am planning to use ArchLinuxARM on this board as on my desktop computer I am also using ArchLinux since a long interval of time.

    So can you please confirm whether I can shift from my desktop to Cubieboard safely? I shall remain thankful to you for this.

    Best Regards …

    Pankaj Kumar

    • abhinavgupta said:

      Hey Pankaj!

      I don’t see any reason why you cannot do it! But I’d suggest using HackBerry boards instead of the Cubieboard since it also has WiFi. Cubieboard doesnt have a wifi module but it has a bunch of GPIO that you can use to interface any thing you want.

      Another precaution you need to take is cooling, the A10 chip gets warm pretty quickly. It’s not a major point to worry about but long usage might lead to thermal shutdown.

      Rest everything seems simple enough I guess, yes Arch is possible and since you have prior experience in installing Arch, you would find it easy enough to install. You can use the script.bin files that I have provided in my github repo, they work fine for minimalistic requirements.

      P.S If you plan to use USB cams on your Cubie/Hackberry, make sure you include the appropriate V4L drivers in the config file, because the default kernel image doesn’t include it

      • Hi Abhinav,
        Thanks for reply. Can you please tell me working temperature of HackBerry? In addition to this can you please also clarify which distribution of Linux is pre-installed on this board?

        Best Regards …
        Pankaj Kumar

      • abhinavgupta said:

        It comes with Android ICS rooted image on the NAND memory. The Hackberry doesn’t have a SATA interface btw, but the Cubieboard has. Please note that the SATA interface on the Cubie is only a data interface, the voltage/power interface has to be taken care yourself.

        Temperature: Under full load @ 20 C ambient, using the GPU (i.e, Android or Linaro) it’ll get to about 50oC on the chip – but this is still ‘safe’ for the IC but probably not good for long term operation. Under normal use – it’ll bounce between 30->45C

        If using a Headless image, with no GPU in use, then it’ll sit at 35C under load.

        It is best to have a couple with heatsinks installed, refer to https://www.miniand.com/forums/forums/discussion–3/topics/perfect-fit-passive-heatsink-for-a10 for information . It drops the temp by about 10-15C compared to normal operation.

        For active cooling – you’d end up with a bigger fan that covers more of the board, but that’s probably not a bad thing, since on the 1GB boards the RAM can get a little warm if doing lots of memory operations… However, I don’t believe active cooling will be needed in any but the warmer climates.

  2. Hi Abhinav,

    Thanks for detailed reply. Can you please suggest me a single board ARM processor computer in which any version of Linux with graphical desktop environment is pre-installed in its NAND memory.

    Best Regards …

    Pankaj Kumar

    • abhinavgupta said:

      I doubt if there is any that comes shipped with an OS. However, you can install a Linux distro yourself on this board with not much effort

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: