You are viewing a read-only archive of the Blogs.Harvard network. Learn more.
Skip to content

Rails install script for Ubuntu (feisty fawn)

echo “Credit to Urban Puddle for the guide”
echo “this is the article in script form”
echo “you can cut and paste this entire article into a shell script and run it.”

sudo apt-get update
sudo apt-get dist-upgrade

sudo apt-get install build-essential

sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.0 mysql-common mysql-server-5.0 rdoc1.8 ri1.8 ruby1.8

sudo wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
tar -xzvf rubygems-0.9.4.tgz
cd rubygems-0.9.4
sudo ruby setup.rb

sudo gem install rails --include-dependencies

sudo apt-get install libpcre3 nginx libfcgi-dev libfcgi-ruby1.8 libfcgi0c2

sudo apt-get install libxml2 ucf php5-common php5-cgi php5-mysql phpmyadmin

sudo gem install mongrel
sudo gem install mongrel_cluster

echo "sudo cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/resources/mongrel_cluster "
echo "/etc/init.d/mongrel_cluster"

echo "Next, add a path statement to mongrel_cluster file just above the CONF_DIR variable:"
echo "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin"
echo "Thanks to Russ Brooks for the above tip"

echo "Finally, let's modify permissions and make sure we boot mongrel on startup:"

echo "sudo chmod +x /etc/init.d/mongrel_cluster"
echo "sudo update-rc.d mongrel_cluster defaults"

echo "9. Congratulations, you've got everything installed! It's time to deploy. If you have an "
echo "existing rails application on another server, let's move it over to our root at /var/www/"
echo "sudo mv myrailsapp /var/www/"

echo "10. Modify your permissions of your app and phpmyadmin:"
echo "sudo chown -R www-data:www-data myrailsapp"
echo "sudo chown -R www-data:www-data phpmyadmin"

echo "11. Setup the Mongrel Cluster (source). This will get us a group of 3 mongrel clusters "
echo "running on port 8000. From within your myrailsapp/config folder, "
echo "type: sudo mongrel_rails"
echo "cluster::configure -e production \ -p 8000 -N 3 -c /var/www/apps/myrailsapp -a 127.0.0.1 \ "
echo "--user mongrel --group mongrel"

echo "echo "Now let's create a symlink to that file from within /etc where all our configs live:"
echo "sudo mkdir /etc/mongrel_cluster"
echo "cd /etc/mongrel_cluster/"
echo "sudo ln -s /var/www/myrailsapp/config/mongrel_cluster.yml"

echo "You can download a sample mongrel_cluster file HERE. In any case, it's a good idea to "
echo "download it and cross reference it to what the above command produced."

echo "12. Next we're going to put a script into /var/www/phpmyadmin folder "
echo "to spawn fastcgi on "
echo "port 8888. Make sure you give it execute permissions using"
echo " sudo chmod +x fastcgi_script"

echo "Download the script here. Inspiration for this script came from Alexey N. Kovyrin. It has "
echo "been modified only for Ubuntu's PHP path. Don't forget to put it into "
echo "/var/www/phpmyadmin"

echo "13. We're *almost* done. Next step is to configure Nginx. Here's a sample nginx.conf file"
echo "for your /etc/nginx/ folder. It's set up to handle one rails app and phpmyadmin. Adding "
echo "additional servers just means more server blocks."

echo "14. Now that we've got everything set up, let's turn this sucker on!"
echo "Step 1: PHP: . /var/www/phpmyadmin/fastcgi_script"
echo "Step 2: Mongrel: /etc/init.d/mongrel_cluster start"
echo "Step 3: Nginx: /etc/init.d/nginx/ start"

echo "References:"

echo " * There's lots of great documentation for Mongrel here."
echo " * There's an entire wiki devoted to Nginx in English"
echo " * Ezra Zygmuntowicz is the man!"
echo " * Russ Brooks has a great HowTo as well"

Post a Comment

You must be logged in to post a comment.