After a --long-- recess I am once again in a position to share what I have recently learned concerning Ruby on Rails and everything tied to it.
Today's post will cover server administration, particularly the setup of a new webserver that will handle all of your ruby on rails and php projects. Now, this server is just what I needed for my testing environment - and should work great for the few sites I host!
This will be a two part post, but I plan to release them both within the week. So let us begin by mapping out all the major components of our new server:
- Ubuntu 6.10 (Edgy - Debian based!)
- Ruby 1.8.4 (the bread)
- Rails 1.1.6 (and butter)
- MySQL 5 (my favorite DB - close second, DB2)
- Lighttpd (fastcgi webserver)
- PHP 5 (fast-cgi enabled)
- CVS (source code repository)
- Exim (for mail)
- Vsftp (paranoid and secure FTP server)
Well, this will be a well rounded server that will give you the option to use either the desktop environment, or good ole command line (my preference, in fact I'll show you how to disable the desktop if you no longer need it at the end). So, lets get started:
First go to:
I am going to assume that you have a fair level of comfort in installing an OS, especially one as easy as Ubuntu. So, I will skip all the details and just assume that you have successfully setup Ubuntu on your system. Besides, there are a ton of easy guides to the initial install of Ubuntu. So I would prefer to spend my time explaining all the changes we will make to our future Ruby on Rails development server.
So, now that you have Ubuntu installed we are ready to install lighttpd, ruby, rails, mysql php and more. So lets start by making it possible for us to get all these packages. Open a konsole window (Applications -> System Tools -> Konsole) and enter the following command:
sudo nano /etc/apt/sources.list
Uncomment the following lines:
deb http://us.archive.ubuntu.com/ubuntu/ edgy universe
deb-src http://us.archive.ubuntu.com/ubuntu/ edgy universe
deb http://security.ubuntu.com/ubuntu edgy-security universe
deb-src http://security.ubuntu.com/ubuntu edgy-security universe
Hit Ctrl+X to save -- when prompted, enter Y to save the changes to the file. Now we are ready to update apt-get's list of available packages so we can install what we need. Then, after we update, its time to start installing a few packages. Of course you can always use the apt-get -s [programs-to-install] syntax (adding the -s option) to any of the below commands so you can see what will be installed first.
sudo apt-get update
sudo apt-get install ruby ri rdoc libmysql-ruby mysql-server
Now that ruby is installed (and mysql) we should get rubygems so we can install rails. To get the release that is current at the time I wrote this, do the following commands:
sudo wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar -xvzf rubygems-0.9.0.tgz
cd rubygems-0.9.0
sudo ruby setup.rb
After you finish the setup, feel free to remove the .tgz and rubygems folders from your desktop. Now its time to install rails - that beautiful one liner coming at ya:
sudo gem install rails --include-dependencies
Rubygems does the magic, of course it prompts you on several dependent packages - all of which you should answer "Y" to. So, now your Ubuntu distrobution has rails, and is ruby enabled. Go ahead, run that "ruby -v" and "rails -v" commands on the Konsole - it'll make you smile =)
Well, I know this is a bit short, but I'll finish this out before Christmas with all the remaining packages. Most importantly I will detail all the changes to config files and settings you will need to make. Once we are complete, we will have a fully functioning server to develop (with source code control), test, and host your ruby on rails and php sites. Stay tuned!
