ashchan (owner)

Fork Of

gist: 41904 by JohnMunsch Modified Rails setup for Ub...

Revisions

  • 1f6572 JohnMunsch Sat Jan 10 12:14:08 -0800 2009
  • 0cf170 joerichsen Fri Nov 28 05:08:09 -0800 2008
  • 7ad25f joerichsen Fri Nov 28 02:58:45 -0800 2008
  • fa2485 joerichsen Sat Oct 11 13:28:45 -0700 2008
  • 230348 joerichsen Sat Oct 11 13:13:43 -0700 2008
  • 4da503 joerichsen Sat Oct 11 13:08:00 -0700 2008
  • 0aedef joerichsen Sat Oct 11 11:41:29 -0700 2008
  • 934ce5 joerichsen Sat Oct 11 01:41:27 -0700 2008
  • b2609c joerichsen Sat Oct 11 01:07:47 -0700 2008
gist: 64586 Download_button fork
public
Public Clone URL: git://gist.github.com/64586.git
Embed All Files: show embed
Ubuntu Rails stack #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost
#
# This is a fork of: http://gist.github.com/16225
#
# To it I've added:
# - Installation of the MySQL gem which is no longer included with Rails
# - A switch from Passenger 2.0.3 (specified in the original script) to 2.0.6
# - Explanatory text at the end of the script to help the user understand
# what to do next.
 
apt-get update
apt-get upgrade -y
apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev
apt-get -y install mysql-server libmysqlclient15-dev mysql-client
apt-get -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8
 
RUBYGEMS="rubygems-1.3.1"
wget http://rubyforge.org/frs/download.php/45905/$RUBYGEMS.tgz
tar xzf $RUBYGEMS.tgz
cd $RUBYGEMS
ruby setup.rb
cd ..
 
# Install Ruby Enterprise Edition
wget http://rubyforge.org/frs/download.php/41040/ruby-enterprise-1.8.6-20080810.
tar.gz
tar xvzf ruby-enterprise-1.8.6-20080810.tar.gz
yes '' | ./ruby-enterprise-1.8.6-20080810/installer
 
# Install Passenger
/usr/bin/gem1.8 install -v=2.0.6 passenger --no-rdoc --no-ri
apt-get -y install apache2-mpm-prefork apache2-prefork-dev
yes '' | passenger-install-apache2-module
 
# Install MySQL gem (no longer bundled w/ Rails)
/usr/bin/gem1.8 install mysql
 
# Create sample Rails app
/usr/bin/gem1.8 install rails --no-rdoc --no-ri
cd /var/www
rails -d mysql hello
cd hello
./script/generate controller welcome hello
echo "Hello World" > app/views/welcome/hello.html.erb
rake db:create RAILS_ENV=production
 
# Create the Apache2 Passenger module files
cat >> /etc/apache2/mods-available/passenger.load <<-EOF
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apac
he2/mod_passenger.so
EOF
 
cat >> /etc/apache2/mods-available/passenger.conf <<-EOF
<IfModule passenger_module>
  PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6
  PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby
</IfModule>
EOF
a2enmod passenger
 
# Create a site file for the sample Rails app
IP_ADDRESS=`ifconfig eth0 | sed -n 's/.*dr:\(.*\) Bc.*/\1/p'`
cat >> /etc/apache2/sites-available/hello <<-EOF
<VirtualHost $IP_ADDRESS:80>
      ServerName www.yourhost.com
      DocumentRoot /var/www/hello/public
</VirtualHost>
EOF
a2ensite hello
 
# Instruct the user where to go from here.
echo "Setup appears to be complete, but it isn't quite finished yet."
echo ""
echo "The example site was created in /var/www/hello. Edit the database.yml"
echo "file in the /var/www/hello/config directory to have the password you"
echo "assigned to the root account for MySQL. Then run the command"
echo "rake db:create:all to create the databases needed for the example site."
echo "After that you can point your browser at $IPADDRESS/welcome/hello to"
echo "see a sample page."
 
read -p "Hit <return> or <enter> to reboot"
 
# That's it!
reboot