1
=== INSTALL UNDER UBUNTU 8.10 ===
2
3
== TODO ==
4
5
- Gruff configuration still problematic
6
- Make more tests (those were done in a bare-bone VPS machine)
7
- Improve the service scripts
8
9
== WARNINGS ==
10
11
- Assumes running everything as ROOT, unless specified
12
- Some commands react like 'Wizard' screens, just follow the default choices
13
14
== OS COMPONENTS ==
15
16
1.1 Install Required Packages
17
18
apt-get update
19
apt-get install -y build-essential apache2 mysql-server mysql-client git git-svn apg geoip-bin libgeoip1 libgeoip-dev sqlite3 libsqlite3-dev imagemagick libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev libmysqlclient15-dev apache2-dev sendmail
20
21
1.2 Install some components from source
22
23
wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz
24
tar xvfz onig-5.9.1.tar.gz 
25
cd onig-5.9.1
26
./configure && make && make install
27
cd ..
28
29
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz
30
tar xvfz sphinx-0.9.8.tar.gz
31
cd sphinx-0.9.8
32
./configure && make && make install
33
cd ..
34
35
wget ftp://ftp.imagemagick.net/pub/ImageMagick/ImageMagick-6.4.6-9.tar.gz
36
tar xvfz ImageMagick-6.4.6-9.tar.gz 
37
cd ImageMagick-6.4.6-9
38
./configure && make && make install
39
cd ..
40
41
1.2.3 Set up ActiveMQ
42
43
apt-get install uuid uuid-dev openjdk-6-jre
44
wget http://www.powertech.no/apache/dist/activemq/apache-activemq/5.2.0/apache-activemq-5.2.0-bin.tar.gz
45
tar xzvf apache-activemq-5.2.0-bin.tar.gz  -C /usr/local/
46
echo "export ACTIVEMQ_HOME=/usr/local/apache-activemq-5.2.0" >> /etc/activemq.conf
47
echo "export JAVA_HOME=/usr/" >> /etc/activemq.conf
48
adduser --system --no-create-home  activemq
49
chown -R activemq /usr/local/apache-activemq-5.2.0/data
50
51
# turn off the default multicasting activemq does, or other brokers on the
52
# same network will receive your queue items
53
vim /usr/local/apache-activemq-5.2.0/conf/activemq.xml
54
# edit the networkConnectors conf to something like this:
55
<networkConnectors>
56
    <!-- by default just auto discover the other brokers -->
57
    <!-- <networkConnector name="default-nc" uri="multicast://default"/> -->
58
    <!-- Example of a static configuration: -->
59
    <networkConnector name="localhost" uri="static://(tcp://127.0.0.1:61616)"/>
