YouSource on RHEL 5 =================== This document describes how to install Ruby Enterprise edition and YouSource web application on RHEL 5. 1. Install packages =================== sudo yum install -y git git-svn pcre pcre-devel apg zlib zlib-devel sendmail ; sudo yum -y groupinstall "Development Libraries" "Development Tools" ; sudo yum install -y libssh2 openssh openssh-askpass openssh-clients \ openssh-server libssh2-devel ruby ruby-rdoc ruby-ri ruby-irb ruby-devel \ memcached libyaml libyaml-devel GeoIP GeoIP-devel ImageMagick \ ImageMagick-devel mysql mysql-server mysql-libs mysql-devel httpd httpd-manual \ httpd-devel.x86_64 apr-devel uuid java-1.6.0-openjdk java-1.6.0-openjdk-devel \ java-1.6.0-openjdk-javadoc readline-devel mysql++-devel glibc-devel \ openssl-devel gcc-c++ gcc-c++ zlib-devel openssl-devel readline-devel sphinx # Configure MySQL sudo su - service mysqld start mysqladmin -u root password 'PASSWORD' exit 2. Install Ruby Enterprise ========================== cd ~/ mkdir src cd src wget http://rubyforge.org/frs/download.php/68719/ruby-enterprise-1.8.7-2010.01.tar.gz tar xzvf ruby-enterprise-1.8.7-2010.01.tar.gz sudo ./ruby-enterprise-1.8.7-2010.01/installer sudo ln -s /opt/ruby-enterprise-1.8.7-2010.01/ /opt/ruby-enterprise sudo mv /usr/bin/ruby /usr/bin/ruby.old sudo ln -s /opt/ruby-enterprise/bin/ruby /usr/bin/ruby # Append to /etc/profile sudo vim /etc/profile export PATH=/opt/ruby-enterprise/bin:$PATH export PATH=/usr/local/bin:$PATH export LD_LIBRARY_PATH="/usr/local/lib" export LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" # Load new paths source /etc/profile 3. Install gems =============== sudo gem update --system sudo gem install --no-ri --no-rdoc rails mongrel mime-types \ textpow chronic ruby-hmac daemons mime-types oniguruma passenger \ textpow chronic BlueCloth ruby-yadis ruby-openid geoip ultrasphinx \ rspec rspec-rails RedCloth echoe hoe diff-lcs stompserver json mysql # ! Important! latest version of rack crashes thin server, use v1.0.1 sudo gem install -b --no-ri --no-rdoc -v 1.0.1 rack sudo gem install -b --no-ri --no-rdoc -v 1.3.1.1 rdiscount sudo gem install -b --no-ri --no-rdoc -v 1.1 stomp 4. Install and configure passenger ================================== sudo passenger-install-apache2-module # Edit Apache configuration file... sudo vim /etc/httpd/conf/httpd.conf # ...and add these lines... LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.2.11 PassengerRuby /opt/ruby-enterprise/bin/ruby # ...and set DocumentRoot to /var/www/yousource/public: ServerName versoinstall.it.jyu.fi DocumentRoot /var/www/yousource/public AllowOverride all Options -MultiViews ServerName versoinstall.it.jyu.fi DocumentRoot /var/www/yousource/public AllowOverride all Options -MultiViews 5. Set up git user ================== # git user needs to have a home directory # sudo adduser --create-home git # sudo: adduser: command not found sudo su - adduser --create-home git # Add git user to AllowGroups: vim /etc/ssh/sshd_config exit 6. Clone the YouSource repository ================================= cd /var/www sudo git clone git://versotest.it.jyu.fi/verso/gitorious.git yousource 7. Set up YouSource =================== sudo mkdir /var/git sudo mkdir /var/git/repositories sudo mkdir /var/git/tarballs sudo mkdir /var/git/tarball-work sudo ln -s /var/www/yousource/script/gitorious /usr/local/bin/gitorious sudo chown -R git:git /var/git /var/www/yousource # From now on as git user sudo su git cd /var/www/yousource rm public/.htaccess mkdir -p tmp/pids chmod ug+x script/* chmod -R g+w config/ log/ public/ tmp/ cd ~ mkdir /home/git/.ssh chmod 700 ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys # Important! Make sure permissions on authorized_keys is 600 and # /home/git/.ssh is 700 # Back to root user exit # Copy git-daemon, git-ultrasphinx, gitorious-poller and stomp from # doc/templates/yousource to /etc/init.d/ sudo cp /var/www/yousource/doc/templates/yousource/git-daemon /etc/init.d/ sudo cp /var/www/yousource/doc/templates/yousource/git-ultrasphinx /etc/init.d/ sudo cp /var/www/yousource/doc/templates/yousource/gitorious-poller /etc/init.d/ sudo cp /var/www/yousource/doc/templates/yousource/stomp /etc/init.d/ cd /etc/init.d/ sudo chmod 755 git-daemon git-ultrasphinx gitorious-poller stomp sudo cp /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/stompserver-0.9.9/config/stompserver.conf /etc/stompserver.conf # set daemon: true sudo vim /etc/stompserver.conf :daemon: true # Again to git user sudo su git cd /var/www/yousource cp config/database.sample.yml config/database.yml cp config/gitorious.sample.yml config/gitorious.yml cp config/broker.yml.example config/broker.yml cp config/email.yml.example config/email.yml cp script/ldap_settings.py.template script/ldap_settings.py # Copy output of following command apg -m 64 # Edit /var/www/yousource/gitorious/config/gitorious.yml # - put all options under the production section # - put secret key generated above by cookie_secret, but remove newlines cookie_secret: AcHofshify...-the-secret-key repository_base_path: "/var/git/repositories" gitorious_client_port: 80 gitorious_client_host: versoinstall.it.jyu.fi gitorious_host: versoinstall.it.jyu.fi archive_cache_dir: "/var/git/tarballs" archive_work_dir: "/var/git/tarballs-work" is_gitorious_dot_org: false # Edit config/email.yml to match your email settings vim config/email.yml # Edit ldap settings vim script/ldap_settings.py # Edit database settings vim config/database.yml # Modify the production section and add correct password production: adapter: mysql database: yousource_production username: root password: PASSWORD host: localhost encoding: utf8 # Install gems, create database and index the site for the search daemon exit sudo rake gems:install RAILS_ENV=production sudo su git source /etc/profile rake db:create RAILS_ENV=production rake db:migrate RAILS_ENV=production rake ultrasphinx:bootstrap RAILS_ENV=production # Add services to start automatically on boot sudo su - chkconfig --add stomp chkconfig --add git-daemon chkconfig --add gitorious-poller chkconfig --add git-ultrasphinx chkconfig stomp on chkconfig git-daemon on chkconfig gitorious-poller on chkconfig git-ultrasphinx on # Schedule sphinx search engine to index the site every minute. crontab -e # That opens an editor. Append this line and save. * * * * * cd /var/www/yousource && /opt/ruby-enterprise/bin/rake ultrasphinx:index RAILS_ENV=production # Now you can either reboot or start services by hand. sudo su - reboot # or service git-ultrasphinx start service stomp start service gitorious-poller start service git-daemon start service httpd restart # Now you should have YouSource up and running!