{"id":268,"date":"2007-07-17T00:14:19","date_gmt":"2007-07-17T04:14:19","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/zeroday\/2007\/07\/17\/rails-install-script-for-ubuntu-feist"},"modified":"2007-07-17T00:14:19","modified_gmt":"2007-07-17T04:14:19","slug":"rails-install-script-for-ubuntu-feisty-fawn","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/zeroday\/2007\/07\/17\/rails-install-script-for-ubuntu-feisty-fawn\/","title":{"rendered":"Rails install script for Ubuntu (feisty fawn)"},"content":{"rendered":"<p><a href=\"http:\/\/www.urbanpuddle.com\/articles\/2007\/05\/09\/install-ruby-on-rails-on-ubuntu-feisty-fawn\">echo &#8220;Credit to Urban Puddle for the guide&#8221;<br \/>\necho &#8220;this is the article in script form&#8221;<br \/>\necho &#8220;you can cut and paste this entire article into a shell script and run it.&#8221;<\/a><\/p>\n<p><code>sudo apt-get update<br \/>\nsudo apt-get dist-upgrade<\/p>\n<p>sudo apt-get install build-essential<\/p>\n<p>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<\/p>\n<p>sudo wget http:\/\/rubyforge.org\/frs\/download.php\/20989\/rubygems-0.9.4.tgz<br \/>\ntar -xzvf rubygems-0.9.4.tgz<br \/>\ncd rubygems-0.9.4<br \/>\nsudo ruby setup.rb<\/p>\n<p>sudo gem install rails --include-dependencies<\/p>\n<p>sudo apt-get install libpcre3 nginx libfcgi-dev libfcgi-ruby1.8 libfcgi0c2<\/p>\n<p>sudo apt-get install libxml2 ucf php5-common php5-cgi php5-mysql phpmyadmin<\/p>\n<p>sudo gem install mongrel<br \/>\nsudo gem install mongrel_cluster<\/p>\n<p>echo \"sudo cp \/usr\/lib\/ruby\/gems\/1.8\/gems\/mongrel_cluster-0.2.1\/resources\/mongrel_cluster \"<br \/>\necho \"\/etc\/init.d\/mongrel_cluster\"<\/p>\n<p>echo \"Next, add a path statement to mongrel_cluster file just above the CONF_DIR variable:\"<br \/>\necho \"PATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/local:\/usr\/local\/sbin:\/usr\/local\/bin\"<br \/>\necho \"Thanks to Russ Brooks for the above tip\"<\/p>\n<p>echo \"Finally, let's modify permissions and make sure we boot mongrel on startup:\"<\/p>\n<p>echo \"sudo chmod +x \/etc\/init.d\/mongrel_cluster\"<br \/>\necho \"sudo update-rc.d mongrel_cluster defaults\"<\/p>\n<p>echo \"9. Congratulations, you've got everything installed! It's time to deploy. If you have an \"<br \/>\necho \"existing rails application on another server, let's move it over to our root at \/var\/www\/\"<br \/>\necho \"sudo mv myrailsapp \/var\/www\/\"<\/p>\n<p>echo \"10. Modify your permissions of your app and phpmyadmin:\"<br \/>\necho \"sudo chown -R www-data:www-data myrailsapp\"<br \/>\necho \"sudo chown -R www-data:www-data phpmyadmin\"<\/p>\n<p>echo \"11. Setup the Mongrel Cluster (source). This will get us a group of 3 mongrel clusters \"<br \/>\necho \"running on port 8000. From within your myrailsapp\/config folder, \"<br \/>\necho \"type: sudo mongrel_rails\"<br \/>\necho \"cluster::configure -e production \\ -p 8000 -N 3 -c \/var\/www\/apps\/myrailsapp -a 127.0.0.1 \\ \"<br \/>\necho \"--user mongrel --group mongrel\"<\/p>\n<p>echo \"echo \"Now let's create a symlink to that file from within \/etc where all our configs live:\"<br \/>\necho \"sudo mkdir \/etc\/mongrel_cluster\"<br \/>\necho \"cd \/etc\/mongrel_cluster\/\"<br \/>\necho \"sudo ln -s \/var\/www\/myrailsapp\/config\/mongrel_cluster.yml\"<\/p>\n<p>echo \"You can download a sample mongrel_cluster file HERE. In any case, it's a good idea to \"<br \/>\necho \"download it and cross reference it to what the above command produced.\"<\/p>\n<p>echo \"12. Next we're going to put a script into \/var\/www\/phpmyadmin folder \"<br \/>\necho \"to spawn fastcgi on \"<br \/>\necho \"port 8888. Make sure you give it execute permissions using\"<br \/>\necho \" sudo chmod +x fastcgi_script\"<\/p>\n<p>echo \"Download the script here. Inspiration for this script came from Alexey N. Kovyrin. It has \"<br \/>\necho \"been modified only for Ubuntu's PHP path. Don't forget to put it into \"<br \/>\necho \"\/var\/www\/phpmyadmin\"<\/p>\n<p>echo \"13. We're *almost* done. Next step is to configure Nginx. Here's a sample nginx.conf file\"<br \/>\necho \"for your \/etc\/nginx\/ folder. It's set up to handle one rails app and phpmyadmin. Adding \"<br \/>\necho \"additional servers just means more server blocks.\"<\/p>\n<p>echo \"14. Now that we've got everything set up, let's turn this sucker on!\"<br \/>\necho \"Step 1: PHP: . \/var\/www\/phpmyadmin\/fastcgi_script\"<br \/>\necho \"Step 2: Mongrel: \/etc\/init.d\/mongrel_cluster start\"<br \/>\necho \"Step 3: Nginx: \/etc\/init.d\/nginx\/ start\"<\/p>\n<p>echo \"References:\"<\/p>\n<p>echo \" * There's lots of great documentation for Mongrel here.\"<br \/>\necho \" * There's an entire wiki devoted to Nginx in English\"<br \/>\necho \" * Ezra Zygmuntowicz is the man!\"<br \/>\necho \" * Russ Brooks has a great HowTo as well\"<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>echo &#8220;Credit to Urban Puddle for the guide&#8221; echo &#8220;this is the article in script form&#8221; echo &#8220;you can cut and paste this entire article into a shell script and run it.&#8221; 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 [&hellip;]<\/p>\n","protected":false},"author":214,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[274],"tags":[],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-interesting-tech"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/users\/214"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/comments?post=268"}],"version-history":[{"count":0,"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/posts\/268\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/media?parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/categories?post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/zeroday\/wp-json\/wp\/v2\/tags?post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}