Linux

Small, personal web servers

Tiny Mini-ITX web server

Tiny Mini-ITX web server

I recently helped my roommate shop for a small, personal web server.  We wound up basing it on Intel’s Atom platform, and I was amazed at how cheap it was.  The server (pictured above) came up to almost exactly $200, including shipping, and has a 1.6GHz Atom CPU, 512MB of Memory, and an 80GB hard drive.  It runs Ubuntu 8.04 Server Edition.

The motherboard is a Mini-ITX form factor board, so the whole server is pretty small.  It has a low power consumption, with the Atom CPU using only 4W of electricity.  For anyone looking to host their own web page, the Atom is a great way to do it.  So far, the box has handled everything we’ve thrown at it quite nicely.  It’s running a LAMP server to host a few personal sites.

If you’re willing to spend a bit more (close to $300 for the same specs) you can get the server down even smaller by using a slimmer case and laptop components.

With the cost of hardware dropping, I wonder if we’ll see devices like this mass marketed to the general public.  It’s mainly a matter of making a nice interface for it to easily allow setting up a photo or blog site. Imagine a desktop application that would allow a user to type up a blog post, upload photos, etc., then automatically upload that content to the server.

If anyone’s curious, the hardware we bought is here.  The motherboard is currently out of stock, however, as Intel has released a dual core version.  I’ll update the wishlist when Newegg gets the new board in.

Automatic offsite Wordpress backups

Yesterday, I decided to set up a an automated backup solution for my site here.  Basically, it does an sqldump then sends the dump to another server over SCP.

First, I had to enable SSH login without a password in order for SCP to work in a cronjob.  I followed this howto and it worked perfectly.

Then, I created a backup script to be called by cron:

#!/bin/sh

cd /home/backups/collegegeek

FNAME=collegegeek-`date +%F`.sql

mysqldump –add-drop-table -uroot -pPASSWORDHERE collegegeek > $FNAME
bzip2 $FNAME
rm $FNAME
scp $FNAME.bz2 zach@192.168.1.82:backups/
echo “Nightly Backup Successful: $(date)” >> /home/backups/blogbackup.log

This will also leave a copy on the local server on the /home partition.  Note that /home is on a different physical drive than /var, so if the drive with the SQL database goes down, I should have a local copy as well.

Deluge turns 1.0!

Deluge 1.0.0 was just released, and will soon be is now available here

http://launchpad.net/~deluge-team/+archive

Clusterf*ck: Mass Virtualization

Sometime after I get back to Kentucky, I’m thinking of building a server for running virtual machines using VMware Server 2.0. The idea is to virtualize as many of my machines as possible.  Virtual servers, in particular, benefit from this by being able to be easily moved or cloned.  Rather than having to take a server down for upgrades, you have the  ability to clone the VM, apply the upgrade to the clone, then switch them out, resulting in nearly zero downtime.

In addition to running web and mail servers, I could also virtualize the backends to some other applications, namely Deluge and MythTV, so that the computers they ran on didn’t need to be on 24/7.  MythTV is a little tricky due to the lack of support for PCI passthrough in VMware, but I could of course use USB tuners.  I could also use a virtual machine as my primary desktop, and use a small, low powered, thin client to access it over VNC or SSH.

I recently looked into the hardware I’d want for such a server and came up with the following:

  • Intel Core 2 Quad Q6600 2.4GHz CPU
  • Intel BOXDG31PR Micro ATX Motherboard
  • Kingston 4GB (2×2GB) DDR2-800 Memory
  • Seagate 1TB SATA2 Hard Drive
  • APEX DM-387 Slim Micro ATX Case

The build would be another slim micro ATX build, similar to Cervantes and have a quad-core CPU, 4GB of ram, and a terabyte of storage.  In total, it came to a little under $600 for the entire build (I love how cheap hardware is getting) but I think I’ve decided to hold out for Nehalem before I build it.  With native quad cores and hyper threading, Nehalem should work well for this kind of project.

Ubuntu Netbook Remix

There’s been a fair amount of news online about Canonical’s specialized version of Ubuntu for Atom based laptops, but the current word on it is that Canonical will only be licensing it directly to OEMs.  However, there is a PPA that you can use to turn an Ubuntu Hardy install into UNR.

Just add the repository and install the applications that it contains, then log out and in and set up your new desktop.

I have mine configured as close as I can to what the default layout seems to be from the screenshots I’ve seen online.

UNR makes good use of available screen real estate (my screenshots are running at 800×600) by putting each application in a “Tab.”  I installed a couple of extra apps, Deluge 1.0rc2 and Banshee 1.0, and sure enough, they automatically conformed to the layout.

UNR places it’s launchers and menus on the desktop, which is quickly accessible from the “Go Home” button in the upper-left corner (it looks like an Ubuntu logo).

I’m not crazy about the look and feel.  The desktop has a nice, new, polished look to it while the applications themselves use the standard Human theme.  Either are nice on their own, but they seem to clash when used together.  The interface was also a little slow, but that may be due to running it inside a virtual machine, as I’ve heard that the interface makes some use of OpenGL.

Overall, it’s a nice product and most tasks are accomplished easily.  This will make a great OS for the Eee PC or any other subnotebook.

Easy SSH Tunneling

Whenever I work out of the San Francisco office, I have to tunnel back to my workstation in Palo Alto in order to do any development.  The way I do this is with an SSH Tunnel.  While I used to just fire it up manually, the other day I hacked up some shell scripts to automatically connect and start up my most used apps on the remote machine, and I thought I’d share them here.

First, on the local machine:

/usr/local/bin/tunnel:

