Configuring Debian for Ruby on Rails

After configuring server after server over the years, I've settled on Debian as being my "distro of choice". Some time ago, I started keeping track of the commands I'd routinely type when setting up a new server and those commands have morphed into a Perl script which I now use instead. This script is designed to take an out-of-the-box Debian 4.0 standard installation and turn it into a lean mean Apache-Mongrel-Mysql-Rails serving machine with minimal effort.

Getting and using the script

This script assumes you have a standard Debian 4.0 installation (with networking already setup) and that you are logged in as root. If you choose to use this script at your own risk, type:

debian:~# wget http://svn.bountysource.com/fishplate/scripts/debian_install.pl debian:~# perl debian_install.pl Enter full hostname (example: server1.yourdomain.com): server1.mydomain.com Install ruby, rails, gem, etc (y,n) [Y]? Install mysql server (y,n) [Y]? Install apache (y,n) [Y]? Install mongrel/mongrel_cluster (y,n) [Y]? Reboot when done (y,n) [Y]?

Then sit back and watch as the script sets up everything for you and then reboots!

What the script does

  • updates the core debian packages and sets up a crontab to do so once a week
  • installs sshd just in case it's not there already
  • installs some common packages all servers should have (compile tools, dnstools/traceroute, rsync, subversion, mysql client, etc)
  • sets up the hostname
  • installs a exim4 for sending mail
  • sets the server's timezone to UTC and sets up a crontab to sync the time once a day
  • optionally installs ruby, rubygems, irb, rails, imagemagick, and a few other common gems
  • optionally installs mysql-server
  • optionally installs apache and enables some common apache modules
  • optionally installs and configures mongrel and mongrel_rails
  • optionally reboots

Plans for the future

Without a doubt, I'll be making enhancements to this script over time as I try to automate repetitive tasks I find myself doing again and again. This is just my take on the "ideal Debian setup". Feel free to suggest any changes/enhancements.

Sorry, comments are closed for this article.