Tracy Phillips

Archive for the ‘ruby on rails’ tag

Ruby On Rails Setup With FreeBSD

leave a comment

Setting up Ruby on Rails using FreeBSD has to be one of the most dead simple things (/me knocks on wood) that you can get setup.

First you will need to have Ruby installed. If you have been following along in our Setting up FreeBSD series this was done for you when you installed portupgrade. If you don’t just use portinstall ruby and then you will be up to speed with us.

With Ruby installed, the next step is to install Ruby Gems

[server][root][~]# portinstall ruby18-gems

Next we will want to install the rails gem with Ruby Gems.

[server][root][~]# gem install rails --include-dependencies

Whew that was hard :) Ruby on Rails is now setup. Next we will go through the process of setting up a Ruby on Rails blog application… I think Typo would fit the bill don’t you?

Rails Server Setup:

Part 1: New Server Setup
Part 2: Setup FreeBSD 6.x
Part 3: FreeBSD Usability
Part 4: Setup FreeBSD To Use Blowfish
Part 5: Install and Setup PostgreSQL
Part 6: Install Lighttpd on FreeBSD
Part 7: Install MySQL 5.x on FreeBSD
Part 8: Install Ruby On Rails with FreeBSD

Written by Tracy

December 11th, 2005 at 12:29 pm

Posted in FreeBSD

Tagged with , ,

Setup FreeBSD 6.x for Ruby on Rails

leave a comment

The purpose of this exercise is to get a clean working environment for Ruby on Rails. Using any of the current web hosting control panels makes it a hack to put it lightly. Since I was going to do it from scratch to begin with, I reasoned that I should be using the best software for the job and not the most popular.

I am not going to go through the steps of actually installing FreeBSD, that has been explained all to well in other places. I will note that I did a basic install, that is to say that I did not elect to install any applications or ports.

To start things off, we will want to get a fresh copy of the ports installed on our boxen. We use to do this by setting up CVSup and getting the latest ports releases. With FreeBSD 6, we have a new utility that is installed by default called Portsnap. Portsnap is a system for securely downloading and updating a compressed snapshot of the FreeBSD ports tree, and using this compressed snapshot to extract or update an (uncompressed) copy of the ports tree. So lets go and get the latest ports and then extract them into our ports tree.

[server][root][~]# portsnap fetch

There we go, we have a shiny new compressed copy of the entire ports tree. Now lets create our directory structure and extract the snapshot.

[server][root][~]# mkdir /usr/ports;portsnap extract

A lot of items tend to rely on Berkeley DB from Sleepycat (now owned by Oracle), so lets get started with the latest version instead of an earlier version that some ports want to install by default.

[server][root][~]# cd /usr/ports/databases/db44;make install clean

Install portupgrade, which also includes the Portinstall utility that we will be using to install the rest of our ports. Installing portupgrade also installs Ruby as a dependency, which is cool because we will not have to deal with it as a separate item later on.

[server][root][~]# cd /usr/ports/sysutils/portupgrade;make install clean

Lets give out the ole’ rehash command so that csh will recognize the newly installed application. This little item will go away after we install the bash shell later on.

[server][root][~]# rehash

Now lets install portmanager, which we will use to upgrade our ports with. I used to use Portupgrade, but this seems to be a nicer solution to upgrading the ports and their dependencies. I guess time will tell on this one. I did not select any of the compile options.

[server][root][~]# portinstall portmanager

Another nifty item that I like is Portaudit, that I use to mitigate third party vulnerabilities (the ports). Portaudit polls a database, updated and maintained by the FreeBSD Security Team and ports developers, for known security issues. During the install process, Periodic(8) gets updated, so that daily security run emails get sent to root’s email account.

[server][root][~]# portinstall portaudit

Now that it installed, we need to update the database stored in /var/db/portaudit. The database will automatically be updated during the periodic(8) run, so this is optional.

[server][root][~]# rehash

To audit the few ports we have installed at this point, we can run the following command

[server][root][~]# portaudit -a

If there are problems then you will have some output and then you can use portupgrade to upgrade the affected package.

