pageflyp (owner)

Revisions

gist: 32922 Download_button fork
public
Public Clone URL: git://gist.github.com/32922.git
Embed All Files: show embed
Text only #
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
 
# sudo wget --output-document=rails.sh http://gist.github.com/raw/32922/8131622b2192d0a502332e274ab1a36c15525468
# sudo bash rails.sh
 
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
apt-get -y install git-core
apt-get -y install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl
 
ln -s /usr/bin/ruby1.8 /usr/bin/ruby
ln -s /usr/bin/ri1.8 /usr/bin/ri
ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc
ln -s /usr/bin/irb1.8 /usr/bin/irb
 
 
RUBYGEMS="rubygems-1.3.0"
wget http://rubyforge.org/frs/download.php/43985/$RUBYGEMS.tgz
tar -xzf $RUBYGEMS.tgz
cd $RUBYGEMS
ruby setup.rb
cd ..
ln -s /usr/bin/gem1.8 /usr/bin/gem
 
#apt-get -y install rubygems
#require 'rubygems/gem_runner'
gem update
gem update --system --no-rdoc --no-ri
 
# Install Postfix
# aptitude install postfix
 
# Install Ruby Enterprise Edition
wget http://rubyforge.org/frs/download.php/47937/ruby-enterprise-1.8.6-20081205.tar.gz
tar -xvzf ruby-enterprise-1.8.6-20081205.tar.gz
yes '' | ./ruby-enterprise-1.8.6-20081205/installer
 
# Install Passenger
gem install -v=2.0.5 passenger --no-rdoc --no-ri
apt-get -y install apache2 apache2.2-common apache2-mpm-prefork apache2-prefork-dev apache2-utils libexpat1
passenger-install-apache2-module
 
chown :sudo /var/www
chmod g+w /var/www
 
#cd /etc/apache2/
#nano sites-available/default
# Delete the NameVirtualHost* line and change the next line to
# <VirtualHost *:80>
# ServerAdmin webmaster@localhost
# DocumentRoot /var/www/
 
#cat >> /etc/apache2/apache2.conf <<-EOF
#NameVirtualHost *:80
 
#<IfModule mod_ssl.c>
# NameVirtualHost *:443
#</IfModule>
 
#LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/ext/apache2/mod_passenger.so
#PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/bin/passenger-spawn-server
#RailsRuby /usr/bin/ruby1.8
#EOF
 
#/etc/init.d/apache2 restart
 
# Update RubyGems
gem update --system --no-rdoc --no-ri
gem install rails --include-dependencies --no-rdoc --no-ri
gem install mysql --no-rdoc --no-ri
gem install sqlite3-ruby --no-rdoc --no-ri
gem install -y capistrano
apt-get -y install imagemagick
apt-get -y install libmagick9-dev
gem install rmagick
 
# Install Webmin
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.441_all.deb
dpkg -i webmin_1.441_all.deb
 
# Create sample Rails app
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
 
# 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 *:80>
# ServerName yourhost.com
# ServerAlisa www.yourhost.com
# DocumentRoot /var/www/hello/public
# RailsBaseURI /hello
# RailsEnv development
#</VirtualHost>
#EOF
 
cat >> passenger_config <<-EOF
   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5/ext/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.5
   PassengerRuby /usr/bin/ruby1.8
EOF
 
mv passenger_config /etc/apache2/conf.d/passenger
 
cat >> vhost_config <<-EOF
<VirtualHost localhost:80>
  ServerName myslice.com
  DocumentRoot /var/www/hello/public
  RailsBaseURI /
  RailsAllowModRewrite off
  RailsEnv development
  PassengerDefaultUser user
</VirtualHost>
EOF
 
mv vhost_config /etc/apache2/sites-available/hello
 
a2ensite hello
a2dissite default
#a2enmod rewrite
/etc/init.d/apache2 reload
 
# That's it!
# reboot