Development:Setup:Linux:RHEL: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(50 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Prerequisites==
* You must have shell access
* You must have root access (via sudo), or the required software must already be installed
==Install Git==
==Install Git==
<pre>sudo yum install git</pre>
<pre style="white-space:normal;">sudo yum install git</pre>
==Get Expertiza==
==Get Expertiza==
===Expertiza Repository URLs===
====Expertiza Repository URLs====
* (ssh, read/write) git@github.com:expertiza/expertiza.git
* (ssh, read/write) git@github.com:expertiza/expertiza.git
* (https, read/write) https://github.com/expertiza/expertiza.git
* (https, read/write) https://github.com/expertiza/expertiza.git
* (git, read-only) git://github.com/expertiza/expertiza.git
* (git, read-only) git://github.com/expertiza/expertiza.git
===Default===
====Default====
<pre>git clone <remote></pre>
<pre style="white-space:normal;">git clone <remote></pre>
<pre>git clone git@github.com:expertiza/expertiza.git</pre>
<pre style="white-space:normal;">git clone git@github.com:expertiza/expertiza.git</pre>
===Options===
====Options====
<pre>git clone -b <branch> <remote></pre>
<pre style="white-space:normal;">git clone -b <branch> <remote></pre>
<pre>git clone -b production git@github.com:expertiza/expertiza.git</pre>
<pre style="white-space:normal;">git clone -b production git@github.com:expertiza/expertiza.git</pre>
 
==Install RVM==
[https://rvm.io/rvm/install/ RVM Install]
====Single User Mode (Recommended)====
<pre style="white-space:normal;">\curl -L https://get.rvm.io | bash -s stable</pre>
=====Load RVM as a Function=====
<pre style="white-space:normal;">source ~/.rvm/bin/rvm</pre>
 
====Multi User Mode====
<pre style="white-space:normal;">\curl -L https://get.rvm.io | sudo bash -s stable</pre>
=====Load RVM as a Function=====
<pre style="white-space:normal;">source /etc/profile</pre>
 
====Post-Installation====
=====Is RVM a Function?=====
<pre style="white-space:normal;">$ type rvm | head -1
rvm is a shell function</pre>
If not, try loading RVM as a function again. If it is still not a function, try reinstalling RVM.
 
=====Make sure all the dependencies are met for RVM=====
<pre style="white-space:normal;">rvm requirements</pre>
This will show a yum command. Run it to install the dependancies for Ruby.
For example:
<pre style="white-space:normal;">sudo yum install -y 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</pre>
 
==Install Ruby v. 1.8.7==
<pre style="white-space:normal;">rvm install 1.8.7</pre>
<pre style="white-space:normal;">rvm use 1.8.7</pre>
 
==Create Expertiza Gemset (optional)==
<pre style="white-space:normal;">rvm use 1.8.7</pre>
<pre style="white-space:normal;">rvm gemset create expertiza</pre>
<pre style="white-space:normal;">rvm use 1.8.7@expertiza</pre>
====Create a .rvmrc File (optional)====
<pre style="white-space:normal;">echo 'rvm use 1.8.7@expertiza' > .rvmrc</pre>
 
==Install Native Expertiza Dependencies==
Dependencies are for the gems raspell, rjb, nokogiri, and mysql.
<pre style="white-space:normal;">sudo yum install aspell-devel java-devel gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel mysql-devel mysql-server graphviz sqlite-devel</pre>
 
==Install Bundled Gems==
Set JAVA_HOME for the rjb gem:
<pre style="white-space:normal;">export JAVA_HOME=/etc/alternatives/java_sdk</pre>
<pre style="white-space:normal;">bundle install</pre>
 
==Set Up the Database==
====Enable and Start the MySql Daemon====
<pre style="white-space:normal;">sudo service mysqld enable</pre>
<pre style="white-space:normal;">sudo service mysqld start</pre>
====Set the MySql Root Password====
<pre style="white-space:normal;">mysqladmin -u root password</pre>
====Log in to MySql====
<pre style="white-space:normal;">mysql -uroot -p</pre>
The following commands are executed inside mysql
====Create the Expertiza User====
<pre style="white-space:normal;">create user expertiza@localhost;</pre>
 
====Create the Databases====
<pre style="white-space:normal;">create database pg_development;</pre>
<pre style="white-space:normal;">create database pg_test;</pre>
====Grant Privileges to the Expertiza User====
<pre style="white-space:normal;">grant all on pg_development.* to expertiza@localhost;</pre>
<pre style="white-space:normal;">grant all on pg_test.* to expertiza@localhost;</pre>
 
==Build the Expertiza Database==
<pre style="white-space:normal;">rake db:migrate</pre>
<pre style="white-space:normal;">rake db:test:prepare</pre>
====Import Production Data (Optional)====
This step requires that you have your ssh private/public key pairs loaded in the production server under the rails user.<br />
[[How to Add SSH Keys to the Expertiza Production Server]] <br />
You must run the following command from your local Expertiza project directory.
<pre style="white-space:normal;">cap load_production_data</pre>

Latest revision as of 18:06, 4 October 2014

Prerequisites

  • You must have shell access
  • You must have root access (via sudo), or the required software must already be installed

Install Git

sudo yum install git

Get Expertiza

Expertiza Repository URLs

Default

git clone <remote>
git clone git@github.com:expertiza/expertiza.git

Options

git clone -b <branch> <remote>
git clone -b production git@github.com:expertiza/expertiza.git

Install RVM

RVM Install

Single User Mode (Recommended)

\curl -L https://get.rvm.io | bash -s stable
Load RVM as a Function
source ~/.rvm/bin/rvm

Multi User Mode

\curl -L https://get.rvm.io | sudo bash -s stable
Load RVM as a Function
source /etc/profile

Post-Installation

Is RVM a Function?
$ type rvm | head -1
rvm is a shell function

If not, try loading RVM as a function again. If it is still not a function, try reinstalling RVM.

Make sure all the dependencies are met for RVM
rvm requirements

This will show a yum command. Run it to install the dependancies for Ruby. For example:

sudo yum install -y 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

Install Ruby v. 1.8.7

rvm install 1.8.7
rvm use 1.8.7

Create Expertiza Gemset (optional)

rvm use 1.8.7
rvm gemset create expertiza
rvm use 1.8.7@expertiza

Create a .rvmrc File (optional)

echo 'rvm use 1.8.7@expertiza' > .rvmrc

Install Native Expertiza Dependencies

Dependencies are for the gems raspell, rjb, nokogiri, and mysql.

sudo yum install aspell-devel java-devel gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel mysql-devel mysql-server graphviz sqlite-devel

Install Bundled Gems

Set JAVA_HOME for the rjb gem:

export JAVA_HOME=/etc/alternatives/java_sdk
bundle install

Set Up the Database

Enable and Start the MySql Daemon

sudo service mysqld enable
sudo service mysqld start

Set the MySql Root Password

mysqladmin -u root password

Log in to MySql

mysql -uroot -p

The following commands are executed inside mysql

Create the Expertiza User

create user expertiza@localhost;

Create the Databases

create database pg_development;
create database pg_test;

Grant Privileges to the Expertiza User

grant all on pg_development.* to expertiza@localhost;
grant all on pg_test.* to expertiza@localhost;

Build the Expertiza Database

rake db:migrate
rake db:test:prepare

Import Production Data (Optional)

This step requires that you have your ssh private/public key pairs loaded in the production server under the rails user.
How to Add SSH Keys to the Expertiza Production Server
You must run the following command from your local Expertiza project directory.

cap load_production_data