Now that we have the ports system taken care of, lets configure a way to get the base system updated. To do that we will use freebsd-update to download and install binary updates to the base system.

[server][root][~]# portinstall freebsd-update
[server][root][~]# cp /usr/local/etc/freebsd-update.conf.sample /usr/local/etc/freebsd-update.conf
[server][root][~]# rehash
[server][root][~]# freebsd-update fetch

If there were any updates downloaded then we could use the following to install them.

[server][root][~]# freebsd-update install

Now for some usability items that I have grown fond of while using Linux over the past few years.
I mentioned earlier that I prefer the bash shell compared to csh, so lets get that installed. When installing bash, you will have some choices to make. I like bash2 and have no need for bash1, so when asked about bash2, type yes and type no when asked if you want to install bash.

[server][root][~]# portinstall bash

If you have edited anything on the system yet with vi, then you will notice how bare it is compared to vim (no, before you ask, I do not use Emacs). Lets install vim without the X Window options that get installed with the regular vim port.

[server][root][~]# portinstall vim-lite

Now when I look at directories using ls, I like the directories and files to be shown in all their glorified color, so I can quickly see what is going on. I prefer GNU ls instead of the default FreeBSD ls, so lets install gnuls.

[server][root][~]# portinstall gnuls

Lets go ahead and setup our locale in /etc/login.conf. Make sure the end of your default section looks like the following, paying special attention to put a backslash (\) at the end of the umask line.

:umask=022:\
:charset=en_US.UTF-8:\
:lang=en_US.UTF-8:

Save and close the file.

We need to rebuild the login.conf database for our changes to take place.

[server][root][~]# cap_mkdb /etc/login.conf

I guess that is all for now. In the next post on the subject, I will do a little house keeping and setting up dot files to make bash, vim, and gnuls a bit more user friendly.

Rails Server Setup:

Part 1: New Server Setup
Part 2: Setup FreeBSD 6.x
Part 3: FreeBSD Usability
Part 4: Setup FreeBSD To Use Blowfish
Part 5: Install and Setup PostgreSQL
Part 6: Install Lighttpd on FreeBSD
Part 7: Install MySQL 5.x on FreeBSD
Part 8: Install Ruby On Rails with FreeBSD

Written by Tracy

November 29th, 2005 at 3:59 pm

Posted in FreeBSD

Tagged with ,

New Server Setup

leave a comment

I am going through the process of switching from a Linux server (CentOS to be exact) running DirectAdmin as the control panel to a FreeBSD server with no control panel for management. Since I do not have to build within the constraints of some other company’s control panel, I thought I would install the best of breed servers and applications.

The main components that I require to be installed are:

PostgreSQL
Lighttpd
Ruby On Rails
Subversion
Postfix
Dovecot
Dspam

I will most likely do some more tweaking but at the moment that is the standard I wish to build against. I know for a fact that I will do some more “tweaking” such as setting up DNS RBLS, SPF, and maybe even Yahoo Domain Keys along with some good old postfix filtering for spam (can you tell I hate spam).
The fist thing that I will get to (hopefully in the next post) will be setting up FreeBSD 6 and getting it ready to install applications onto.

Rails Server Setup:

Part 1: New Server Setup
Part 2: Setup FreeBSD 6.x
Part 3: FreeBSD Usability
Part 4: Setup FreeBSD To Use Blowfish
Part 5: Install and Setup PostgreSQL
Part 6: Install Lighttpd on FreeBSD
Part 7: Install MySQL 5.x on FreeBSD
Part 8: Install Ruby On Rails with FreeBSD

Written by Tracy

November 28th, 2005 at 4:41 pm

RailsConf 2006

leave a comment

It looks like Ruby on Rails is getting large enough to have its own conference.
RailsConf 2006
Rails seems to be raising some eyebrows in the Java communty as well. Ruby the Rival over at OnJava.com is an inteview with four Java “luminaries” about the possible impact of Ruby on Rails in the enterprise. Some of them are even taking the time to sip on a glass of Kool-Aid.

Written by Tracy

November 28th, 2005 at 10:02 am

Posted in Technology

Tagged with , , ,