From 887efc30d6e72ce2fc5603a6dc93fe83e4bfed09 Mon Sep 17 00:00:00 2001 From: bsag Date: Sat, 16 Jul 2011 08:14:37 -0700 Subject: [PATCH] Created Linux ubuntu (textile) --- Linux-ubuntu.textile | 112 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Linux-ubuntu.textile diff --git a/Linux-ubuntu.textile b/Linux-ubuntu.textile new file mode 100644 index 0000000..00e9f30 --- /dev/null +++ b/Linux-ubuntu.textile @@ -0,0 +1,112 @@ +h1. 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. + +h2. 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":http://ubuntuforums.org/showthread.php?t=1580690. 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. + +h3. 1 - Installing all dependencies + + +$ sudo tasksel install lamp-server + +$ sudo aptitude install ruby libdbd-mysql-ruby rake libopenssl-ruby libapache2-mod-passenger + + +h3. 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 + +h3. 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. + +h3. 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 + + +h3. 5 - Populate database + + +$ sudo sh -c "cd /var/lib/tracks/; rake --rakefile=/var/lib/tracks/Rakefile db:migrate RAILS_ENV=production" + + +h3. 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. \ No newline at end of file