The Perfect Lightweight Rails/Lighttpd/Debian install

Posted by ezmobius Sun, 13 Nov 2005 07:31:00 GMT


OK folks, I have finished my write up of an install of the perfect stack on a rimuhosting.com xen VPS. But keep in mind that you can use these instructions to install the rails stack on debian on a dedicated host or a box in your closet. It will work for wherever the box is. So without further ado, I present you with instructions for installing a stack of software as follows:


Ruby
Gems
Rails
ImageMagick
Rmagick
mysql
mysql-ruby bindings
sshd
sftp
fastcgi-dev kit
fastcgi-ruby bindings
perl-compat-regex(for lighttpd)
lighttpd 1.4.7 with fastcgi
subversion client and server
postfix email server with
Webmin Control Panel set up with a bunch of modules for ssh 
and postfix as well as webmail.
Whatever else is needed 
along the way as dependencies

Ed: I have reformatted the tutorial with the help of Sean Schertell. It's much better looking and easier to read now. I also want to make it clear that The Imagemagick and RMagick that get installed with my instructions are fully functional. I have tested it with .jpg, .gif, .png and .tiff files by resizing and converting between all those formats and it works perfectly.

If anyone has suggestions for things to add to the setup to make it even better, please leave suggestions in the comments and I will try to add it to the tutorial.

The Perfect Rails VPS

Posted in , , ,  | 26 comments

