After pulling MUCH of my hair (not that I have much left), finally found out the BEST solution from this blog post
- Download and install VirtualBox
- Download an ISO of Ubuntu 11.04
- Create a VM from the Ubuntu ISO
- Launch a terminal and prepare Ubuntu for Ruby (instructions adapted from this site)
- sudo -i
- apt-get update
- apt-get -y install build-essential zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libopenssl-ruby libcurl4-openssl-dev libssl-dev mysql-server
- apt-get -y install git-core
- apt-get -y install curl wget
- Now, build and install Ruby from source (sudo is implied)
- cd /usr/local/src
- wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
- tar -xvf ruby-1.9.2-p180.tar.gz
- cd ruby-1.9.2-p180
- ./configure
- make
- make install
- Install the gems, including Rails and Passenger, as well as the web server, nginx
- gem install rails
- gem install passenger
- passenger-install-nginx-module
- If you receive an OpenSSL error, follow these steps:
- cd /usr/local/src/ruby-1.9.2-p0/ext/openssl
- ruby extconf.rb
- make
- make install
- Configure nginx to run as a service and to start with the vm (instructions adapted from this site)
- adduser –system –no-create-home –disabled-login –disabled-password –group nginx
- gedit /etc/init.d/nginx (paste the following code in the file and save it)
- chmod +x /etc/init.d/nginx
- /usr/sbin/update-rc.d -f nginx defaults
- /etc/init.d/nginx start
#! /bin/sh### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFOPATH=/opt/nginx/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/nginx/sbin/nginx
NAME=nginx
DESC=nginxtest -x $DAEMON || exit 0# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi
set -e
. /lib/lsb/init-functions
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/opt/nginx/logs/$NAME.pid --exec $DAEMON || true
sleep 1
start-stop-daemon --start --quiet --pidfile \
/opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration: "
start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
;;
status)
status_of_proc -p /opt/nginx/logs/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac
exit 0 - Done
In step 6, command “gem” might not be installed correctly.. in that case, do this
1. Download latest ruby gems (.tgz) from here
2. unzip, then run “ruby setup.rb”
3. VOILA
Related posts:
I’m happy the post was helpful. Sometimes I’m not sure whether or not I should post something, but it seemed like it might be helpful to someone else. Glad to see that was the case here. Good job.