Skip to content

Installing Tracks 2.2.2 on CentOS 6.5 Minimal x86_64

rharmonson edited this page Jun 29, 2014 · 55 revisions

The purpose of this document is to describe the installation process for Tracks 2.2.2 on CentOS 6.5 Minimal x86_64 using epel repository, rvm, mysql, apache, and phusion passenger. This is but one method of installing Tracks, and I am open to suggestions and constructive criticism.

Build Overview

  1. Base operating system
  2. Prerequisite packages
  3. User account & sudo
  4. MySQL database
  5. Ruby Version Manager (rvm)
  6. Ruby 1.9
  7. Bundler
  8. Phusion Passenger
  9. Tracks 2.2.2
  10. Apache2
  11. Done(?)
  12. Other Considerations

1. Base operating system

Base CentOS Installation Task Overview

  • Obtain media
  • Installation
  • Basic configuration
  • Verify operation
  • Time zone
  • EPEL
  • Virtual machine?
  • Update

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.

Reference: http://wiki.centos.org/Manuals/ReleaseNotes/CentOSMinimalCD6.5

Installation

Boot from media and, generally, accept the defaults. You have an opportunity to provide time zone, a host name, configure network interfaces, provide DNS IPs, and domain search. If configured at this point, the installation script automatically configures the resulting installation using these settings. It is a time saver, however, I am going to assume these setting have not been set or changes will be needed.

You may skip to the section titled "Verify operation" if you completed all the settings using the installation GUI.

Basic configuration

Network interface settings

Reference: 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:

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=00:0C:29:C5:0D:BD
TYPE=Ethernet
UUID=0250e398-8918-4e9d-afd7-7ae04258810f
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=dhcp

[root@localhost ~]# ifconfig

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

If you desire to use DHCP, update ifcfg-eth0 using ONBOOT value from no to yes, save, then restart network services.

