Development:Setup:Linux:Debian: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Updating Ruby version from 2.1.5 to 2.3.1 (version used in production))
 
(14 intermediate revisions by 3 users not shown)
Line 16: Line 16:
<pre style="white-space:normal;">git clone -b <branch> <remote></pre>
<pre style="white-space:normal;">git clone -b <branch> <remote></pre>
<pre style="white-space:normal;">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>
====To Rename the Central Remote====
<pre style="white-space:normal;">git remote rename <current_name> <desired_name></pre>
<pre style="white-space:normal;">git remote rename origin upstream</pre>


==Install RVM==
==Install RVM==
Line 22: Line 25:
<pre style="white-space:normal;">\curl -L https://get.rvm.io | bash -s stable</pre>
<pre style="white-space:normal;">\curl -L https://get.rvm.io | bash -s stable</pre>
=====Load RVM as a Function=====
=====Load RVM as a Function=====
<pre style="white-space:normal;">source ~/.rvm/bin/rvm</pre>
<pre style="white-space:normal;">source ~/.rvm/scripts/rvm</pre>


====Multi User Mode====
====Multi User Mode (Not Recommended)====
<pre style="white-space:normal;">\curl -L https://get.rvm.io | sudo bash -s stable</pre>
<pre style="white-space:normal;">\curl -L https://get.rvm.io | sudo bash -s stable</pre>
=====Load RVM as a Function=====
=====Load RVM as a Function=====
Line 39: Line 42:
This will show a yum command. Run it to install the dependancies for Ruby.
This will show a yum command. Run it to install the dependancies for Ruby.
For example:
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</pre>
<pre style="white-space:normal;">sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev</pre>


==Install Ruby v. 1.8.7==
==Install Ruby v. 2.3.1==
<pre style="white-space:normal;">rvm install 1.8.7</pre>
<pre style="white-space:normal;">rvm install 2.3.1</pre>
<pre style="white-space:normal;">rvm use 1.8.7</pre>
<pre style="white-space:normal;">rvm use 2.3.1</pre>


==Create Expertiza Gemset (optional)==
==Create Expertiza Gemset (optional)==
<pre style="white-space:normal;">rvm use 1.8.7</pre>
<pre style="white-space:normal;">rvm use 2.3.1</pre>
<pre style="white-space:normal;">rvm gemset create expertiza</pre>
<pre style="white-space:normal;">rvm gemset create expertiza</pre>
<pre style="white-space:normal;">rvm use 1.8.7@expertiza</pre>
<pre style="white-space:normal;">rvm use 2.3.1@expertiza</pre>
====Create a .rvmrc File (optional)====
====Create a .rvmrc File (optional)====
<pre style="white-space:normal;">echo 'rvm use 1.8.7@expertiza' > .rvmrc</pre>
<pre style="white-space:normal;">echo 'rvm use 2.3.1@expertiza' > .rvmrc</pre>


==Install Native Expertiza Dependencies==
==Install Native Expertiza Dependencies==
Dependencies are for the gems raspell, rjb, nokogiri, and mysql.
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</pre>
You may be prompted multiple times to set a root password for mysql. This password is up to you, but it can be left blank.
<pre style="white-space:normal;">sudo apt-get install openjdk-6-jre-headless openjdk-6-source mysql-client mysql-server libmysqlclient-dev libaspell-dev libpq-dev</pre>


==Install Bundled Gems==
==Install Bundled Gems==
Set JAVA_HOME for the rjb gem:
Set JAVA_HOME for the rjb gem:
<pre style="white-space:normal;">export JAVA_HOME=/etc/alternatives/java_sdk</pre>
Your path may be different. You can generally find out the path by looking at the symbolic link at /etc/alternatives/java
<pre style="white-space:normal;">ls -la /etc/alternatives/java</pre>
This outputs something like '/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java'. Only part of this path may need to be set to JAVA_HOME. In this instance, it is '/usr/lib/jvm/java-6-openjdk-amd64'.
<pre style="white-space:normal;">export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64</pre>
<pre style="white-space:normal;">bundle install</pre>
<pre style="white-space:normal;">bundle install</pre>
==Setup Redis==
Please install redis on your machine and then run redis-server command.
These commands will help you run redis easily:
$ wget http://download.redis.io/releases/redis-4.0.1.tar.gz
$ tar xzf redis-4.0.1.tar.gz
$ cd redis-4.0.1
$ make
$ src/redis-server


==Set Up the Database==
==Set Up the Database==
Line 67: Line 83:
====Set the MySql Root Password====
====Set the MySql Root Password====
<pre style="white-space:normal;">mysqladmin -u root password</pre>
<pre style="white-space:normal;">mysqladmin -u root password</pre>
===Automatic Configuration===
<pre style="white-space:normal;">mysql -uroot < db/grant_expertiza.sql</pre>
===Manual Configuration===
====Log in to MySql====
====Log in to MySql====
<pre style="white-space:normal;">mysql -uroot -p</pre>
<pre style="white-space:normal;">mysql -uroot -p</pre>

Latest revision as of 20:24, 6 November 2022

Prerequisites

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

Install Git

sudo apt-get install git curl

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

To Rename the Central Remote

git remote rename <current_name> <desired_name>
git remote rename origin upstream

Install RVM

RVM Install

Single User Mode (Recommended)

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

Multi User Mode (Not Recommended)

\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 apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev

Install Ruby v. 2.3.1

rvm install 2.3.1
rvm use 2.3.1

Create Expertiza Gemset (optional)

rvm use 2.3.1
rvm gemset create expertiza
rvm use 2.3.1@expertiza

Create a .rvmrc File (optional)

echo 'rvm use 2.3.1@expertiza' > .rvmrc

Install Native Expertiza Dependencies

Dependencies are for the gems raspell, rjb, nokogiri, and mysql. You may be prompted multiple times to set a root password for mysql. This password is up to you, but it can be left blank.

sudo apt-get install openjdk-6-jre-headless openjdk-6-source mysql-client mysql-server libmysqlclient-dev libaspell-dev libpq-dev

Install Bundled Gems

Set JAVA_HOME for the rjb gem: Your path may be different. You can generally find out the path by looking at the symbolic link at /etc/alternatives/java

ls -la /etc/alternatives/java

This outputs something like '/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java'. Only part of this path may need to be set to JAVA_HOME. In this instance, it is '/usr/lib/jvm/java-6-openjdk-amd64'.

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
bundle install

Setup Redis

Please install redis on your machine and then run redis-server command. These commands will help you run redis easily: $ wget http://download.redis.io/releases/redis-4.0.1.tar.gz $ tar xzf redis-4.0.1.tar.gz $ cd redis-4.0.1 $ make $ src/redis-server

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

Automatic Configuration

mysql -uroot < db/grant_expertiza.sql

Manual Configuration

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