Linux ubuntu

ms705 edited this page Dec 20, 2011 · 2 revisions

Linux Ubuntu

These instructions will install and set a production environment of Tracks 1.7.1 on a fresh install of Ubuntu 10.04. Tracks will be served by Phusion Passenger though Apache in a subdir of its own. MySQL will be used for the database.

Details

In these instructions some things may be different from set up to set up. Some will forcefully be different such as the zip filename of Tracks code. Others can be different on your choice such as passwords, database names or directory to place the application.

Please note: some parts of these instructions don’t show up correctly due to limitations of this wiki syntax. You can find the same instructions under a correct formatting on the Ubuntu forums. If you wish to continue with these, the errors appear in the commands using find, it can’t show the characters { and } in a code block. Also, both MySQL shell and configuration of database.yml show up messed up.

1 – Installing all dependencies

$ sudo tasksel install lamp-server

$ sudo aptitude install ruby libdbd-mysql-ruby rake libopenssl-ruby libapache2-mod-passenger

2 – Download and set permissions for tracks

$ wget http://github.com/bsag/tracks/zipball/1.7.1

$ unzip ./bsag-tracks-1.7.1-0-g13db454.zip

$ sudo mv ./bsag-tracks-6aff172 /var/lib/tracks

$ sudo cp /var/lib/tracks/config/database.yml.tmpl /var/lib/tracks/config/database.yml

$ sudo cp /var/lib/tracks/config/site.yml.tmpl /var/lib/tracks/config/site.yml 

$ sudo chown -R www-data:root /var/lib/tracks

$ sudo find /var/lib/tracks -type d -exec chmod 700 '{}' \;

$ sudo find /var/lib/tracks -type f -exec chmod 600 '{}' \;

$ sudo find /var/lib/tracks/script -type f -exec chmod 700 '{}' \;

$ sudo ln -s /var/lib/tracks/public /var/www/tracks

Note: the zip and extracted directory filenames will probably be different
Note: it’s not possible to move the configuration files to ‘’/etc’’ as is usual with Debian applications without having to change the code. If such is desired, the file ‘’config/boot.rb’’ will require some editing.

The ’’find’’ and ’’chmod’’ commands will set permissions as ’’700’’ for all directories and files inside the ’’script’’ directory. All other files will have permissions set to ’’600’’. All the files will be owned by the user ‘’www-data’’ which is the user that runs Apache

3 – Create MySQL database


$ sudo mysql -u root -p
mysql> CREATE DATABASE tracks;
Query OK, 1 row affected (0.03 sec)

mysql> GRANT ALL PRIVILEGES ON tracks.* TO 'trackuser'@'localhost' IDENTIFIED BY 'trackspassword' WITH GRANT OPTION;
Query OK, 0 rows affected (0.08 sec)

mysql> quit;
Bye 

Note: if you choose a different database name, MySQL user to access the database or different password, they’ll have to be change accordingly here and on the following. It’s not difficult to do so, just requires a bit of extra attention.

4 – Configure tracks

The file ‘’config/database.yml’’ needs to be edited. Edit ONLY the production section


production:
  adapter: mysql
  database: tracks
  host: localhost
  username: tracksuser
  password: trackspassword

The file ‘’config/site.yml’’ needs to be edited. Choose a new salt word and set the correct time zone. The only things that need to be changed are


salt: ''change-me'' 

time_zone: ''UTC''

To get a list of available time zones, use the command

$ sudo rake --rakefile=/var/lib/tracks/Rakefile time:zones:local 

5 – Populate database

$ sudo sh -c "cd /var/lib/tracks/; rake --rakefile=/var/lib/tracks/Rakefile db:migrate RAILS_ENV=production"

6 – Configure and restart apache

Create a file for the tracks application on apache configuration and set it to use Passenger

$ echo "RailsBaseURI /tracks" | sudo tee /etc/apache2/conf.d/tracks.conf

$ sudo mv /var/lib/tracks/public/.htaccess /var/lib/tracks/public/.dontneedhtaccess

$ sudo /etc/init.d/apache2 restart

Open the URL http://localhost/tracks to start tracks. Whatever is the URL of your webserver, just add tracks to access to it remotely.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.