forked from MushroomObserver/mushroom-observer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME_DEVELOPMENT_INSTALL
253 lines (229 loc) · 8.08 KB
/
README_DEVELOPMENT_INSTALL
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#
# This is a log of the installation of a development server 20 May 2012.
# I used a fresh "nano" virtual machine at 6sync.com with 256MB ram.
#
# Started: 14:30
# Ended: 14:58
#
# ubuntu 11.10 (64bit)
# ruby 1.9.3-p194
# rubygems 1.8.24
# rails 2.1.1
# apache2 2.2.20
# mysql 5.1.62
# passenger 3.0.12
#
################################################################################
# Initial set up.
local> ssh [email protected]
# (asks for intial root password)
root> passwd
# (asks for new root password twice)
root> apt-get update
root> apt-get upgrade
root> apt-get install tcsh mlocate man vim lynx telnet emacs wget \
build-essential bison libyaml-dev libxslt-dev
# Create account for yourself. ("-G sudo" gives you ability to run any command via "sudo" command)
root> useradd -m -G sudo -s /bin/tcsh jason
root> passwd jason
# (asks for your password)
root> logout
# Password-less ssh.
local> ssh-keygen -t rsa # (if not already done)
local> ssh-copy-id -i ~/.ssh/id_rsa.pub 80.77.87.179
# (asks for your password again)
# Set up your user account however you like.
local> ssh 80.77.87.179
jason> vi .tcshrc
alias root sudo
alias cls clear
alias cd.. cd ..
alias dirf ls -alF
alias dirt ls -alFrt
alias md mkdir
alias rd rmdir
alias del rm
alias mv mv -i
alias cp cp -i
alias grep grep -s
alias +x chmod a+x
alias -x chmod a-x
jason> vi .vimrc
syntax off
set nohlsearch
set ts=2
set sw=2
set et
set nowrap
jason> vi .login
setenv TZ 'Eastern Time (US & Canada)'
setenv RAILS_ENV development
setenv RAKE_TEST_LOADER /usr/local/lib/ruby/1.9.3/rake/rake_test_loader.rb
jason> source .login
jason> source .tcshrc
# Install most of the modules that we will need (except ruby).
jason> sudo apt-get install apache2 libapache2-mod-passenger \
mysql-server mysql-client libmysqlclient-dev \
subversion subversion-tools \
libcurl4-openssl-dev libssl-dev libopenssl-ruby \
apache2-prefork-dev libapr1-dev libaprutil1-dev
# (asks for root password for mysql)
# Build and install ruby from source to get good version.
jason> mkdir build
jason> cd build
jason> wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.bz2
jason> tar -xjf ruby*.bz2
jason> cd ruby-1.9.3-p194
jason> ./configure --with-ruby-version=1.9.3
jason> sudo make install
jason> rehash
jason> cd
# Ditto for rubygems.
jason> cd ~/build
jason> wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
jason> tar -xzf rubygems*.tgz
jason> cd rubygems-1.8.24
jason> sudo ruby setup.rb --prefix=/usr/local --verbose
jason> rehash
jason> cd
# Now we can install ruby gems properly.
jason> sudo gem install rails --version=2.1.1 --verbose --no-rdoc --no-ri
jason> sudo gem install mysql --verbose --no-rdoc --no-ri
jason> sudo gem install mysql2 --version=0.2.18 --verbose --no-rdoc --no-ri
jason> sudo gem install test-unit --verbose --no-rdoc --no-ri
jason> sudo gem install RedCloth --verbose --no-rdoc --no-ri
jason> sudo gem install sparql --verbose --no-rdoc --no-ri
# (mysql-2.8.1) <-- needed by rake test:db:prepare, see script/run_tests
# (mysql2-0.2.18) <-- important! 0.3.+ doesn't work with < rails 3.1.x!
# (test-unit-2.4.8)
# (RedCloth-4.2.9)
# sparql installs all of these:
# addressable-2.2.8
# rdf-0.3.5.2
# builder-3.0.0
# sxp-0.0.14
# json_pure-1.7.3
# net-http-persistent-2.7
# sparql-client-0.1.1.1
# nokogiri-1.5.4
# backports-2.6.1
# rdf-xsd-0.3.7
# sparql-0.3.0
# Install passenger.
jason> sudo gem install passenger --verbose --no-rdoc --no-ri
# (fastthread-1.0.7)
# (daemon_controller-1.0.0)
# (rack-1.4.1)
# (passenger-3.0.12)
jason> rehash
jason> sudo passenger-install-apache2-module
# Pay attention to output at end and make sure values below are right.
jason> sudo vi /etc/apache2/mods-available/passenger.conf
# Change root to /usr/local/lib/ruby/gems/1.9.3/gems/passenger-3.0.12
# Change ruby to /usr/local/bin/ruby
jason> sudo vi /etc/apache2/mods-available/passenger.load
# Change to /usr/local/lib/ruby/gems/1.9.3/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
jason> sudo service apache2 stop
jason> sudo service apache2 start
# (For some reason reload and restart don't always work here.)
# Install ImageMagick. (might only need imagemagick, not the other dev pkgs or rmagick)
jason> sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev libjpeg-dev libjpeg-progs
jason> sudo gem install rmagick --verbose --no-rdoc --no-ri
# (rmagick-2.13.1)
# Install MO rails app.
jason> mkdir mo
jason> cd mo
jason> git clone https://github.com/MushroomObserver/mushroom-observer.git
jason> mkdir log public/images/{thumb,320,640,960,1280,orig}
jason> touch tmp/restart.txt
jason> vi config/consts-site.rb
unless TESTING
DOMAIN = 'localhost.localdomain'
IMAGE_DOMAIN = 'http://images.digitalmycology.com'
end
# Install our programs for resizing and rotating JPEG images.
jason> sudo gcc script/jpegresize.c -ljpeg -lm -O2 -o /usr/local/bin/jpegresize
jason> sudo gcc script/jpegexiforient.c -o /usr/local/bin/jpegexiforient
jason> sudo cp script/exifautotran.sh /usr/local/bin/exifautotran
jason> sudo chmod 755 /usr/local/bin/exifautotran
# Configure apache.
jason> sudo vi /etc/apache2/sites-available/mo
<VirtualHost *:80>
ServerName 80.77.87.179
DocumentRoot /home/jason/mo/public
RailsEnv development
SetEnv TZ 'Eastern Time (US & Canada)'
# This was necessary for my local installation on Fedora Core 13.
# RailsBaseURI /
<Directory /home/jason/mo/public>
Options FollowSymLinks
AllowOverride limit
Order allow,deny
Allow from all
</Directory>
RewriteEngine on
# Redirect all image requests to the image server.
RewriteRule ^/images/thumb/(.*)$ http://images.digitalmycology.com/thumb/$1 [QSA]
RewriteRule ^/images/320/(.*)$ http://images.digitalmycology.com/320/$1 [QSA]
RewriteRule ^/images/640/(.*)$ http://images.digitalmycology.com/640/$1 [QSA]
RewriteRule ^/images/960/(.*)$ http://images.digitalmycology.com/960/$1 [QSA]
RewriteRule ^/images/1280/(.*)$ http://images.digitalmycology.com/1280/$1 [QSA]
RewriteRule ^/images/orig/(.*)$ http://images.digitalmycology.com/orig/$1 [QSA]
</VirtualHost>
jason> sudo a2dissite default
jason> sudo a2ensite mo
jason> sudo a2enmod rewrite
jason> sudo a2enmod headers
jason> sudo service apache2 reload
# Create database.
jason> mysql -u root -p
create database mo_development;
create database mo_test;
create user 'mo'@'localhost' identified by 'xxx';
# Command used to reset password if needed later:
# set password for 'mo'@'localhost' = password('xxx');
grant all privileges on mo_development.* to 'mo'@'localhost' with grant option;
grant all privileges on mo_test.* to 'mo'@'localhost' with grant option;
mo> cp config/database.yml-template config/database.yml
mo> vi config/database.yml
development:
adapter: mysql
database: mo_development
username: mo
password: xxx
# Default (works for MacOS X)
# socket: /tmp/mysql.sock
# For Ubuntu/Debian
socket: /var/run/mysqld/mysqld.sock
# For Fedora
# socket: /var/lib/mysql/mysql.sock
test:
adapter: mysql
database: mo_test
username: mo
password: xxx
# Default (works for MacOS X)
# socket: /tmp/mysql.sock
# For Ubuntu/Debian
socket: /var/run/mysqld/mysqld.sock
# For Fedora
# socket: /var/lib/mysql/mysql.sock
mo> cd db
mo> scp [email protected]:/var/web/mushroom-observer/db/checkpoint.gz .
mo> gunzip checkpoint.gz
mo> mysql -u mo -pxxx mo_development -e "source checkpoint"
mo> cd ..
# Test it using webrick:
mo> script/server
mo> lynx http://localhost:3000
# Test it using passenger:
# Point external browser at http://80.77.87.179
# Run unit tests:
mo> script/run_tests
# NOTE: language files have become problematic sometimes. Usually it manifests
# as obscure character encoding errors in app/model/language_exporter.pm. Some
# or all of the following steps might help clean up the problem.
mo> rm config/locales/*.{yml,txt}
mo> git checkout config/locales/en.txt
mo> rake lang # <--- this in particular helped Han on 20120913
mo> rake lang:update