Comments

  1. raaum said about 7 hours later:

    Hey Ezra,

    Very nice! Just a couple comments to help you make it even better!

    It's nice to be able to call on subversion from ruby/rails, for which you need to install the swig bindings before subversion. (and necessary if you want to run, say, collaboa)... and if you disable all the extra language bindings you don't need, it's not very big.

    Also, for rmagick/imagemagick it's not clear if libjpeg, tiff, libpng, libwmf, etc are installed on your image by default. If they are not, rmagick/imagemagick may be 'functional' and you may be able to successfully load it, but it won't actually do anything useful...

    cheers!

    -r

  2. Ezra Zygmuntowicz said about 14 hours later:
    Thanks Ryan- Thats a good call. Do you have a link somewhere that I can use to install swig and friends? About the jpeg, png and gif libs. They are all installed when you use the commands in the tutorial. I tested it and I am able to resize and convert between .jpg, .png, .tiff and .gif without any problems. Please let me know if anyone has anything else that they think should be added to the 'perfet rails' set up. I am very happy with the way these systems come out and perform. So anything I can add to make it even better is just frosting.
  3. Matt White said 1 day later:
    Ezra, Thank you SO MUCH. I'm moving over to RoR from an ASP.Net background, and I haven't used Linux for a few years. The idea of a VPS was way cool, but I was pretty freaked out about being an admin and a developer as well. Using your tutorial I was able to set up an old PC as a test/development server, and I'm going to do the same to get some clients running on rimuhosting. AND I was able to use Debian, which as you say helps to leave a lot more space for serving than using the other distros.
  4. Amr said 1 day later:
    That tutorial is seriously awesome!! Rimu should pay you for making their VPS server option so attractive (and easy to use) or at least throw in a free VPS server for you. I'm seriously thinking about it after reading the tutorial and I was gonna do exactly what Matt White has mentioned above (try it out on the ole box first) thanks :) -A
  5. Ezra Zygmuntowicz said 1 day later:
    Yeah keeo in mind that you can use these instructions with any debian server whether its with rimu or not.
  6. Amr said 9 days later:
    Hey Ezra, your instructions work great! thanks! Now a stupid question. Can you post some pointers on setting up the name resolution for the VPS server? or can that be done through the webmin that you mentioned towards the end? sorry, a born-again unix user here, any links to how-to's or a small writeup will be much appreciated! Great job btw!
  7. Amr said 9 days later:
    Ooops! shoulda waited. Nevermind, found it in the support/howto section at RimuHosting's site. Thx. -A
  8. David Jeschke said 13 days later:
    Thank you very much for this. I'm sure it saved me several days of work figuring all this stuff out. I followed your instructions and installed on a VMware virtual machine. A few things worth noting: the barebones Debian Sarge netinst doesn't have SSH so you have to install it with 'apt-get install ssh'. Also you need to add symlinks from gcc=>gcc-3.4 and g++=>g++-3.4 or the configuration steps for ruby-fcgi and PCRE will fail, respectively. And I used rubygems-0.8.11 instead of 0.8.10 and lighttpd-1.4.8 instead of 1.4.7 with no apparent problems. I'll play around with it for a while and if everything works out I'll probably sign up for some rimuhosting. You should get a commission!
  9. Dylan said 31 days later:
    Seriously Ezra... thank you MUCH ! This is an excellent setup process, and you've just setup a new rails customer at rimuhosting :)
  10. Dylan said 53 days later:
    I did notice that Rimuhosting didn't have procmail installed on my Debian box by default... so had to apt-get that as well. You may want to add that tidbit to your tutorial :)
  11. Foo said 54 days later:
    > I have tested it with .jpg, .gif, .png and .tiff files by resizing and converting between all those formats and it works perfectly. But does it support .wmf vulnerabilities? :-)
  12. Kian said 56 days later:
    Thanks for your setup info. I've signed on at Rimu for one of my clients, and have just set them up, very close to this. Although we're using postgresql (you don't really use mysql do you?), and phppgadmin. Anyway, it screams. I'm using the new spinner/spawner/reaper processes. Like them a lot. Looking forward to your 'control panel'. Also want to give your where clause plugin a try -- that's a great idea to clean up the ugly :condition option. And can't wait for your book. Will you post some early versions of it for review and feedback?
  13. Kelly said 68 days later:
    Thanks very much. I used your instructions to set up a site on rimu. What about the fast c mysql bindings? Seems like they are the prefered mysql rails drivers. Why are you using the ruby native bindings? Thanks
  14. Ezra Zygmuntowicz said 71 days later:
    Those are the C mysql bindings that I install in the tutorial
  15. Barry said 72 days later:
    I was able to follow your instructions on a unixshell VPS. I had to run apt-get update before starting. The postfix install proceeded differently than in your writeup. The config file did not have any of the smtpd or smtp lines :-( At the end when I performed the telnet test I only got: 250-domain.tld 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250 8BITMIME So I guess it failed. Possibly the unixshell debian 3.1 minimal is missing an important package. The full install was only 638M. Could you add preferred instructions for starting lighttpd automatically after a reboot?
  16. Barry said 80 days later:
    I tried the full Debian 3.1 at Unixshell and Postfix was not happy. I retried with Debin 3.1 minimal (followed the instructions more closely) and it worked as documented. Thanks.
  17. Jason said 148 days later:
    Great stuff, my only recommendation is to update the version of Lighttpd (wget http://www.lighttpd.net/download/lighttpd-1.4.7.tar.gz => wget http://www.lighttpd.net/download/lighttpd-1.4.11.tar.gz) you compile. I'm on Rails 1.1. I ended up scratching my head for a couple of hours trying to figure why my application wouldn't work even though lighttpd was working fine. Thanks again for putting the instructions together.
  18. Roberto said 150 days later:
    I folllowed this exellent tutorial and did the following changes to get ruby 1.8.4: First I prepared for apt-pinning: http://jaqque.sbih.org/kplug/apt-pinning.html then I did this: apt-get -t unstable ...(all the ruby stuff)
  19. Jed Hurt said 234 days later:
    Now that DHH did a write up on setting up Mongrel with Lighty using Pound, is FCGI still considered part of the perfect stack? Apparently 37 Signals thinks Mongrel has replaced FCGI for the ideal production server. What would you think about branching the guide to include instructions on a Debian/Lighttpd/Pound/Mongrel stack?

    DHH's write-up on Riding Rails: http://weblog.rubyonrails.org/2006/7/3/pound-makes-lighty-and-mongrel-play-nice
  20. Ezra said 235 days later:
    My book for the pragmatic programmers called Agile Rails Deployment has a new version of the perfect stack that covers much more in detail stuff. I hope to make it the free sample chapter from my book when it goes beta this month.
  21. Jed Hurt said 235 days later:
    Well, sign me up for the beta book baby!
  22. Kyle Kochis said 239 days later:
    Thanks Ezra! I used your tutorial for setting up my rimu hosting VPS. There are some things that you may want to add/change now that I went through it: After you edit the .bashrc file you will either want to type ". ~/.bashrc" or logout and log back in so your changes take effect before you do anything else. many people will already know this but your tutorial is already detailed so why not add this in as well? Also, it may be a better idea to change the lighttpd install from 1.4.7 to 1.4.10+ (I used 1.4.11). I had trouble with 1.4.7 when trying to run script/server because it kept telling me that CWD was not defined for the lighttpd.conf file. when I upgraded it to 1.4.11 it all worked and stopped giving me that error.
  23. nieruchomości said 302 days later:
    ogłoszenia nieruchomości, nieruchomości, nieruchomości warszawa, wynajem mieszkań warszawa, wynajmę mieszkanie
  24. addiction said 305 days later:

    The gravity of addiction

  25. ADNIK said 489 days later:
    Ezra, Thank you SO MUCH. I'm moving over to RoR from an ASP.Net background, and I haven't used Linux for a few years. The idea of a VPS was way cool, but I was pretty freaked out about being an admin and a developer as well. Using your tutorial I was able to set up an old PC as a test/development server, and I'm going to do the same to get some clients running on rimuhosting. AND I was able to use Debian, which as you say helps to leave a lot more space for serving than using the other distros
  26. JohnW said 522 days later:
    Any chance you could provide the same tutorial but for nginx+mongrel cluster setup?

(leave url/email »)

   Preview comment