redmine-sei.tex 5.89 KB
\section{Redmine}
\label{redmine}

\subsection{Instalação do Epel}

\fbox{\parbox{\textwidth}{
\texttt{
rpm -Uvh http://fedora.uib.no/epel/6/x86\_64/epel-release-6-8.noarch.rpm
}}}

\subsection{Instalação de pacotes}
\fbox{\parbox{\textwidth}{
\texttt{sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel \textbackslash
\\
apr-util-devel subversion  git postgresql-devel wget vim} 
}}

\subsection{Instalação Postgresql}

\fbox{\parbox{\textwidth}{
\texttt{
\scriptsize{
sudo yum localinstall http://yum.postgresql.org/9.3/redhat/rhel-6-x86\_64/pgdg-centos93-9.3-1.noarch.rpm -y
\\
sudo yum install postgresql93 postgresql93-devel postgresql93-libs postgresql93-server -y
}}}}

\subsubsection{Reiniciar Postgresql}

\fbox{\parbox{\textwidth}{
\texttt{
sudo /etc/init.d/postgresql-9.3 initdb
\\
sudo /etc/init.d/postgresql-9.3 restart
}}}

\subsubsection{Modificar senha do Postgres}

%Corrigindo aspas
\fbox{\parbox{\textwidth}{
\texttt{sudo -u postgres psql template1 -c \textbackslash 
\\
"ALTER USER postgres with encrypted password 'postgres';"
}}}

\subsubsection{Configurando o Postgres}

\fbox{\parbox{\textwidth}{
\texttt{
sudo vim /var/lib/pgsql/9.3/data/postgresql.conf
\\
descomentar: \# listen\_addresses = 'localhost'
}}}


\subsubsection{Usar a permissão certa de usuário do Redmine no banco de dados do Redmine}

\fbox{\parbox{\textwidth}{
\texttt{sudo vim /var/lib/pgsql/9.3/data/pg\_hba.conf}}}

O arquivo deve ficar desta forma:

%Atualizando permissão dos usuários
\fbox{\parbox{\textwidth}{
\texttt{
\# TYPE  DATABASE        USER            ADDRESS                 METHOD
\\
\# local is for Unix domain socket connections only
\\
local   all             redmine                                   md5
\\
local   all               all                                     peer
\\
\# IPv4 local connections:
\\
host    all             redmine        127.0.0.1/32               md5
\\
host    all               all          127.0.0.1/32              ident
\\
\# IPv6 local connections:
\\
host    all            redmine           ::1/128                  md5
\\
host    all               all            ::1/128                 ident
}}}

\subsubsection{Reiniciar Postgresql}

\fbox{\parbox{\textwidth}{
\texttt{sudo /etc/init.d/postgresql-9.3 restart}}}

\subsection{Instalar Requisitos das Gems}

\fbox{\parbox{\textwidth}{
\texttt{
sudo yum install gcc gcc-c++.x86\_64 make automake autoconf curl-devel \textbackslash
\\
openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel \textbackslash
\\
sqlite-devel ruby-rdoc ruby-devel rubygems libxslt-devel libxml2-devel.x86\_64 -y}}}

\subsection{Atualizar para a Gem 1.4.2}

\fbox{\parbox{\textwidth}{
\texttt{
wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz
\\
tar zxvf rubygems-1.4.2.tgz
\\
cd rubygems-1.4.2
\\
ruby setup.rb
\\
gem -v
}}}


\subsection{Instalar ImageMagick}

\fbox{\parbox{\textwidth}{
\texttt{
sudo yum install php-pear ImageMagick ImageMagick-devel ImageMagick-perl -y
}}}

\subsection{Instalar Gem Bundle}

\fbox{\parbox{\textwidth}{
\texttt{
sudo gem install bundle -\--no-ri -\--no-rdoc
}}}

\subsection{Instalar Redmine 2.5.1}

\fbox{\parbox{\textwidth}{
\texttt{
cd /opt
\\
svn co http://svn.redmine.org/redmine/branches/2.5-stable redmine
\\
sudo mkdir -p tmp/pdf public/plugin\_assets
}}}

\subsection{Instalar requisitos da Gem}

\fbox{\parbox{\textwidth}{
\texttt{
cd /opt/redmine
\\
bundle install --without mysql sqlite
}}}


\subsection{Configurar postgresql}

\fbox{\parbox{\textwidth}{
\texttt{
sudo -u postgres psql 
}}}

Execute:

%Corrigindo 
\fbox{\parbox{\textwidth}{
\texttt{
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity'; 
\\
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
\\
\textbackslash q
}}}


\subsection{Instalando Gems}

\fbox{\parbox{\textwidth}{
\texttt{
sudo gem install pg -v '0.17.1' -\--no-ri -\--no-rdoc
\\
sudo gem install unicorn -\--no-ri -\--no-rdoc
}}}


\subsection{Configurar database.yml na pasta do Redmine}


\fbox{\parbox{\textwidth}{
\texttt{
cd config
\\
mv database.yml.example database.yml
\\
vim database.yml
}}}

Comentar todas as linhas e descomentar estas baixo: 

\fbox{\parbox{\textwidth}{
\texttt{
production:
\\
adapter: postgresql
\\
database: redmine
\\
host: <ip-banco-de-dados>
\\
username: redmine
\\
password: redmine
\\
encoding: utf8
}}}


\subsection{Popular Redmine}


\fbox{\parbox{\textwidth}{
\texttt{
rake generate\_secret\_token RAILS\_ENV=production
\\
rake db:migrate RAILS\_ENV=production
\\
rake redmine:load\_default\_data RAILS\_ENV=production 
\\
(\emph{escolher pt-BR})
}}}


\subsection{Configurar Unicorn}


\fbox{\parbox{\textwidth}{
\texttt{
cd /opt/redmine
\\
mkdir pids
\\
vim config/unicorn.rb
}}}

Copie as linhas abaixo para unicorn.rb:

\fbox{\parbox{\textwidth}{
\texttt{
\#------------------------------------
\\
\# Set the working application directory
\\
\# working\_directory ``/path/to/your/app''
\\
working\_directory ``/opt/redmine''
\\
\# Unicorn PID file location
\\
\# pid ``/path/to/pids/unicorn.pid''
\\
pid ``/opt/redmine/pids/unicorn.pid''
\\
\# Path to logs
\\
\# stderr\_path ``/path/to/log/unicorn.log''
\\
\# stdout\_path ``/path/to/log/unicorn.log''
\\
stderr\_path ``/opt/redmine/log/unicorn.log''
\\
stdout\_path ``/opt/redmine/log/unicorn.log''
\\
\# Unicorn socket
\\
\#listen ``/tmp/unicorn.redmine.sock''
\\
listen ``/tmp/unicorn.redmine.sock''
\\
\# Number of processes
\\
\# worker\_processes 4
\\
worker\_processes 2
\\
\# Time-out
\\
timeout 30
\\
\#-------------------------------------
}}}


\subsection{Reiniciar Postgresql}

\fbox{\parbox{\textwidth}{
\texttt{
sudo /etc/init.d/postgresql-9.3 restart
}}}


\subsection{Rodar Redmine usando Unicorn}

\fbox{\parbox{\textwidth}{
\texttt{
\small{sudo unicorn\_rails -c /opt/redmine/config/unicorn.rb -E production -l
0.0.0.0:80 -D}
\\
(\emph{subir na porta 80 porque está em uma máquina diferente do GitLab.
       O padrão do Redmine é a porta 3000.})
}}}