#!/bin/sh
$IPADDR=0.0.0.0 # IP Address of the remote machine
$LOGON=usrname # Your username on the remote machine
$STARTUP=/usr/local/bin/startup
ssh -X $IPADDR -l $LOGON $STARTUP

and, on the remote machine:

/usr/local/bin/startup:

#!/bin/sh
gnome-terminal &
nautilus &
firefox &
pidgin &
xchat &

Essentially, a list of programs to start up. Don’t forget the & on each line, or else they won’t all start at the same time.

Make sure that both files are executable (chmod +x), then you can add a launcher to /usr/local/bin/tunnel and you’re good to go.

It’s a pretty simple trick, but it saves me several seconds each time I connect to the network.  Also, as there’s no terminal needed to keep the ssh session open, I don’t accidentally lose my session.

Always lock down your mod_proxy

So, my server had been eating bandwidth for breakfast, and I finally found out why.  I was using apache’s mod_proxy to redirect incoming connections across the network, but that was being hijacked by some ad agencies and being used as a general use web proxy.  Hopefully I’ve got that taken care of now.  While I still see several incoming connections, they are no longer slowing down the network, so I’m assuming that my fix worked.

Cervantes Lives! And other fun tales

Cervantes is back online, at least for the time being.  I’m going to take this opportunity to write a few things.  So much has happened since my last post.

Obviously, the main thing is my internship.  I’m now almost three weeks in, and I’m loving every minute of it.  The campus is downright amazing, and the weather in Palo Alto is beautiful.  I’m getting to work exclusively in Linux, and using GTK+.   I’m really starting to like coding in C/C++ now that I’m doing something useful with it.  My first paycheck has come and gone, but on the upside, I’ll have a place to live for the rest of the month.

My Thinkpad T61p has been holding up great, and has handled everything I’ve thrown at it easily.  That said, there’ll soon be available upgrades that I could consider, including 8GB of RAM and a Quad Core 2.5GHz CPU.  But at around $1000 each, I don’t think I’ll be getting either any time soon.  But, I can dream.

In the world of tech, some other goodies have been announced.  One of these is the ASUS Eee PC 901 and 1000, the newest in ASUS’s line of subnotebooks, at 9 and 10 inches, respectively.  The new generation of Eees uses Intel’s new Atom platform, including a CPU clocked at 1.6GHz, a notable improvement over the previous Celeron processor.  The new notebooks are also rated for up to nearly 8 hours of battery life.  A few days after the Eee announcement came the Canonical’s unveiling of Ubuntu Netbook Remix, a custom version of Ubuntu designed for small, Atom based netbooks like the Eee.  I’m really wanting to try it out on an Eee PC 1000.

Also, a few short days ago, Barack Obama clinched the Democratic nomination after the final two primaries, meaning he’ll be going up John McCain in the fall.  I’m very excited about this, as Obama is the first candidate in my short lifetime that I’ve actually been able to get excited about, and I’m hoping that this campaign will ultimately change the way the political system works in this country.

T61p works great with Linux

Model: Lenovo Thinkpad T61p 6459-CTO

Distro: Ubuntu Linux 8.04 LTS

  • Processor: Intel Core 2 Duo T9300 2.5GHz
    The CPU runs fast and cool.  While idling, it stays somewhere between 40 and 50 Celsius, and goes up to about 60C under load.  For comparison, the CPU in my previous laptop would hit the low 90s under load and idle around 60.
  • Video: Nvidia Quadro 570M 512MB
    The video card is well supported by the latest Nvidia drivers.  The Quadro 570M is essentially a Geforce 8600M-GT in terms of hardware, and can draw upon 512MB of memory: 256MB dedicated, and the other 256MB borrowed from the system.
    I’ve yet to put it though any stress tests, but it didn’t have any trouble playing quake 4 at default settings at 1920×1200, though I only tested it for the first minute or so of gameplay.
  • Wireless: Intel Wifi Link 4965AGN
    Works out of the box with Intel’s open source driver.  Connects without trouble to my Netgear 802.11n router, and maintains full signal stength throughout the house.

The following also worked out of the box:

  • Special buttons, including volume and media controls
  • The integrated SD card reader
  • Bluetooth

In short, every piece of hardware in the T61p works fine in Linux.  Under the latest Ubuntu release, all I had to do after installing was install the nvidia-new driver from the repositories, everything else is supported by default with open source drivers.

New Laptop: Krayt

After three years of faithful service, my Thinkpad R51 “notapowerbook” will be retired in favor of a new Thinkpad T61p, which I’ve decided to dub “Krayt.”  I had some trouble deciding what to name this one, originally thinking of “notamacbookpro” to continue the “nota” naming trend, and then my planned Eee PC I want to get down the road could be “notamacbook.”  However, as this is a desktop replacement notebook (and indeed, it’s more powerful than my desktop), I’ve decided to use my existing trend of naming computers after lizards (past computers were Iguana, Chameleon, and Komodo) by naming this one Krayt, after the fictional Krayt Dragons from the Star Wars universe.  So, the Eee will wind up being a smaller lizard, maybe “Anole.”

Anyways, the laptop was born and shipped yesterday, on April 20th.  The specs are as follows:

Lenovo Thinkpad T61p:

  • 15.4″ WUXGA (1920×1200) Display
  • Intel Core 2 Duo T9300 (2.5GHz, 6MB L2 Cache)
  • 4GB DDR2-667 Memory
  • 256MB Nvidia Quadro 570M
  • 160GB 7200rpm HDD
  • DVD+RW
  • Intel 4965AGN Wireless (802.11n)
  • Integrated Bluetooth
  • Integrated Memory Card Reader
  • 9 Cell Battery

It should arrive at the end of this week, right as I’m finishing finals for the semester.

It will, of course, run Ubuntu 8.04 LTS