60
</networkConnectors>
61
wget http://launchpadlibrarian.net/15645459/activemq
62
mv activemq /etc/init.d/activemq
63
chmod +x /etc/init.d/activemq
64
65
2.1 Install Ruby Enterprise Edition
66
67
wget http://rubyforge.org/frs/download.php/48625/ruby-enterprise_1.8.6-20081215-i386.deb
68
dpkg -i ruby-enterprise_1.8.6-20081215-i386.deb
69
70
2.2 Append to /etc/profile
71
72
export PATH=/opt/ruby-enterprise/bin:$PATH
73
export LD_LIBRARY_PATH="/usr/local/lib"
74
export LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"
75
76
2.3 Prepend to /etc/ld.so.conf
77
78
/usr/local/lib
79
include ld.so.conf.d/*.conf
80
81
2.4 Update changed configuration
82
83
source /etc/profile
84
ldconfig
85
86
2.5 Set up Ruby Enterprise Edition and Passenger
87
88
mv /usr/bin/ruby /usr/bin/ruby.old
89
ln -s /opt/ruby-enterprise/bin/ruby /usr/bin/ruby
90
91
gem install passenger --no-rdoc --no-ri
92
passenger-install-apache2-module
93
94
3.1 Create /etc/apache2/mods-available/passenger.load with:
95
96
  LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
97
  PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6
98
  PassengerRuby /opt/ruby-enterprise/bin/ruby
99
  
100
3.2 Symlink Passenger into Apache
101
102
  ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load 
103
104
3.3 Create /etc/apache2/sites-available/gitorious with:
105
106
  <VirtualHost *:80>
107
    ServerName your_server.com.br
108
    DocumentRoot /var/www/gitorious/public
109
  </VirtualHost>
110
  
111
3.4 Symlink the Site
112
113
  ln -s /etc/apache2/sites-available/gitorious /etc/apache2/sites-enabled/000-gitorious
114
  rm /etc/apache2/sites-enabled/000-default
115
116
4.1 Install require Ruby Gems
117
118
  gem install bundler
119
  cd gitorious && bundle install
120
121
5.1 Download Gitorious
122
123
cd /var/www
124
git clone git://gitorious.org/gitorious/mainline.git gitorious
125
ln -s /var/www/gitorious/script/gitorious /usr/local/bin/gitorious
126
rm gitorious/public/.htaccess
127
mkdir gitorious/log
128
mkdir gitorious/tmp
129
130
6.1 Create /etc/init.d/git-ultrasphinx 
131
132
- copy from doc/templates/ubuntu/git-ultrasphinx
133
134
6.2 Create /etc/init.d/git-daemon
135
136
- copy from doc/templates/ubuntu/git-daemon
137
138
6.3 Set up the services
139
140
chmod +x /etc/init.d/git-ultrasphinx
141
chmod +x /etc/init.d/git-daemon
142
update-rc.d -f git-daemon start 99 2 3 4 5 .
143
update-rc.d -f git-ultrasphinx start 99 2 3 4 5 .
144
145
7.1 Create the 'git' user (can be another name instead of 'git')
146
147
adduser git
148
chown -R git:git /var/www/gitorious
149
150
su - git            <================= ATTENTION: LOGGED AS GIT FROM NOW ON (!)
151
mkdir ~/.ssh
152
chmod 700 ~/.ssh
153
touch ~/.ssh/authorized_keys
154
cd /var/www/gitorious
155
cp config/database.sample.yml config/database.yml
156
cp config/gitorious.sample.yml config/gitorious.yml
157
158
7.2 Edit config/database.yml
159
160
- Probably need to chanage password to the one that was asked to you during
161
  the apt packages installation in step 1.1
162
163
7.3 Edit config/gitorious.yml
164
165
  # The session secret key (`apg -m 64` is always useful for this kinda stuff)
166
  cookie_secret: frie...kceft
167
   
168
  # The path where git repositories are stored. The actual (bare) repositories resides
169
  # in repository_base_path/#{project.slug}/#{repository.name}.git/:
170
  repository_base_path: "/home/git"
171
   
172
  # Stuff that's in the html <head>. custom stats javascript code etc
173
  extra_html_head_data:
174
    
175
  # System message that will appear on all pages if present
176
  system_message:
177
    
178
  # Port the ./script/gitorious script should use:
179
  gitorious_client_port: 80
180
   
181
  # Host the ./script/gitorious script should use:
182
  gitorious_client_host: localhost
183
   
184
  # Host which is serving the gitorious app, eg "gitorious.org"
185
  gitorious_host: servidor.local
186
   
187
  # User which is running git daemon
188
  gitorious_user: git
189
  
190
  # Email spam on server errors to:
191
  exception_notification_emails:  
192
  
193
  # Mangle visible e-mail addresses (spam protection)
194
  mangle_email_addresses: true
195
196
  # Enable or Disable Public Mode (true) or Private Mode (false)
197
  public_mode: false
198
199
  # Define your locale
200
  locale: en
201
  
202
7.3.1 Remarks on gitorious.yml
203
204
- run apg -m 64
205
- replace the result (big string, take off the line breaks to have just one 
206
  continuous line) with value of the the current 'cookie_secret'
207
- configure 'gitorious_host' to your registered domain, if you have one
208
- configure 'gitorious_user' if you created the 'git' user above
209
210
7.4 Final Website Setup
211
212
cd /var/www/gitorious
213
rake db:create RAILS_ENV=production
214
rake db:setup RAILS_ENV=production
215
rake ultrasphinx:bootstrap RAILS_ENV=production
216
217
7.5 Setup CronJobs
218
219
- type in 'crontab -e'
220
- it will open an editor (probably nano)
221
- copy and paste the following 2 lines:
222
223
*/2 * * * * /opt/ruby-enterprise/bin/ruby /var/www/gitorious/script/task_performer
224
* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index RAILS_ENV=production
225
226
8.1 [UNKNOWN] Append to /home/git/.bash_profile
227
228
# User specific aliases and functions
229
export RUBY_HOME=/opt/ruby-enterprise
230
export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8/gems
231
export PATH=$RUBY_HOME/bin:$PATH
232
233
9.1 Start Services
234
235
- if you're still as user 'git', type 'exit' to go back to Root
236
237
/etc/init.d/git-daemon start
238
/etc/init.d/git-ultrasphinx start
239
240
9.2 Create /etc/logrotate.d/gitorious, add this content:
241
242
- copy content from doc/templates/ubuntu/gitorious-logrotate
243
244
9.3 Set permission for /etc/logrotate.d/gitorious
245
246
chmod 644 /etc/logrotate.d/gitorious
247
248
249
10 DONE
250
251
Open your browser, go to your main website, it should take a minute to cold start
252
Phusion Passenger. Then you should already be able to start operating on the system.