| 1 |
=== INSTALL UNDER CENT OS 5.2 === |
| 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 |
- Steps marked with [*] are unknown yet if really necessary |
| 14 |
|
| 15 |
== OS COMPONENTS == |
| 16 |
|
| 17 |
1.1 Add Yum Repository |
| 18 |
|
| 19 |
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm |
| 20 |
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm |
| 21 |
|
| 22 |
1.2 Install Required Packages |
| 23 |
|
| 24 |
yum -y upgrade |
| 25 |
yum -y install git apg geoip httpd mysql mysql-server mysql-devel sqlite sqlite-devel httpd-devel libjpeg libjpeg-devel readline-devel curl-devel pcre pcre-devel zlib zlib-devel openssl openssl-devel libyaml libyaml-devel gcc gcc-c++ autoconf automake |
| 26 |
|
| 27 |
1.3 Configure MySQL |
| 28 |
|
| 29 |
service mysqld start |
| 30 |
/usr/bin/mysqladmin -u root password '[MYSQL_PASSWD]' |
| 31 |
|
| 32 |
2.1 Append to /etc/profile |
| 33 |
|
| 34 |
export PATH=/opt/ruby-enterprise/bin:$PATH |
| 35 |
export LD_LIBRARY_PATH="/usr/local/lib" |
| 36 |
export LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" |
| 37 |
|
| 38 |
2.2 Prepend to /etc/ld.so.conf [*] |
| 39 |
|
| 40 |
/usr/local/lib |
| 41 |
include ld.so.conf.d/*.conf |
| 42 |
|
| 43 |
2.3 Update changed configuration |
| 44 |
|
| 45 |
source /etc/profile |
| 46 |
ldconfig |
| 47 |
|
| 48 |
3.1 Install some components from source |
| 49 |
|
| 50 |
wget http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz |
| 51 |
tar xvfz onig-5.9.1.tar.gz |
| 52 |
cd onig-5.9.1 |
| 53 |
./configure && make && make install |
| 54 |
cd .. |
| 55 |
|
| 56 |
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz |
| 57 |
tar xvfz sphinx-0.9.8.tar.gz |
| 58 |
cd sphinx-0.9.8 |
| 59 |
./configure && make && make install |
| 60 |
cd .. |
| 61 |
|
| 62 |
wget ftp://ftp.imagemagick.net/pub/ImageMagick/ImageMagick-6.4.6-9.tar.gz |
| 63 |
tar xvfz ImageMagick-6.4.6-9.tar.gz |
| 64 |
cd ImageMagick-6.4.6-9 |
| 65 |
./configure && make && make install |
| 66 |
cd .. |
| 67 |
|
| 68 |
wget http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz |
| 69 |
tar xvfz ruby-enterprise-1.8.6-20081215.tar.gz |
| 70 |
cd ruby-enterprise-1.8.6-20081215 |
| 71 |
./installer |
| 72 |
|
| 73 |
4.1 Set up Ruby Enterprise Edition and Passenger |
| 74 |
|
| 75 |
ln -s /opt/ruby-enterprise-1.8.6-20081215 /opt/ruby-enterprise |
| 76 |
mv /usr/bin/ruby /usr/bin/ruby.old |
| 77 |
ln -s /opt/ruby-enterprise/bin/ruby /usr/bin/ruby |
| 78 |
|
| 79 |
gem install passenger --no-rdoc --no-ri |
| 80 |
passenger-install-apache2-module |
| 81 |
|
| 82 |
4.2 Append to /etc/httpd/conf/httpd.conf |
| 83 |
|
| 84 |
LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so |
| 85 |
PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6 |
| 86 |
PassengerRuby /opt/ruby-enterprise/bin/ruby |
| 87 |
|
| 88 |
<VirtualHost *:80> |
| 89 |
ServerName your_server.com.br |
| 90 |
DocumentRoot /var/www/gitorious/public |
| 91 |
</VirtualHost> |
| 92 |
|
| 93 |
4.3 Install require Ruby Gems |
| 94 |
|
| 95 |
gem install bundler |
| 96 |
cd gitorious && bundle install |
| 97 |
|
| 98 |
5.1 Download Gitorious |
| 99 |
|
| 100 |
cd /var/www |
| 101 |
git clone git://gitorious.org/gitorious/mainline.git gitorious |
| 102 |
ln -s /var/www/gitorious/script/gitorious /usr/local/bin/gitorious |
| 103 |
rm gitorious/public/.htaccess |
| 104 |
mkdir gitorious/log |
| 105 |
mkdir gitorious/tmp |
| 106 |
|
| 107 |
6.1 Create /etc/init.d/git-ultrasphinx |
| 108 |
|
| 109 |
- copy from doc/templates/centos/git-ultrasphinx |
| 110 |
|
| 111 |
6.2 Create /etc/init.d/git-daemon |
| 112 |
|
| 113 |
- copy from doc/templates/centos/git-daemon |
| 114 |
|
| 115 |
6.3 Set up the services |
| 116 |
|
| 117 |
chmod 755 /etc/init.d/git-ultrasphinx |
| 118 |
chmod 755 /etc/init.d/git-daemon |
| 119 |
chkconfig --add git-ultrasphinx |
| 120 |
chkconfig --add git-daemon |
| 121 |
chkconfig git-ultrasphinx on |
| 122 |
chkconfig git-daemon on |
| 123 |
chkconfig sendmail on |
| 124 |
chkconfig mysqld on |
| 125 |
chkconfig httpd on |
| 126 |
service sendmail start |
| 127 |
service mysqld start |
| 128 |
|
| 129 |
7.1 Create the 'git' user (can be another name instead of 'git') |
| 130 |
|
| 131 |
adduser git |
| 132 |
chown -R git:git /var/www/gitorious |
| 133 |
|
| 134 |
su - git <================= ATTENTION: LOGGED AS GIT FROM NOW ON (!) |
| 135 |
mkdir ~/.ssh |
| 136 |
chmod 700 ~/.ssh |
| 137 |
touch ~/.ssh/authorized_keys |
| 138 |
cd /var/www/gitorious |
| 139 |
cp config/database.sample.yml config/database.yml |
| 140 |
cp config/gitorious.sample.yml config/gitorious.yml |
| 141 |
|
| 142 |
7.2 Edit config/database.yml |
| 143 |
|
| 144 |
- Probably need to chanage password to [MYSQL_PASSWD] as set up above |
| 145 |
|
| 146 |
7.3 Edit config/gitorious.yml |
| 147 |
|
| 148 |
# The session secret key (`apg -m 64` is always useful for this kinda stuff) |
| 149 |
cookie_secret: frie...kceft |
| 150 |
|
| 151 |
# The path where git repositories are stored. The actual (bare) repositories resides |
| 152 |
# in repository_base_path/#{project.slug}/#{repository.name}.git/: |
| 153 |
repository_base_path: "/home/git" |
| 154 |
|
| 155 |
# Stuff that's in the html <head>. custom stats javascript code etc |
| 156 |
extra_html_head_data: |
| 157 |
|
| 158 |
# System message that will appear on all pages if present |
| 159 |
system_message: |
| 160 |
|
| 161 |
# Port the ./script/gitorious script should use: |
| 162 |
gitorious_client_port: 80 |
| 163 |
|
| 164 |
# Host the ./script/gitorious script should use: |
| 165 |
gitorious_client_host: localhost |
| 166 |
|
| 167 |
# Host which is serving the gitorious app, eg "gitorious.org" |
| 168 |
gitorious_host: servidor.local |
| 169 |
|
| 170 |
# User which is running git daemon |
| 171 |
gitorious_user: git |
| 172 |
|
| 173 |
# Email spam on server errors to: |
| 174 |
exception_notification_emails: |
| 175 |
|
| 176 |
# Mangle visible e-mail addresses (spam protection) |
| 177 |
mangle_email_addresses: true |
| 178 |
|
| 179 |
# Enable or Disable Public Mode (true) or Private Mode (false) |
| 180 |
public_mode: false |
| 181 |
|
| 182 |
# Define your locale |
| 183 |
locale: en |
| 184 |
|
| 185 |
7.3.1 Remarks on gitorious.yml |
| 186 |
|
| 187 |
- run apg -m 64 |
| 188 |
- copy the result (big string, take off the line breaks to have just one |
| 189 |
continuous line) |
| 190 |
- configure 'gitorious_host' to your registered domain, if you have one |
| 191 |
- configure 'gitorious_user' if you created the 'git' user above |
| 192 |
|
| 193 |
7.4 Final Website Setup |
| 194 |
|
| 195 |
cd /var/www/gitorious |
| 196 |
rake db:create RAILS_ENV=production |
| 197 |
rake db:setup RAILS_ENV=production |
| 198 |
rake ultrasphinx:bootstrap RAILS_ENV=production |
| 199 |
|
| 200 |
7.5 Setup CronJobs |
| 201 |
|
| 202 |
- type in 'crontab -e' |
| 203 |
- it will open an editor (probably nano) |
| 204 |
- copy and paste the following 2 lines: |
| 205 |
|
| 206 |
*/2 * * * * /opt/ruby-enterprise/bin/ruby /var/www/gitorious/script/task_performer |
| 207 |
* */1 * * * cd /var/www/gitorious && /opt/ruby-enterprise/bin/rake ultrasphinx:index RAILS_ENV=production |
| 208 |
|
| 209 |
8.1 Append to /home/git/.bash_profile [*] |
| 210 |
|
| 211 |
# User specific aliases and functions |
| 212 |
export RUBY_HOME=/opt/ruby-enterprise |
| 213 |
export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8/gems |
| 214 |
export PATH=$RUBY_HOME/bin:$PATH |
| 215 |
|
| 216 |
9.1 Start services |
| 217 |
|
| 218 |
- if you're still as ser 'git', type 'exit' to go back to Root |
| 219 |
|
| 220 |
exit |
| 221 |
service httpd start |
| 222 |
service git-daemon start |
| 223 |
|
| 224 |
9.2 Create /etc/logrotate.d/gitorious, add this content: |
| 225 |
|
| 226 |
- copy content from doc/templates/centos/gitorious-logrotate |
| 227 |
|
| 228 |
9.3 Set permission for /etc/logrotate.d/gitorious |
| 229 |
|
| 230 |
chmod 644 /etc/logrotate.d/gitorious |
| 231 |
|
| 232 |
|
| 233 |
10 DONE |
| 234 |
|
| 235 |
Open your browser, go to your main website, it should take a minute to cold start |
| 236 |
Phusion Passenger. Then you should already be able to start operating on the system. |