Skip to content

Installation of jobsworth v2.1 on Ubuntu 12.04

ari edited this page Oct 15, 2012 · 1 revision

(({#
#!/bin/bash

  1. This script is being developed to easily install jobsworth on Ubuntu 12.04
  2. It is not yet working, and help would be appreciated.
  3. You can cut and past lines into a terminal, or save as a file and run it.
  4. The script assumes a clean install of Ubuntu 12.04
  1. variables for apache setup
    JW_SERVER=“jobsworth” # Name of linux box
    JW_PRJ_ROOT=“/var/www/jobsworth” # Full path to jobsworth clone
    JW_WWWROOT=“${JW_PRJ_ROOT}/public” # Name of www folder (called ‘public’ by default)
    MYUSER=mike # (optional) user allowed to edit/own files (default is user installing)
    WEB=www-data # Apache user
  1. install dependencies
    sudo apt-get install openjdk-6-jre mysql-server apache2 git-core imagemagick gcc libc6-dev g++ zip build-essential bison openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libcurl4-openssl-dev apache2-prefork-dev libcurl4-openssl-dev libaprutil1-dev libapr1-dev libxslt-dev libxml2-dev
  1. if installing as non-root user: curl -L get.rvm.io | sudo bash -s stable

#install RVM per rvm website
curl -L get.rvm.io | sudo bash -s stable
sudo reboot # logout / login
sudo usermod -a -G rvm $USER
sudo usermod -a -G rvm $MYUSER
sudo su

source /etc/profile.d/rvm.sh

rvm pkg install readline —verify-downloads 1
rvm reinstall all —force
rvm pkg install iconv
rvm install 1.9.3 —with-iconv-dir=$HOME/.rvm/us
rvm —default use 1.9.3
rvm all do gem install bundler
rvm all do gem install passenger

echo "\
<VirtualHost *:80>
ServerName ${JW_SERVER}
ServerAlias *.${JW_SERVER}
DocumentRoot ${JW_WWWROOT}
RailsEnv production
PassengerHighPerformance on

CustomLog ${APACHE_LOG_DIR}/jobsworth_access.log combined ErrorLog ${APACHE_LOG_DIR}/jobsworth_error.log <Directory ${JW_WWWROOT}> AllowOverride All Options -MultiViews Order allow,deny Allow from all

\
" | sudo tee -a “/etc/apache2/sites-available/${JW_SERVER}” > /dev/null

rvm all do passenger-install-apache2-module

  1. Note that the next config section will need to be edited to match the exact version of passenger you installed
  2. It may also be better to put it into a separate file in /etc/apache2/Includes/passenger.conf (or similar)
    echo "\
  1. JOBSWORTH SETUP
    LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p286/gems/passenger-3.0.17
    PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p286/ruby" | sudo tee -a /etc/apache2/apache2.conf > /dev/null

a2ensite ${JW_SERVER}
service apache2 reload

git clone git://github.com/ari/jobsworth.git ${JW_PRJ_ROOT}
cd ${JW_PRJ_ROOT}
#git checkout -b Release_0_99_3_1 CLOCKINGT version, maybe?
git checkout -b origin/v1.2
rvm all do bundle install

chown -R $MYUSER:$WEB “${JW_PRJ_ROOT}”
chmod -R a+rwX “${JW_PRJ_ROOT}”

#mysql and create db+user
mysql -h localhost -u root -p
CREATE DATABASE jobsworth DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER jobsworth;
GRANT ALL ON jobsworth.* TO ’jobsworth’@’localhost’ IDENTIFIED BY ‘jobsworth’;

cp config/database.example.yml config/database.yml
nano /var/www/jobsworth/database.yml
}))