[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=00:0C:29:C5:0D:BD
TYPE=Ethernet
UUID=0250e398-8918-4e9d-afd7-7ae04258810f
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

[root@localhost ~]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0... done.
                                                           [  OK  ]

[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C5:0D:BD
          inet addr:192.168.113.130  Bcast:192.168.113.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fec5:dbd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:67 errors:0 dropped:0 overruns:0 frame:0
          TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7680 (7.5 KiB)  TX bytes:8493 (8.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

If you are going to use a static IP address, then update ifcfg-eth0 options with values for your network. Note the NM-CONROLLED can be safely ignored or removed for on CentOS minimal installations, NM or Network Manager is not installed.

[root@localhost ~]# cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# vi ifcfg-eth0

DEVICE=eth0
HWADDR=00:0C:29:C5:0D:BD
TYPE=Ethernet
UUID=0250e398-8918-4e9d-afd7-7ae04258810f
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.113.150
NETMASK=255.255.255.0

[root@localhost network-scripts]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.113.150 is already in use for device eth0...
                                                           [  OK  ]
[root@localhost network-scripts]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C5:0D:BD
          inet addr:192.168.113.150  Bcast:192.168.113.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fec5:dbd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:455 errors:0 dropped:0 overruns:0 frame:0
          TX packets:293 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45176 (44.1 KiB)  TX bytes:42738 (41.7 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

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:

[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain

[root@www ~]# hostname
localhost.localdomain
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.113.0   *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1002   0        0 eth0

Update the "network" file with both the network and your host's fully qualified domain name (FQDN). This will result with a default layer 3 or routing gateway. Note a log off and on or reboot is needed to see 'hostname' updated.

[root@localhost ~]# vi /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=www.mydomain.com
GATEWAY=192.168.113.254

[root@localhost ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.113.150 is already in use for device eth0...
                                                           [  OK  ]

[root@www ~]# hostname
www.mydomain.com
[root@localhost ~]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.113.0   *               255.255.255.0   U     0      0        0 eth0
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 Note the current settings.

[root@www ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

To update the host name, update the hosts file as follows:

[root@www ~]# vi /etc/hosts

192.168.113.150 www www.mydomain.com
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@www ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Determining if ip address 192.168.113.150 is already in use for device eth0...
                                                           [  OK  ]

Resolution settings

Configure DNS resolution settings. Current settings shown below are a result of using DHCP, initially. Your resolv.conf may differ.

[root@www ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 192.168.113.254

Update resolv.conf using vi and provide DNS IP addresses and domain suffix search order.

[root@www ~]# cat /etc/resolv.conf
search subdom.mydomain.com mydomain.com
nameserver 8.8.8.8
nameserver 8.8.4.4

Verifying operation

Use ping to verify basic interface, routing, and name resolution operation.

[root@www ~]# ping www.google.com -c 5
PING www.google.com (74.125.239.48) 56(84) bytes of data.
64 bytes from nuq04s19-in-f16.1e100.net (74.125.239.48): icmp_seq=1 ttl=128 time=9.83 ms
64 bytes from nuq04s19-in-f16.1e100.net (74.125.239.48): icmp_seq=2 ttl=128 time=9.05 ms
64 bytes from nuq04s19-in-f16.1e100.net (74.125.239.48): icmp_seq=3 ttl=128 time=13.4 ms
64 bytes from nuq04s19-in-f16.1e100.net (74.125.239.48): icmp_seq=4 ttl=128 time=8.40 ms
64 bytes from nuq04s19-in-f16.1e100.net (74.125.239.48): icmp_seq=5 ttl=128 time=8.25 ms

--- www.google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4070ms
rtt min/avg/max/mdev = 8.256/9.808/13.490/1.924 ms

###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
ZONE="America/New_York"
[root@localhost ~]# ls /usr/share/zoneinfo/America/
Adak            Coral_Harbour  Hermosillo     Moncton         Santarem
Anchorage       Cordoba        Indiana        Monterrey       Santiago
Anguilla        Costa_Rica     Indianapolis   Montevideo      Santo_Domingo
Antigua         Creston        Inuvik         Montreal        Sao_Paulo
Araguaina       Cuiaba         Iqaluit        Montserrat      Scoresbysund
Argentina       Curacao        Jamaica        Nassau          Shiprock
Aruba           Danmarkshavn   Jujuy          New_York        Sitka
Asuncion        Dawson         Juneau         Nipigon         St_Barthelemy
Atikokan        Dawson_Creek   Kentucky       Nome            St_Johns
Atka            Denver         Knox_IN        Noronha         St_Kitts
Bahia           Detroit        Kralendijk     North_Dakota    St_Lucia
Bahia_Banderas  Dominica       La_Paz         Ojinaga         St_Thomas
Barbados        Edmonton       Lima           Panama          St_Vincent
Belem           Eirunepe       Los_Angeles    Pangnirtung     Swift_Current
Belize          El_Salvador    Louisville     Paramaribo      Tegucigalpa
Blanc-Sablon    Ensenada       Lower_Princes  Phoenix         Thule
Boa_Vista       Fortaleza      Maceio         Port-au-Prince  Thunder_Bay
Bogota          Fort_Wayne     Managua        Porto_Acre      Tijuana
Boise           Glace_Bay      Manaus         Port_of_Spain   Toronto
Buenos_Aires    Godthab        Marigot        Porto_Velho     Tortola
Cambridge_Bay   Goose_Bay      Martinique     Puerto_Rico     Vancouver
Campo_Grande    Grand_Turk     Matamoros      Rainy_River     Virgin
Cancun          Grenada        Mazatlan       Rankin_Inlet    Whitehorse
Caracas         Guadeloupe     Mendoza        Recife          Winnipeg
Catamarca       Guatemala      Menominee      Regina          Yakutat
Cayenne         Guayaquil      Merida         Resolute        Yellowknife
Cayman          Guyana         Metlakatla     Rio_Branco
Chicago         Halifax        Mexico_City    Rosario
Chihuahua       Havana         Miquelon       Santa_Isabel
[root@www ~]#

Once you have identified your time zone, i.e. Los_Angeles, update the clock file.

[root@www ~]# vi /etc/sysconfig/clock
ZONE="America/New_York"

###EPEL EPEL repository installation steps are as follows:

  • Install the repository's key, so the package can be verified and trusted.
  • Installl the repository package for your distribution.
  • Configure, if desired, the repository configuration files found /etc/yum.repos.d.

For CentOS 6.5 64 bit

# rpm --import http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Once installed, you can use the default settings; EPEL base is enabled.

###Virtual Machine? If using CentOS as a virtual machine, it is advisable to install virtual machine drivers. Not a requirement, but you will, otherwise, lose functionality with most virtual technology solutions. I am using VMware's solution and use open-vm-tools versus VMware Tools, but it is my personal preference.

For installation of open-vm-tools, complete the installation of the EPEL repository, then execute the following:

[root@www ~]# yum install open-vm-tools

Results with the following:

================================================================================
 Package              Arch          Version                   Repository   Size
================================================================================
Installing:
 open-vm-tools        x86_64        9.4.0-8.el6               epel        401 k
Installing for dependencies:
 dbus                 x86_64        1:1.2.24-7.el6_3          base        207 k
 libdnet              x86_64        1.12-6.el6                epel         28 k
 libicu               x86_64        4.2.1-9.1.el6_2           base        4.9 M

Transaction Summary
================================================================================
Install       4 Package(s)

Total download size: 5.5 M
Installed size: 20 M
Is this ok [y/N]:

###Update Update CentOS using base and EPEL repositories, then reboot.

# yum update

Results with:

================================================================================
 Package                        Arch    Version                  Repository
																		   Size
================================================================================
Installing:
 kernel                         x86_64  2.6.32-431.17.1.el6      updates   28 M
Updating:
 audit                          x86_64  2.2-4.el6_5              updates  225 k
 audit-libs                     x86_64  2.2-4.el6_5              updates   60 k
 ca-certificates                noarch  2013.1.95-65.1.el6_5     updates  1.1 M
 centos-release                 x86_64  6-5.el6.centos.11.2      updates   20 k
 coreutils                      x86_64  8.4-31.el6_5.1           updates  3.0 M
 coreutils-libs                 x86_64  8.4-31.el6_5.1           updates   50 k
 curl                           x86_64  7.19.7-37.el6_5.3        updates  194 k
 device-mapper-multipath        x86_64  0.4.9-72.el6_5.2         updates  117 k
 device-mapper-multipath-libs   x86_64  0.4.9-72.el6_5.2         updates  181 k
 device-mapper-persistent-data  x86_64  0.2.8-4.el6_5            updates  1.1 M
 dracut                         noarch  004-336.el6_5.2          updates  122 k
 dracut-kernel                  noarch  004-336.el6_5.2          updates   24 k
 ethtool                        x86_64  2:3.5-1.4.el6_5          updates  101 k
 glib2                          x86_64  2.26.1-7.el6_5           updates  1.6 M
 glibc                          x86_64  2.12-1.132.el6_5.2       updates  3.8 M
 glibc-common                   x86_64  2.12-1.132.el6_5.2       updates   14 M
 grep                           x86_64  2.6.3-4.el6_5.1          updates  229 k
 initscripts                    x86_64  9.03.40-2.el6.centos.1   updates  940 k
 iproute                        x86_64  2.6.32-32.el6_5          updates  365 k
 kernel-firmware                noarch  2.6.32-431.17.1.el6      updates   13 M
 kpartx                         x86_64  0.4.9-72.el6_5.2         updates   58 k
 krb5-libs                      x86_64  1.10.3-15.el6_5.1        updates  761 k
 libblkid                       x86_64  2.17.2-12.14.el6_5       updates  115 k
 libcurl                        x86_64  7.19.7-37.el6_5.3        updates  166 k
 libuuid                        x86_64  2.17.2-12.14.el6_5       updates   68 k
 libxml2                        x86_64  2.7.6-14.el6_5.1         updates  800 k
 mdadm                          x86_64  3.2.6-7.el6_5.2          updates  337 k
 mysql-libs                     x86_64  5.1.73-3.el6_5           updates  1.2 M
 nspr                           x86_64  4.10.2-1.el6_5           updates  113 k
 nss                            x86_64  3.15.3-6.el6_5           updates  822 k
 nss-softokn                    x86_64  3.14.3-10.el6_5          updates  265 k
 nss-softokn-freebl             x86_64  3.14.3-10.el6_5          updates  157 k
 nss-sysinit                    x86_64  3.15.3-6.el6_5           updates   40 k
 nss-tools                      x86_64  3.15.3-6.el6_5           updates  358 k
 nss-util                       x86_64  3.15.3-1.el6_5           updates   64 k
 openldap                       x86_64  2.4.23-34.el6_5.1        updates  265 k
 openssl                        x86_64  1.0.1e-16.el6_5.7        updates  1.5 M
 p11-kit                        x86_64  0.18.5-2.el6_5.2         updates   94 k
 p11-kit-trust                  x86_64  0.18.5-2.el6_5.2         updates   71 k
 postfix                        x86_64  2:2.6.6-6.el6_5          updates  2.0 M
 psmisc                         x86_64  22.6-19.el6_5            updates   81 k
 python                         x86_64  2.6.6-52.el6             updates   74 k
 python-libs                    x86_64  2.6.6-52.el6             updates  5.3 M
 selinux-policy                 noarch  3.7.19-231.el6_5.3       updates  825 k
 selinux-policy-targeted        noarch  3.7.19-231.el6_5.3       updates  2.8 M
 tzdata                         noarch  2014b-3.24.el6           updates  452 k
 upstart                        x86_64  0.6.5-13.el6_5.3         updates  177 k
 util-linux-ng                  x86_64  2.17.2-12.14.el6_5       updates  1.5 M
 yum                            noarch  3.2.29-43.el6.centos     updates  996 k
 yum-plugin-fastestmirror       noarch  1.1.30-17.el6_5          updates   28 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade      50 Package(s)

Total download size: 90 M
Is this ok [y/N]:

Restart to utilize the new packages and drivers.

# reboot

##2. Prerequisite 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.

Note: libxml2-devel, libxslt, and libxslt-devel packagea is required for Tracks, specifically, nokogiri.

Note: httpd-devel and libcurl-devel and dependencies packages are required for passenger.

# yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel sqlite-devel libxml2-devel libxslt libxslt-devel mysql-server mysql-devel httpd httpd-devel libcurl-devel nodejs git subversion system-config-network-tui system-config-firewall-tui

Results with:

================================================================================
 Package                    Arch   Version                        Repository
																		   Size
================================================================================
Installing:
 autoconf                   noarch 2.63-5.1.el6                   base    781 k
 automake                   noarch 1.11.1-4.el6                   base    550 k
 bison                      x86_64 2.4.1-5.el6                    base    637 k
 gcc-c++                    x86_64 4.4.7-4.el6                    base    4.7 M
 git                        x86_64 1.7.1-3.el6_4.1                base    4.6 M
 httpd                      x86_64 2.2.15-30.el6.centos           updates 821 k
 httpd-devel                x86_64 2.2.15-30.el6.centos           updates 150 k
 libcurl-devel              x86_64 7.19.7-37.el6_5.3              updates 244 k
 libffi-devel               x86_64 3.0.5-3.2.el6                  base     18 k
 libtool                    x86_64 2.2.6-15.5.el6                 base    564 k
 libxml2-devel              x86_64 2.7.6-14.el6_5.1               updates 1.1 M
 libxslt                    x86_64 1.1.26-2.el6_3.1               base    452 k
 libxslt-devel              x86_64 1.1.26-2.el6_3.1               base    561 k
 libyaml-devel              x86_64 0.1.6-1.el6                    epel     91 k
 mysql-devel                x86_64 5.1.73-3.el6_5                 updates 129 k
 mysql-server               x86_64 5.1.73-3.el6_5                 updates 8.6 M
 nodejs                     x86_64 0.10.28-1.el6                  epel    497 k
 openssl-devel              x86_64 1.0.1e-16.el6_5.7              updates 1.2 M
 patch                      x86_64 2.6-6.el6                      base     90 k
 readline-devel             x86_64 6.0-4.el6                      base    134 k
 sqlite-devel               x86_64 3.6.20-1.el6                   base     81 k
 subversion                 x86_64 1.6.11-10.el6_5                updates 2.3 M
 system-config-firewall-tui noarch 1.2.27-5.el6                   base     37 k
 system-config-network-tui  noarch 1.6.0.el6.2-1.el6              base    1.2 M
 zlib-devel                 x86_64 1.2.3-29.el6                   base     44 k
Installing for dependencies:
 apr                        x86_64 1.3.9-5.el6_2                  base    123 k
 apr-devel                  x86_64 1.3.9-5.el6_2                  base    176 k
 apr-util                   x86_64 1.3.9-3.el6_0.1                base     87 k
 apr-util-devel             x86_64 1.3.9-3.el6_0.1                base     69 k
 apr-util-ldap              x86_64 1.3.9-3.el6_0.1                base     15 k
 c-ares19                   x86_64 1.9.1-5.el6.3                  epel     73 k
 cloog-ppl                  x86_64 0.15.7-1.2.el6                 base     93 k
 cpp                        x86_64 4.4.7-4.el6                    base    3.7 M
 crda                       x86_64 1.1.1_2010.11.22-1.el6         base     23 k
 cyrus-sasl-devel           x86_64 2.1.23-13.el6_3.1              base    302 k
 db4-cxx                    x86_64 4.7.25-18.el6_4                base    588 k
 db4-devel                  x86_64 4.7.25-18.el6_4                base    6.6 M
 dbus-python                x86_64 0.83.0-6.1.el6                 base    204 k
 expat-devel                x86_64 2.0.1-11.el6_2                 base    120 k
 gcc                        x86_64 4.4.7-4.el6                    base     10 M
 glibc-devel                x86_64 2.12-1.132.el6_5.2             updates 978 k
 glibc-headers              x86_64 2.12-1.132.el6_5.2             updates 608 k
 gnutls                     x86_64 2.8.5-14.el6_5                 updates 346 k
 http-parser                x86_64 2.0-4.20121128gitcd01361.el6   epel     22 k
 httpd-tools                x86_64 2.2.15-30.el6.centos           updates  73 k
 iw                         x86_64 3.10-1.1.el6                   base     55 k
 kernel-headers             x86_64 2.6.32-431.17.1.el6            updates 2.9 M
 keyutils-libs-devel        x86_64 1.4-4.el6                      base     28 k
 krb5-devel                 x86_64 1.10.3-15.el6_5.1              updates 495 k
 libcom_err-devel           x86_64 1.41.12-18.el6                 base     32 k
 libgcrypt-devel            x86_64 1.4.5-11.el6_4                 base    118 k
 libgomp                    x86_64 4.4.7-4.el6                    base    118 k
 libgpg-error-devel         x86_64 1.7-4.el6                      base     14 k
 libidn-devel               x86_64 1.18-2.el6                     base    137 k
 libnl                      x86_64 1.1.4-2.el6                    base    121 k
 libproxy                   x86_64 0.3.0-4.el6_3                  base     39 k
 libproxy-bin               x86_64 0.3.0-4.el6_3                  base    8.2 k
 libproxy-python            x86_64 0.3.0-4.el6_3                  base    8.4 k
 libselinux-devel           x86_64 2.0.94-5.3.el6_4.1             base    136 k
 libsepol-devel             x86_64 2.0.41-4.el6                   base     64 k
 libstdc++-devel            x86_64 4.4.7-4.el6                    base    1.6 M
 libuv                      x86_64 1:0.10.27-1.el6                epel     55 k
 libyaml                    x86_64 0.1.6-1.el6                    epel     52 k
 mailcap                    noarch 2.1.31-2.el6                   base     27 k
 mpfr                       x86_64 2.4.1-6.el6                    base    157 k
 mysql                      x86_64 5.1.73-3.el6_5                 updates 894 k
 ncurses-devel              x86_64 5.7-3.20090208.el6             base    642 k
 neon                       x86_64 0.29.3-3.el6_4                 base    119 k
 openldap-devel             x86_64 2.4.23-34.el6_5.1              updates 1.1 M
 pakchois                   x86_64 0.4-3.2.el6                    base     21 k
 pciutils                   x86_64 3.1.10-2.el6                   base     85 k
 perl                       x86_64 4:5.10.1-136.el6               base     10 M
 perl-DBD-MySQL             x86_64 4.013-3.el6                    base    134 k
 perl-DBI                   x86_64 1.609-4.el6                    base    705 k
 perl-Error                 noarch 1:0.17015-4.el6                base     29 k
 perl-Git                   noarch 1.7.1-3.el6_4.1                base     28 k
 perl-Module-Pluggable      x86_64 1:3.90-136.el6                 base     40 k
 perl-Pod-Escapes           x86_64 1:1.04-136.el6                 base     32 k
 perl-Pod-Simple            x86_64 1:3.13-136.el6                 base    212 k
 perl-URI                   noarch 1.40-2.el6                     base    117 k
 perl-libs                  x86_64 4:5.10.1-136.el6               base    578 k
 perl-version               x86_64 3:0.77-136.el6                 base     51 k
 ppl                        x86_64 0.10.2-11.el6                  base    1.3 M
 python-ethtool             x86_64 0.6-5.el6                      base     31 k
 python-iwlib               x86_64 0.1-1.2.el6                    base     14 k
 rsync                      x86_64 3.0.6-9.el6_4.1                base    334 k
 usermode                   x86_64 1.102-3.el6                    base    187 k
 v8                         x86_64 1:3.14.5.10-8.el6              epel    3.0 M
 wireless-tools             x86_64 1:29-5.1.1.el6                 base     94 k

Transaction Summary
================================================================================
Install      89 Package(s)

Total download size: 79 M
Installed size: 240 M
Is this ok [y/N]:

##3. User account & sudo You may use root or an user account to install Tracks. In practice, using a dedicated user could decrease 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 when 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, restart sshd.

$ sudo  service sshd restart

##4. MySQL database

Start mysqld.

$ 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 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;

##5. Ruby Version Manager (rvm) Validate RVM prerequisite binaries are installed by executing the following as root or with sudo--instructions in section titled Prerequisite packages should have installed the dependencies.

$ 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.

##6. Ruby 1.9 Tracks installation.textile states Tracks version 2.2.2 works best with Ruby 1.9. Verify 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

##7. Bundler Bundler simplifies meeting Tracks' requirements.

$ 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

##8. Phusion Passenger We are using Apache2 as the web server. Phusion Passenger provides painless integration between Apache2 and Tracks. Also, note rake is installed and a requirement to install 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

##9. Tracks 2.2.2

Important! At the time of writing this build, the build of Tracks 2.2.2 or 2.3 development failed. Not surprisingly, github build status was failed. As of June 26, 2014, 2.2.2 github build status read success for 2.2.2. Nonetheless, I am using and would advise, initially, using the 2.2.2 tarball, rev gbc8b817, using the "Get Tracks" link from http://getontracks.org/.

###Unpack

$ tar -xzvf tracks-2.2.2.tar.gz
$ mv tracks-2.2.2 ~/tracks

Review ~/tracks/doc/installation.textile for instructions.

###Gems Install gems using bundler

$ cd ~/tracks/
$ bundle install --without development test
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake 10.0.3
Installing RedCloth 4.2.9
Installing aasm 3.0.16
Installing i18n 0.6.1
Installing multi_json 1.7.0
Installing activesupport 3.2.13
Installing builder 3.0.4
Installing activemodel 3.2.13
Installing erubis 2.7.0
Installing journey 1.0.4
Installing rack 1.4.5
Installing rack-cache 1.2
Installing rack-test 0.6.2
Installing hike 1.2.1
Installing tilt 1.3.6
Installing sprockets 2.2.2
Installing actionpack 3.2.13
Installing mime-types 1.21
Installing polyglot 0.3.3
Installing treetop 1.4.12
Installing mail 2.5.3
Installing actionmailer 3.2.13
Installing arel 3.0.2
Installing tzinfo 0.3.37
Installing activerecord 3.2.13
Installing activeresource 3.2.13
Installing acts_as_list 0.1.9
Installing bcrypt-ruby 3.0.1
Installing bluecloth 2.2.0
Using bundler 1.6.2
Using cache_digests 0.1.0 from source at vendor/gems/cache_digests-0.1.0
Installing coffee-script-source 1.4.0
Installing execjs 1.4.0
Installing coffee-script 2.2.0
Installing rack-ssl 1.3.3
Installing json 1.7.7
Installing rdoc 3.12.2
Installing thor 0.17.0
Installing railties 3.2.13
Installing coffee-rails 3.2.2
Installing formatize 1.1.0
Installing htmlentities 4.3.1
Installing jquery-rails 2.2.1
Installing libv8 3.11.8.17
Installing mysql2 0.3.11
Installing nokogiri 1.5.6
Installing rack-mini-profiler 0.1.23
Installing rails 3.2.13
Installing rails_autolink 1.0.9
Installing ref 1.0.4
Installing sanitize 2.0.3
Installing sass 3.2.5
Installing sass-rails 3.2.6
Installing sqlite3 1.3.7
Installing swf_fu 2.0.3
Installing therubyracer 0.11.4
Installing uglifier 1.3.0
Installing will_paginate 3.0.4
Your bundle is complete!
Gems in the groups development and test were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

###Configuration Copy configuration files.

$ cd ~/tracks/config/
$ cp database.yml.tmpl database.yml
$ cp site.yml.tmpl site.yml

Update 'production' stanza account from root to dbuser and provide password.

$ vi database.yml

Update time zone, salt, secret_token, and email address.

$ vi site.yml

Note: we will be using Apache, but initially, let's use WEBrick for an initial testing.

$ vi environments/production.rb

Update config.serve_static_assets to true.

###Schema Create database schema.

$ cd ~/tracks
$ bundle exec rake db:migrate RAILS_ENV=production
==  CreateTracksDb: migrating =================================================
-- create_table(:contexts)
   -> 0.0257s
-- create_table(:projects)
   -> 0.1128s
-- create_table(:todos)
   -> 0.0044s
-- create_table(:users)
   -> 0.0033s
==  CreateTracksDb: migrated (0.1465s) ========================================

==  AddUserId: migrating ======================================================
-- add_column(:contexts, :user_id, :integer, {:default=>1})
   -> 0.0090s

... so much more ...

==  CreateTolkTables: migrating ===============================================
-- create_table(:tolk_locales)
   -> 0.0030s
-- add_index(:tolk_locales, :name, {:unique=>true})
   -> 0.0077s
-- create_table(:tolk_phrases)
   -> 0.0250s
-- create_table(:tolk_translations)
   -> 0.0049s
-- add_index(:tolk_translations, [:phrase_id, :locale_id], {:unique=>true})
   -> 0.0079s
==  CreateTolkTables: migrated (0.0488s) ======================================

==  NoDefaultAdminEmail: migrating ============================================
-- remove_column(:preferences, :admin_email)
   -> 0.0194s
==  NoDefaultAdminEmail: migrated (0.0195s) ===================================

###Precompile Assets

$ cd ~/tracks
$ bundle exec rake assets:precompile
/home/tracks/.rvm/rubies/ruby-1.9.3-p547/bin/ruby /home/tracks/.rvm/gems/ruby-1.9.3-p547/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets

###WEBrick Open firewall for Tracks using WEBrick on port 3000 TCP.

$ sudo system-config-firewall-tui

To review iptables policies, execute the following:

$ sudo service iptables status

###Start the Server (test)

$ cd ~/tracks
$ bundle exec rails server -e production
=> Booting WEBrick
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-05-31 14:19:21] INFO  WEBrick 1.3.1
[2014-05-31 14:19:21] INFO  ruby 1.9.3 (2014-05-14) [x86_64-linux]
[2014-05-31 14:19:21] INFO  WEBrick::HTTPServer#start: pid=3521 port=3000

###Success? If the server failed to start, review logs and/or the instructions above. If the server started successfully, open and point a browser to the Tracks host using port 3000, i.e. http://trackshost.mydomain.com:3000, to verify a web page is displayed that prompts for the creation of an admin user account and password. When done, ctrl+c to shutdown Tracks and continue the installation.

##10. Apache2 Update the tracks user directory in preparation for passenger.

$ sudo chmod o+x /home/tracks

###Install Passenger Module

$ passenger-install-apache2-module
	Welcome to the Phusion Passenger Apache 2 module installer, v4.0.44.

	This installer will guide you through the entire installation process. It
	shouldn't take more than 3 minutes in total.

	Here's what you can expect from the installation process:

	 1. The Apache 2 module will be installed for you.
	 2. You'll learn how to configure Apache.
	 3. You'll learn how to deploy a Ruby on Rails application.

	Don't worry if anything goes wrong. This installer will advise you on how to
	solve any problems.

If you have met the requirements, everything should be green. Accept the defaults to compile which takes quite some time. The installation should complete with the following.

	--------------------------------------------
	Almost there!

	Please edit your Apache configuration file, and add these lines:

	   LoadModule passenger_module /home/tracks/.rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so
	   <IfModule mod_passenger.c>
		 PassengerRoot /home/tracks/.rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.44
		 PassengerDefaultRuby /home/tracks/.rvm/gems/ruby-1.9.3-p547/wrappers/ruby
	   </IfModule>

	After you restart Apache, you are ready to deploy any number of web
	applications on Apache, with a minimum amount of configuration!

	Press ENTER to continue.

	--------------------------------------------

	Deploying a web application: an example

	Suppose you have a web application in /somewhere. Add a virtual host to your
	Apache configuration file and set its DocumentRoot to /somewhere/public:

	   <VirtualHost *:80>
		  ServerName www.yourhost.com
		  # !!! Be sure to point DocumentRoot to 'public'!
		  DocumentRoot /somewhere/public
		  <Directory /somewhere/public>
			 # This relaxes Apache security settings.
			 AllowOverride all
			 # MultiViews must be turned off.
			 Options -MultiViews
			 # Uncomment this if you're on Apache >= 2.4:
			 #Require all granted
		  </Directory>
	   </VirtualHost>

	And that's it! You may also want to check the Users Guide for security and
	optimization tips, troubleshooting and other useful information:

	  /home/tracks/.rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.44/doc/Users guide Apache.html
	  http://www.modrails.com/documentation/Users%20guide%20Apache.html

	Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
	https://www.phusionpassenger.com

	Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

Create Passenger module conf file and copy and paste.

$ sudo vi /etc/httpd/conf.d/passenger.conf

Copy and paste the following:

LoadModule passenger_module /home/tracks/.rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
 PassengerRoot /home/tracks/.rvm/gems/ruby-1.9.3-p547/gems/passenger-4.0.44
 PassengerDefaultRuby /home/tracks/.rvm/gems/ruby-1.9.3-p547/wrappers/ruby
 PassengerDefaultUser apache
</IfModule>

###Static Assets Update Tracks' production.rb static assets to false in preparation for using Passenger with Apache2.

$ vi ~/tracks/config/environments/production.rb

config.serve_static_assets = false

###Apache2 configuration Update apache2 configuration file.

$ sudo cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
$ sudo vi /etc/httpd/conf/httpd.conf

At the bottom of the file, add the following:

<VirtualHost *:80>
  ServerName www.somedomain.com
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /home/tracks/tracks/public
  <Directory /home/tracks/tracks/public>
	 # This relaxes Apache security settings.
	 AllowOverride all
	 # MultiViews must be turned off.
	 Options -MultiViews
	 # Uncomment this if you're on Apache >= 2.4:
	 #Require all granted
  </Directory>
</VirtualHost>

###SELinux Configure SELinux to use permissive mode due to Phusion Passenger is going to be blocked by SELinux. Use permissive versus diabled to log passenger activities.

$ sudo vi /etc/selinux/config

Then for this session set SELinux to be permissive or reboot.

$ sudo setenforce 0

Once Tracks installation is complete and been in use for a while, you can create a SELinux module. See the section titled "SELinux Passenger module" below for instructions.

###Firewall & Apache2 Open firewall for Apache by 'customizing' and permitting http or web traffic (80 TCP). You may, also, remove the previous rule for port 3000 TCP.

$ sudo system-config-firewall-tui

Verify changes using:

$ sudo service iptables status

Validate Apache operations by starting the httpd service then using a browser, verify, you are prompted to set admin credentials for Tracks.

$ sudo service httpd start

###Apache at startup Configure Apache to start at boot.

$ sudo chkconfig httpd on

Update config.serve_static_assets variable to false for we are no longer using WEBrick.

$ vi environments/production.rb

##11. Done(?) At this point you are ready to begin using Tracks.

The basic process is as follows: Create contexts, i.e. work, home, gym, etc. Create projects and specify context. Create actons specifying context and project.

Alternatively, You can simply create an action specifying a new context and new project. Tracks will auto-create them. For example, create an action to 'replace toilet seal' and specify context 'home' and project 'bathroom remodel.'

;) Enjoy!

#Other Considerations

##SELinux Passenger module The process that follows can be used for creating security modules for SELinux. Alternatively, you can disable SELinux, but that would be unwise.

SELinux must be set to permissive mode versus disabled to captures events to logs. Either update \etc\selinux\config` as decribed above or execute setenforce.

$ sudo setenforce 0

Restart Apache

$ sudo service httpd restart

Start using your rails application, Tracks.

Later, walk through SELinux's log and generate new SELinux policy module.

$ sudo grep httpd /var/log/audit/audit.log | audit2allow -M passenger

Install newly created SELinux module

$ sudo semodule -i passenger.pp

Set SELinux to enforcing mode. Update /etc/selinux/config or execute setenforce as appropriate.

$ sudo setenforce 1

##Phusion Passenger, Rails, & Sub-URIs In the course of using ruby, rails, and passenger, you may need to create multiple sites or apps not just one. Using Passenger sub-uris will accomplish this task. In addition, when using Nginx (see below), using a sub-uri simplifies configuration and reduces hours of banging your head on your desk.

With Tracks, update the site.yml to use a subdir, then update Apache's configuration to reflect the virtual host shown below. So for www.somedomain.com we will use subdir tracks which result with http://www.somedomain.com/tracks.

Remove the comment '#' and update to read subdir: "/tracks"

$ vi /home/tracks/tracks/config/site.yml

Update the apache2's httpd.conf, existing virtual host stanza, to read as follows:

$ sudo vi /etc/httpd/conf/httpd.conf 

<VirtualHost *:80>
  ServerName trk.harmonson.net
  DocumentRoot /home/tracks/tracks/public

Alias /tracks /home/tracks/tracks/public

  <Location /tracks>
		PassengerBaseURI /tracks
		PassengerAppRoot /home/tracks/tracks
  </Location>

  <Directory /home/tracks/tracks/public>
		 Allow from all
		 # This relaxes Apache security settings.
		 AllowOverride all
		 # MultiViews must be turned off.
		 Options -MultiViews
		 # Uncomment this if you're on Apache >= 2.4:
		 #Require all granted
  </Directory>

</VirtualHost>

Restart Apache for changes to take effect.

$ sudo service httpd restart

##Nginx reverse proxy Nginx is a very efficient web service which I use as a reverse proxy. Below is an example of a working Nginx 1.4 location config using the Tracks build above and sub-uri /tracks. This is only the Nginx /location stanza not a complete nginx.conf configuration file.

### Tracks
location /tracks/ {
		auth_basic "off";

## Set Headers
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto https;

## Tracks Backend
		proxy_pass http://192.168.1.111/tracks/;
		proxy_redirect off;
}
Clone this wiki locally