There are the steps and notes for a new VM used for development. Here is an article about hypervisor (XEN) here This is how many host are set up. Good links to preconfigured server providers.

  1. Created new VM using parallels, – set the Disk to a smaller amount than the default 64GB, lowered memory to 512k
  2. Did the custom install with Graphics
  3. Selected Standard system and Desktop to install
  4. pretty much defaults for the rest of the install

These are the steps to configure the general server:

  1. Needed to set my standard user as Sudo user
  2. To install parallels tools, I had to copy the files from the mounted volume, change the permissions and then run the specified command.
  3. had to install sudo (no gui version), then edit /etc/sudoers, added user to list root ALL (ALL)
  4. Next install build-essential (apt-get), then downloaded and installed ruby using these instructions – HERE for ruby 1.8.7-p334
  5. Installed Gem using same instructions, but modified for RubyGems 1.6
  6. sudo wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
    sudo tar -xzvf rubygems-1.3.5.tgz
    cd rubygems-1.3.5
    sudo ruby setup.rb config
  7. Install zlib for ruby – apt-get libyaml-ruby libzlib-ruby libz-dev ruby-dev ruby-zlib
  8. Now Ruby Gems is installed – gem install rails !
  9. go to the ../etc/openssl folder
  10. sudo ruby extconf.rb
  11. sudo make, sudo make install
  12. I then install RVM system wide using the instructions found here – HERE
  13. I had to set the source to the shared location to get it to work as a function
  14. Next installed SSH sudo apt-get install ssh

Network Configuration

  1. to setup static ip
  2. edit the /etc/networks/interfaces file
  3. set the following : allow-hotplug eth0
    iface eth0 inet static
    address 10.0.1.101
    netmask 255.255.255.0
    gateway 10.0.1.1
    auto eth0
  4. then change /etc/resolv.conf  add 10.0.1.1 to the nameserver list, austin.rr.com should be there under search and domain,
  5. test with /sbin/ifconfig, restart with sudo /etc/init.d/networking restart

Webserver setup – NGINX

  1. You have to install nginx with passenger because it has to compile
  2. sudo gem install passenger
  3. apt-get install libopenssl-ruby libcurl4-openssl-dev libssl-dev
  4. sudo passenger-install-nginx-module
  5. follow the steps, i choose the default install
  6. now we have to create a init script, this is the one I used sudo /etc/init.d/nginx source
#! /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 INFO

PATH=/opt/nginx/sbin/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/nginx/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
        . /etc/default/nginx
fi

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$NAME.pid \
                --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$NAME.pid \
                --exec $DAEMON
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile \
               /opt/nginx/logs/$NAME.pid --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                /opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;
  reload)
      echo -n "Reloading $DESC configuration: "
      start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/$NAME.pid \
          --exec $DAEMON
      echo "$NAME."
      ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
  1. sudo chmod +x /etc/init.d/nginx
  2. sudo /usr/sbin/update-rc.d -f nginx defaults

Setting up FTP server – so i could move files easily

  1. used directions from here http://www.debian-administration.org/articles/228
  2. -apt-get install proftpd

Setting up NGINX and Php

  1. This comes from here
  2. Get PHP stuff – sudo apt-get install php5-cgi php5-mysql
  3. create a init script- sudo /etc/init.d/php-fastcgi
  4. use this script
  5. #!/bin/bash
    BIND=127.0.0.1:9000
    USER=www-data
    PHP_FCGI_CHILDREN=15
    PHP_FCGI_MAX_REQUESTS=1000

    PHP_CGI=/usr/bin/php-cgi
    PHP_CGI_NAME=`basename $PHP_CGI`
    PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
    RETVAL=0

    start() {
          echo -n "Starting PHP FastCGI: "
          start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS
          RETVAL=$?
          echo "$PHP_CGI_NAME."
    }
    stop() {
          echo -n "Stopping PHP FastCGI: "
          killall -q -w -u $USER $PHP_CGI
          RETVAL=$?
          echo "$PHP_CGI_NAME."
    }

    case "$1" in
        start)
          start
      ;;
        stop)
          stop
      ;;
        restart)
          stop
          start
      ;;
        *)
          echo "Usage: php-fastcgi {start|stop|restart}"
          exit 1
      ;;
    esac
    exit $RETVAL
  6. sudo chmod +x /etc/init.d/php-fastcgi
    sudo service php-fastcgi start
    sudo update-rc.d php-fastcgi defaults
  7. in the /opt/nginx folder create two sub-folders sites-available and sites-enabled

Setting Up MySQL, phpmyadmin, and php

  1. to get mysql 5.1 (if using debian v 5 Lenny), need to add to /etc/apt/sources.list – deb http://packages.dotdeb.org lenny all
  2. apt-get update
  3. sudo apt-get install libmysqlclient15-dev
  4. Add user :  mysql -u root -p
  5. CREATE USER ‘user1′@’localhost’ IDENTIFIED BY ‘pass1′;
  6. GRANT ALL ON *.* TO ‘user1′@’localhost’; FLUSH PRIVILEGES;
  7. Next download and install the latest phpmyadmin, I put it in the /opt/nginx/html directory, but you can put it anywhere and create a symlink using:
  8. ln -s /webapps/mycook/public /opt/nginx/html/rails
  9. if you do go this route you can just do a “passenger_base_uri /railsapp1; ” provided the link is in the root defined for the server like “root html;”
  10. Here are my examples of some nginx.conf setups for different urls, I like the setup as servername/site, ie server1/railsapp1, server1/phpapp1, etc.
  11.   location ~ /phpmyadmin/.*\.php {
                    fastcgi_pass    127.0.0.1:9000;
                fastcgi_index   index.php;
                    fastcgi_param   SCRIPT_FILENAME /opt/nginx/html$fastcgi_script_name;
                include         fastcgi_params;
              }
              location /phpmyadmin {
                root   /opt/nginx/html;
                index  index.php;
              }
  12. passenger_enabled on;
            rails_env development;

            location /test {
                       alias /home/victorjd/railsapps/testapp/public/;   # <--- be sure to point to 'public'!
                      index  index.html index.htm;
                passenger_base_uri /;
                passenger_enabled on;
            }
  13. More information of setting up rails sites can be found here here

Some extra stuff need to get rails apps running:

  1. sudo apt-get install libxslt-dev libxml2-dev