How to Use Your Chromebook Pixel as a Webserver
I was lucky enough to receive a free Chromebook Pixel at Google I/O, which is certainly a well designed piece of hardware, with some decent specs. After using it for a while, the biggest challenge seemed to be Chrome OS itself though, which is quite limiting if you are looking to do any work outside of the browser.
Besides using it for web surfing once in a while (certainly tough to find the right spot for the Pixel between a Macbook and an iPad), I was looking for a way to better take advantage of the hardware. I didn’t want to fully erase Chrome OS though, and in parallel I’ve been looking for hardware for a home server.
Thus I ended up converting my Chromebook into my own LAMP server. Here are the steps:
1) Install Ubuntu with Crouton
Crouton is a “chroot” environment to run both Chrome OS and Ubuntu at the same time. I first considered using a dual boot approach, but after watching the review below, I decided to give Crouton a try, since it seemed to be pretty well integrated.
It basically allows you to use it as server, AND use Chrome OS for surfing in parallel. There are well documented public steps to install Crouton. I used the How-To-Geek guide, and went with the unity desktop.
Once installed, Ubuntu didn’t seem to recognize the high DPI resolution of the Pixel screen. I used the “Advanced Settings” tool to increase the font size.
You can install it via the Ubuntu command line.
sudo apt-get install gnome-tweak-tool
In addition, I installed terminal, since the default xterm app didn’t honor the increased font size.
sudo apt-get install gnome-terminal
2) Assign a static IP
As with any server, you need to assign a static IP. If the server reboots, it remains at the same address. Since Chrome OS is controlling the network connection, you have to turn on an experimental feature to enable it. Once setup, it worked very well for me.
3) Open firewall for port 80
Chrome OS comes with a built-in firewall, which by default pretty much blocks all ports. I tried to open the port with scripts at startup time, but I ran into issues getting out of the “read-only” mode for system files Chrome OS starts with even in developer mode. So I ended up simply enabling it before starting Ubuntu with a Chrome OS script.
sudo /sbin/iptables -A INPUT -p tcp --dport 80 -j ACCEPT sudo enter-chroot startunity
4) Turn off sleep mode
Also important is to turn off the sleep mode, since a server needs to operate continuously.
sudo initctl stop powerd
The command turns off the sleep mode, but the display still turns off when closing the laptop. Very useful. I added the command to my Ubuntu startup script as well.
5.) Install Apache
Open the terminal in Ubuntu, install and start Apache.
sudo apt-get install tasksel sudo tasksel install lamp-server sudo /etc/init.d/apache2 start
One of the limitations of the Chromebook Pixel is the HD space. 30 GB is enough for web browsing, but not enough to run a web server. Therefore I attached a USB drive, and changed the Apache Document Root to the external drive. The DocumentRoot setting is in /etc/apache2/sites-available/default.
6.) Update Dynamic DNS
Since I’m using it as my home server, I needed a DNS address that dynamically updates to a new IP, in case my home router gets a new IP assigned by the ISP during restarts. I used FreeDNS as service, and added WGET to my Ubuntu startup script to call their IP update php URL. Then I used a CNAME DNS entry to point from a subdomain to their DNS.
With Ubuntu the added functionality doesn’t end with a webserver, there is also Steam for gaming, Skype, and many other apps. It required a couple of steps to get there, but the Chromebook Pixel became a lot more interesting – and a quite useful developer tool, in my case to host streaming media.