By Hathy A
Ruby on Rails, or RoR for short, is a very popular full-stack web application development framework written in Ruby. It allows you to rapidly develop web applications that conform to the MVC (model-view-controller) pattern.
This tutorial will cover how to set up a Ruby on Rails development environment using RVM on your FreeBSD 10.1 server.
Note: As of July 1, 2022, DigitalOcean no longer supports FreeBSD Droplets through the Control Panel or API. However, you can still spin up FreeBSD Droplets using a custom image. Learn how to import a custom image to DigitalOcean by following our product documentation.
Before you begin, all you need is:
A FreeBSD 10.1 server.
A user with root privileges. (The default freebsd user is fine.)
This tutorial will use the Ruby Version Manager, or RVM for short, to install Ruby. Because RVM works best with bash 3.2.25 or higher, in this step, we will install bash and set it as the default shell.
Before we begin, log into your FreeBSD 10.1 server.
- ssh freebsd@your_server_ip
Next, install the latest version of bash using
- sudo pkg install bash
We’ll need to add a line to
/etc/fstab for bash to work. Open the file using
ee or your favorite text editor.
- sudo ee /etc/fstab
Add the line
fdesc /dev/fd fdescfs rw 0 0 to the end of the file as shown below.
# Custom /etc/fstab for FreeBSD VM images /dev/gpt/rootfs / ufs rw 2 2 /dev/gpt/swapfs none swap sw 0 0 fdesc /dev/fd fdescfs rw 0 0
Save and exit the file, then mount the new entry.
- sudo mount -a
Now that bash is installed, set it as your default shell using the
- sudo chsh -s bash
To start using bash, log out and log back in to your server. If you don’t want to log out, you can start a bash session manually by typing in:
In this step, we will install RVM.
To download the RVM installer, you first need to install
- sudo pkg install curl
Move to the
- cd /tmp
Download the RVM installer script from
- curl -sSL https://get.rvm.io -o installer.sh
Finally, use the script to install the latest stable release of RVM.
- bash installer.sh stable
Because RVM makes a few changes in your shell’s startup configuration, the recommended way to activate those changes is by logging out of your current session and logging back in. Alternatively, you can apply the changes to your current session manually by running:
- . ~/.rvm/scripts/rvm
You can now use RVM to install any version of Ruby. Because 2.2.2 is the latest stable version available as of June 2015, we’ll install this version.
- rvm install 2.2.2
This will take a moment. Once the installation completes, list the rubies available on your system.
- rvm list
If your installation was successful, you will see:
rvm rubies =* ruby-2.2.2 [ i386 ] # => - current # =* - current && default # * - default
To confirm that Ruby 2.2.2 is present in your
$PATH, type in:
- ruby -v
You should see a message that looks like this:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-freebsd10.1]
In this step, we will install Ruby on Rails.
Because Ruby on Rails is a gem, it can be easily installed using RubyGems (Ruby’s package management framework) using
gem install rails. However, this installation will take a while to complete because it includes lots of other gems (some of which need to be compiled) and their documentation files. You can speed up this command considerably by adding the
--no-rdoc --no-ri flags, which will skip the documentation installation.
Install Ruby on Rails, optionally without documentation.
- gem install rails --no-rdoc --no-ri
- sudo pkg install node-devel
Now that the Rails installation is complete, let’s test it by creating an empty project inside the
If you’re not still in the
/tmp directory, change to it.
- cd /tmp
rails command to create a new project called test-project (or whatever you like).
- rails new test-project
Enter the project directory.
- cd test-project/
And finally, try starting the Rails console.
- rails c
If your Rails installation was successful, you should see the following prompt:
Loading development environment (Rails 4.2.1) 2.2.2 :001 >
You can exit the prompt by entering
In this tutorial, you learned how to set up Ruby on Rails on your FreeBSD 10.1 server. You can now use your FreeBSD server as a development environment for your Rails projects!
While doing so, you also learned how to install Ruby using RVM. If you want to learn more about RMV, check out this tutorial on how to use RVM to manage your Ruby environments.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Click below to sign up and get $200 of credit to try our products over 60 days!
For some reason I’m not able to run rvm/script file.
I was taking a look to the file at https://github.com/rvm/rvm/blob/master/scripts/rvm and when I check my $BASH_VERSION I don’t get any output. Mine Bash is not well setup.
I’m running a script that install ruby and puppet. But I’m stuck with ruby to do the installation in one step, I can’t logout and loging.
I try to change the shebang to any thing I could think and nothing make the $BASH_VERSION be there.
How is possible you could install it?