Skip to content

Instantly share code, notes, and snippets.

@krukid
Created February 24, 2010 02:12
Show Gist options
  • Save krukid/312991 to your computer and use it in GitHub Desktop.
Save krukid/312991 to your computer and use it in GitHub Desktop.
Ruby on Rails for virtualized Ubuntu
PURPOSE
-------
The following is a walkthrough of Ruby on Rails installation on a VirtualBox'ed Ubuntu and some related tricks.
NOTES
-----
* Most of the commands below require superuser privileges, so with that in mind we proceed.
SETTING UP VIRTUALBOX: HOST WINDOWS (Windows 7) --> GUEST LINUX (Ubuntu 9.10)
----------------------
1) Get Sun's VirtualBox, install.
2) Create .vdi virtual disk to store your virtual Ubuntu.
3) Get the Ubuntu distribution .iso image.
4) Assign the disk and image to the virtual machine profile.
5) Tweak other options to your liking.
6) Mount the distribution, install Ubuntu.
7) Perform Ubuntu updates and whatever.
8) Install VirtualBox Guest Additions via VirtualBox main menu, mount the image in your virtual machine
instance, run the appropriate script (autorun.sh or directly linux-x86-you-get-the-idea), restart the
virtual machine.
9) Set up a shared folder via VirtualBox menu and then:
mkdir /mnt/<mount-point>
mount -t vboxsf <SharedFolder> /mnt/<mount-point>
note: to mount a shared folder in virtual windows evironment use the following command
net use w: \\vboxsrv\shared
10) Set automount (fstab) - haven't tried
BUILDING RUBY 1.9.1-p376
-------------
1) Get the ruby package.
!) apt-get install zlib1g zlib1g-dev zlibc libssl-dev
!) more lib info: http://greenprogrammer.blogspot.com/2006/05/ruby-wreadline-on-ubuntu.html
#) there will be a lot of pain in the ass if you don't install the zlib and openssl headers at this point
2) tar -xzf <package> -C /usr/local/src
#) assuming package a .tar.gz archive
3) cd /usr/local/src
4) ./configure
5) nano ext/Setup (README says uncomment needed extensions - still, they all seem to compile regardless)
6) make
) make test (optional)
7) make install
SET UP MYSQL SERVER
-------------------
1) Get the MySQL server package (Synaptic Package Manager on Ubuntu),
) which also installs client libs and such;
) install.
2) mysql -u root -p
) show databases;
) exit
3) Install libmysqlclient-dev package for headers, in order to compile mysql gem.
INSTALLING GEMS
---------------
0) ruby --version
) gem update --system
1) gem install rails
2) gem install mysql
3) gem update
++ Installing ImageMagick for Ruby ++
1) apt-get install imagemagick
2) apt-get install libmagick9-dev
3) gem install rmagick
SETTING UP NETBEANS IDE
-----------------------
1) Get Sun's JDK6 package via Synaptic Package Manager (Ubuntu);
) java -version
2) Get netbeans install script .sh
3) chmod +x <netbeans-install-script>.sh
4) sh <netbeans-install-script>.sh
5) Update IDE from within.
6) Add "-J-Druby.no.kcode=true" to netbeans_default_options in <netbeans install dir>/etc/netbeans.conf
to avoid actionmailer crash - a Ruby1.9/NetBeans bug
CREATING A RAILS PROJECT
------------------------
0) consider /mnt/myproj instead of ~/Projects/myproj (see VIRTUALBOX step)
1) cd ~/Projects
) rails <myproj>
2) Open NetBeans IDE and use wizard to create a Ruby-on-Rails project from existing sources;
path ex. /usr/home/<profile>/Projects/<myproj>
#INSTALLING MONGREL, APACHE
#ACCESSING VIRTUALBOX'ED SERVER FROM HOST OS
P.S.
----
My workspace setup:
* project is hosted by Windows and shared via VirtualBox shared folder, mounted by Ubuntu
* project is distributed over 2 physical drives and linked via Windows junction functionality:
a) X:\Projects\MyProj [\public\resources -> R:\]
b) R:\ (bit-locked)
Issues encountered:
Successfully installed Win7 + Ruby1.9.1-p378(RC2) (via RubyInstaller) /Rails + MySQL5.1 + NetBeans6.8 +
Mongrel, but every now and then, while running a basic app, a fatal error occurred at random crashing Ruby
interpreter and everything with it. No crash logs, suspect elusive segmentation fault. Attempted to
downgrade both Ruby(1.8.7) and MySQL(5.0) to no avail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment