Installing and configuring software on a production server

kej edited this page Aug 22, 2012 · 19 revisions

Ubuntu 10.04.4 LTS server 32bit (12.04 appears in April 2012 and could be used from mid of 2012)

  • Install Apache2, postgres, curl
sudo apt-get install ...

and then for the postgres gems:

sudo apt-get install libpq-dev #needed for pg gem
  • Create new user (without pwd) sudo useradd passenger --system

  • Add passenger to www-data group

  • With postgres (sudo su postgres) user create new database user passenger with new password

  • create lang for postgres

  • create database for passenger user

  • For new passenger user install rvm (note: using rvm is only recommended for systems which are routinely updated as a possible security update has to be installed manually. Alternatively one can use the brightbox ruby-ng packages for ubuntu)

  • install ruby version wanted with rvm

  • Give passenger ownership to /var/www

After Setting up a production server

  • with selected ruby and gemset install bundler

  • bundle install for project

  • gem install passenger --no-ri --no-rdoc

  • passenger-install-apache2-module

  • Install all necessary packages via sudo (passenger tells you what is missing)

sudo apt-get install libcurl4-openssl-dev
sudo apt-get install apache2-prefork-dev
sudo apt-get install libapr1-dev
sudo apt-get install libaprutil1-dev
  • passenger-install-apache2-module again

  • passenger tells you what to add to your apache config file (LoadModule, PassengerRoot and PassengerRuby).

  • Put passenger config into site config file (e.g. /etc/apache2/sites-available/befdata ) - could also be put into a global apache config file sudo vi /etc/apache2/sites-available/befdata

Here's the file contents:

LoadModule passenger_module /home/passenger/.rvm/gems/ruby-1.9.3-p125@befdata-china/gems/passenger-3.0.11/ext/apache2/mod_passenger.so

PassengerRoot /home/passenger/.rvm/gems/ruby-1.9.3-p125@befdata-china/gems/passenger-3.0.11
PassengerRuby /home/passenger/.rvm/wrappers/ruby-1.9.3-p125@befdata-china/ruby

<VirtualHost *:80>
  ServerName china.befdata.biow.uni-leipzig.de
  DocumentRoot /var/www/china/public
  <Directory /var/www/china/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
</VirtualHost>
  • Disable default site sudo a2dissite default

  • Enable apache site configuration sudo a2ensite befdata

  • Reload Apache configuration sudo /etc/init.d/apache2 reload

The server is reachable via:

atlantis.tm.informatik.uni-leipzig.de:xxxx> befdata2:xx
atlantis.tm.informatik.uni-leipzig.de:xxxx> befdata2:xx
atlantis.tm.informatik.uni-leipzig.de:xxxx> befdata2:xx
atlantis.tm.informatik.uni-leipzig.de:xxxx> befdata2:xx