added rvm, ruby, bundler, phusion passenger.

rharmonson 2014-06-26 09:49:06 -07:00
parent 130dc6582d
commit b25c696e32

@ -6,23 +6,29 @@ The purpose of this document is describe the installation process for Tracks 2.2
Build Overview
1. Base Operating System
2. Tracks
1. Base operating system
1. Prerequisite packages
1. User account & sudo
1. MysQL database
1. Ruby Version Manager
1. Ruby 1.9
1. Bundler
1. Phusion Passenger
## 1. Base Operating System
## 1. Base operating system
Base CentOS Installation Task Overview
* Obtain media
* Installation
* Basic configuration
* Verify operation
* Time zone
* EPEL
* Virtual machine?
* Update
* Obtain media
* Installation
* Basic configuration
* Verify operation
* Time zone
* EPEL
* Virtual machine?
* Update
### Obtain Media
### Obtain media
If you are new to Linux or new to CentOS minimal installations, I would advise reviewing all the information at the URL below. Otherwise, scroll down and select the download URL under section 2. We will be using x86_64 version, also, known as 64 bit. The 32 bit version *should* work as well.
http://wiki.centos.org/Manuals/ReleaseNotes/CentOSMinimalCD6.5
@ -31,8 +37,8 @@ Boot from media and, generally, accept the defaults. You have an opportunity to
You may skip to the section titled "Verify Operation" if you complete all the settings using the installation GUI.
### Basic Configuration
Network Interface Settings
### Basic configuration
Network interface settings
http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscripts-interfaces.html
The default interface settings will be as follows with the exception that your HWADDR and UUID will differ:
@ -139,7 +145,7 @@ lo Link encap:Local Loopback
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
```
### Network Settings
### Network settings
Reference: http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-sysconfig-network.html
Default settings after installation are as follows:
@ -182,7 +188,7 @@ link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.113.254 0.0.0.0 UG 0 0 0 eth0
```
###Hosts Settings
###Hosts settings
Note the current settings.
```
[root@www ~]# cat /etc/hosts
@ -207,7 +213,7 @@ Bringing up interface eth0: Determining if ip address 192.168.113.150 is alread
[ OK ]
```
### Resolution Settings
### Resolution settings
Configure DNS resolution settings. Current setting shown below are a result of using DHCP, initially. Your resolv.conf may differ.
```
@ -225,7 +231,7 @@ nameserver 8.8.8.8
nameserver 8.8.4.4
```
### Verifying Operations
### Verifying operations
Use ping for an incomplete test, but it will verify basic interface, routing, and name resolution operation.
```
[root@www ~]# ping www.google.com -c 5
@ -241,7 +247,7 @@ PING www.google.com (74.125.239.48) 56(84) bytes of data.
rtt min/avg/max/mdev = 8.256/9.808/13.490/1.924 ms
```
###Time Zone
###Time zone
After installation, the default time zone is America/New_York. Changing the time can be done several ways. My preference is to first identify the time zone by listing /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles, then update /etc/sysconfig/clock.
```
[root@www ~]# cat /etc/sysconfig/clock
@ -330,6 +336,7 @@ Installed size: 20 M
Is this ok [y/N]:
```
###Update
Update CentOS using base and EPEL repositories, then reboot.
```
# yum update
@ -409,8 +416,9 @@ Restart to utilize the new packages and drivers.
# reboot
```
##2. Tracks
###Install Tracks prerequisites.
##2. Prerequisite packages
###Packages
Including RVM prerequisites, mysql server, apache, and system-config packages for ease of administration.
reference: https://rvm.io/rvm/prerequisites <-- their list is incomplete!
Note: sqlite-devel package is required for Tracks and bundler.
@ -528,7 +536,172 @@ Installed size: 240 M
Is this ok [y/N]:
```
###Validate RVM prerequisites.
##User account & audo
A decision needs to be made to either use root or an user account. In practice, using a dedicated user could decreases the risk of root exploits, however, this assumes you do not granting sudo with wide open privileges (command access) to the user. I am over simplifying, so do some googling and decide for yourself. I will be using a user account named tracks with the intent of removing sudo access after testing is complete.
Create user 'tracks'
```
# useradd tracks --password <password>
```
Configure tracks user to use 'sudo';
```
# visudo
```
Add the following which essentially gives user tracks root equivalent privileges using sudo.
```
tracks ALL=(ALL) ALL
```
Log off then on using user tracks to validate functionality before moving to next step. Also, please note the convention I am using is to indicate root with '#' and '$' to represent tracks with sudo when appropriate.
Disable root SSH access.
```
$ sudo vi /etc/ssh/sshd_config
```
change
```
#PermitRootLogin yes
```
to
```
PermitRootLogin No
```
For the changes to take effect immediately, or you can wait until next system restart
```
$ sudo service sshd restart
```
##MySQL database
Initial MySQL configuration.
Start mysql
```
$ sudo service mysqld start
```
Configure the basics. Essentially, respond yes to each query.
```
$ sudo mysql_secure_installation
```
Enable automatic startup and shutdown; init script.
```
$ sudo chkconfig mysqld on
```
Create a new database, user, and grant privileges. Replace dbuser and <password> with your own values.
```
$ mysql -u root -p
> create database tracks;
> create user 'dbuser'@'localhost' identified by '<password>';
> grant all on tracks.* to 'dbuser'@'localhost' with grant option;
> exit;
```
###Ruby Version Manager
Validate RVM prerequisite binaries are installed by executing the following as root or with sudo.
```
$ sudo for name in {bash,awk,sed,grep,ls,cp,tar,curl,gunzip,bunzip2,git,svn} ; do which $name ; done
```
Install Ruby Version Manager (RVM)
```
$ \curl -sSL https://get.rvm.io | bash -s stable
$ echo source ~/.profile >> .bash_profile
```
Also, create a .gemrc and configure to not install ri and rdocs by default.
```
$ echo gem: --no-ri --no-rdoc >> ~/.gemrc
```
Log off then on or $ source ~/.profile before continuing.
##Ruby 1.9
Tracks installation.textile states Tracks version 2.2.2 works best with Ruby 1.9, let's make sure we have RVM's requirements have been met then install ruby 1.9.
```
$ rvm requirements
$ rvm install 1.9
```
Results with:
```
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/x86_64/ruby-1.9.3-p547.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /home/tracks/.rvm/rubies/ruby-1.9.3-p547, this may take a while depending on your cpu(s)...
ruby-1.9.3-p547 - #downloading ruby-1.9.3-p547, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9801k 100 9801k 0 0 1362k 0 0:00:07 0:00:07 --:--:-- 1505k
ruby-1.9.3-p547 - #extracting ruby-1.9.3-p547 to /home/tracks/.rvm/src/ruby-1.9.3-p547...
ruby-1.9.3-p547 - #applying patch /home/tracks/.rvm/patches/ruby/GH-488.patch.ch.
ruby-1.9.3-p547 - #applying patch /home/tracks/.rvm/patches/ruby/ssl_no_ec2m.pat
ruby-1.9.3-p547 - #configuring.....ruby-1.9.3-p547........................................
ruby-1.9.3-p547 - #post-configuration.
ruby-1.9.3-p547 - #compiling...................................................................
ruby-1.9.3-p547 - #installing........................
ruby-1.9.3-p547 - #making binaries executable..
ruby-1.9.3-p547 - #downloading rubygems-2.2.2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 404k 100 404k 0 0 919k 0 --:--:-- --:--:-- --:--:-- 1123k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-1.9.3-p547 - #extracting rubygems-2.2.2...
ruby-1.9.3-p547 - #removing old rubygems.........
ruby-1.9.3-p547 - #installing rubygems-2.2.2...............
ruby-1.9.3-p547 - #gemset created /home/tracks/.rvm/gems/ruby-1.9.3-p547@global
ruby-1.9.3-p547 - #importing gemset /home/tracks/.rvm/gemsets/global.gems.............................................................
ruby-1.9.3-p547 - #generating global wrappers.........
ruby-1.9.3-p547 - #gemset created /home/tracks/.rvm/gems/ruby-1.9.3-p547
ruby-1.9.3-p547 - #importing gemsetfile /home/tracks/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.3-p547 - #generating default wrappers.........
ruby-1.9.3-p547 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-1.9.3-p547 - #complete
WARNING: Please be aware that you just installed a ruby that is no longer maintained (2014-02-23), for a list of maintained rubies visit:
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.2 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri
```
You *must* specify a default ruby version, otherwise, executing commands like bundle, below, will fail with an error stating something like 'no such command.'
```
$ rvm --default use 1.9.3
$ rvm list
```
##Bundler
Bundler is an additional requirement of Tracks.
```
$ gem install bundler
Fetching: bundler-1.6.2.gem (100%)
Successfully installed bundler-1.6.2
1 gem installed
$ bundle -v
Bundler version 1.6.2
```
##Phusion Passenger
We are using Apache, thus Phusion Passenger provides painless integration between Apache and Tracks.
```
$ gem install passenger
Fetching: daemon_controller-1.2.0.gem (100%)
Successfully installed daemon_controller-1.2.0
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: passenger-4.0.44.gem (100%)
Building native extensions. This could take a while...
Successfully installed passenger-4.0.44
3 gems installed
$ passenger -v
Phusion Passenger version 4.0.44
```
# for name in {bash,awk,sed,grep,ls,cp,tar,curl,gunzip,bunzip2,git,svn} ; do which $name ; done
```