Content
This tutorial helps you to deploy OP3. Please, aware that:
- it`s primarily for testing purposes and may contain some security misconfiguration, so consider deploying outside of your local network.
- there is only 1 requirement you have to meet, that you have to have clean Centos 6.5 x64 install (from netinstall image, minimal installation)
- I`m using production environment for OP3
- I`m using PostgreSQL 9.3 from official Postgresql repo (install guide icluded)
- There should be some unnecessary packages that I`m installing in this tutorial, but this is just Copy&Paste tutorial to deploy OP3 in few minutes, so excuse it please :)
- If you find any bugs or you have any recommendations for improving this tutorial, please, feel free to send me comment.
1. Prepare you environment
Update your system
[root@centos]# yum update
Install tools needed for DB and Ruby
[root@centos]# yum install git wget [root@centos]# yum groupinstall "Development tools"
Install some handy tools
[root@centos]# yum install vim mlocate
Create dedicated user for OP3
[root@centos]# groupadd openproject
[root@centos]# useradd --create-home --gid openproject openproject
[root@centos]# passwd openproject (enter desired password)
2. Install Database (PostreSQL 9.3)
Edit .repo file and add this line:
exclude=postgresql*
to the section and :
[root@centos]# vim /etc/yum.repos.d/CentOS-Base.repo
- press INSERT key to enter editing mode and write the following string into 2 sections
- press ESCAPE key to exit editing mode
- press “:wq” and press ENTER to save editing and exit VIM
- so updated repo sections should look like this:
[base] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 exclude=postgresql* #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 exclude=postgresql*
Then finish PostgreSQL installation
[root@centos]# curl -O http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm [root@centos]# rpm -ivh pgdg-centos93-9.3-1.noarch.rpm [root@centos]# yum list postgres* [root@centos]# yum install postgresql93-server postgresql93-devel [root@centos]# service postgresql-9.3 initdb [root@centos]# chkconfig postgresql-9.3 on
Add usermap of your user under which you have installed OP (“openproject” in my case) and PostgreSQL user that has granted rights to the DB.
Edit pg_ident.conf file and add this line at the end of file. This will add UserMap with name “openproject” to linux user “openproject” to DB user “openproject”:
openproject openproject openproject [root@centos]# vim /var/lib/pgsql/9.3/data/pg_ident.conf
Uncomment this line in postgresql.conf file to allow connection to localhost of PostgreSQL service:
listen_addresses = ‘localhost’
[root@centos]# vim /var/lib/pgsql/9.3/data/postgresql.conf
Restart PostgreSQL service
[root@centos]# service postgresql-9.3 restart
Now create databases
[root@centos]# su - postgres -bash-4.1$ psql -U postgres
Replace string “openproject” with desired username in PostgreSQL database and “my_password” with desired password (in my case both are “openproject”)
postgres=# CREATE ROLE openproject LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity'; postgres=# CREATE DATABASE openproject WITH ENCODING='UTF8' OWNER=openproject;
postgres=# CREATE DATABASE openproject_development WITH ENCODING='UTF8' OWNER=openproject;
postgres=# CREATE DATABASE openproject_test WITH ENCODING='UTF8' OWNER=openproject; postgres=# \q postgres=# exit
3. Install Ruby
Enable ELrepo
[root@centos]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@centos]# rpm -Uvh epel-release-6*.rpm
[root@centos]# yum update
Install necessary packages for Ruby
[root@centos]# yum search libyaml [root@centos]# yum install libyaml libxml2 libxml2-devel libxslt-devel libxml2-devel ruby-mysql mysql-devel ImageMagick-c++ ImageMagick-devel graphviz graphviz-ruby graphviz-devel memcached sqlite-devel
Switch to user under which will OP run (user “openproject” in my case):
[root@centos]# su openproject -c "bash -l"
Switch to users home dir or whatever directory you want to install openproject
[openproject@centos]# cd ~
Add following line into profile file of the desired user:
source ~/.profile
[openproject@centos]# vim /home/openproject/.bash_profile
Install RVM (Ruby Version Manager)
[openproject@centos]# \curl -L https://get.rvm.io | bash -s stable
[openproject@centos]# source $HOME/.rvm/scripts/rvm
Install Ruby via RVM
[openproject@centos]# rvm autolibs disable
[openproject@centos]# rvm install 2.1.0
[openproject@centos]# gem install bundler
Make sure that
bundle —version
is 1.5.1
or higher. If not, update the bundler gem.
4. Install OpenProject
[openproject@centos]# git clone https://github.com/opf/openproject.git [openproject@centos]# cd openproject [openproject@centos]# git checkout stable [openproject@centos]# bundle install
Fix appeared error by:
[openproject@centos]# gem install pg -v '0.17.1' -- --with-pg-config=/usr/pgsql-9.3/bin/pg_config [openproject@centos]# bundle install
5. Configure OpenProject
Please, be aware that database configuration file and configuration file are “ident-sensitive” and consistence of these files are crutial to have working environment (email notifications, database connections, etc.
*Create and configure file in ../openproject/config/database.yml.
It should look like this:*
production: adapter: postgresql encoding: utf8 database: openproject pool: 5 username: openproject password: openproject development: adapter: postgresql encoding: utf8 database: openproject_development pool: 5 username: openproject password: openproject test: adapter: postgresql encoding: utf8 database: openproject_test pool: 5 username: openproject password: openproject
Configure email notifications (using gmail account) by creating configuration.yml in openproject/config directory
development: #main level email_delivery_method: :smtp #main level, will not work default: #main level email_delivery_method: :smtp #setting for default smtp_address: smtp.gmail.com #setting for default smtp_port: 587 smtp_domain: smtp.gmail.com smtp_user_name: ***@gmail.com smtp_password: **** smtp_enable_starttls_auto: true smtp_authentication: plain
Install plugins (Optional)
Create Gemfile.plugins file in openproject directory and paste these files:
Please aware, that all of the plugins are currently in beta state, so after final release, the installation could be different. Consider this step and if you don’t want to install plugins, just skip this step and go to “Finish installation of OpenProject”
gem "pdf-inspector", "~>1.0.0", :group => :test gem "openproject-meeting", :git => "https://github.com/finnlabs/openproject-meeting.git", :branch => "stable" gem "openproject-pdf_export", git: "https://github.com/finnlabs/openproject-pdf_export.git", :branch => "stable" gem "openproject-plugins", git: "https://github.com/opf/openproject-plugins.git", :branch => "stable" gem "openproject-backlogs", git: "https://github.com/finnlabs/openproject-backlogs.git", :branch => "stable"
Finish installation of OpenProject
[openproject@centos]# cd /home/openproject/openproject [openproject@centos]# bundle exec rake db:create:all [openproject@centos]# bundle exec rake db:migrate [openproject@centos]# RAILS_ENV="production" bundle exec rake db:seed
[openproject@centos]# bundle exec rake generate_secret_token
[openproject@centos]# RAILS_ENV="production" bundle exec rake db:migrate
Precompile OpenProjects assets
[openproject@centos]# RAILS_ENV="production" bundle exec rake assets:precompile
Install Apache with Passenger to autostart OpenProject with OS and loadbalance traffic
Install necessary packages
[root@centos]# yum install httpd curl-devel httpd-devel apr-devel apr-util-devel
Grant permission for passenger
[root@centos]# chmod o+x "/home/openproject" [root@centos]# su - openproject -c "bash -l"
Install Passenger gem
[openproject@centos]# gem install passenger
Compile Passenger for Apache and follow instructions for pasting settings to httpd and virtualhost
Just install it with default values and read statements if there are any errors :)
[openproject@centos]# passenger-install-apache2-module
Add this lines to /etc/httpd/conf/httpd.conf:
LoadModule passenger_module /home/openproject/.rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /home/openproject/.rvm/gems/ruby-2.1.0/gems/passenger-4.0.37 PassengerDefaultRuby /home/openproject/.rvm/gems/ruby-2.1.0/wrappers/ruby </IfModule>
Create VirtualHost file for Apache:
[root@centos]# vim /etc/httpd/conf.d/openproject.conf
Paste these lines into it:
<VirtualHost *:80> ServerName www.myopenprojectsite.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /home/openproject/openproject/public <Directory /home/openproject/openproject/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews </Directory> </VirtualHost>
Finally disable temporarly SELINUX and iptables to be able to access your apache from another computer
[root@centos]# setenforce 0 [root@centos]# service iptables disable
Start Apache
[root@centos]# service httpd start
Now your OP should be accesible on IP address and port 80 (http) of the PC where you have successfully installed openproject.
Please, notice, that disabling SELINUX and iptables is really not good way how to finish this installation. This guide is only for testing purposes and to be able to install OP as soon as possible. Configuring Apache (SSL etc.) and iptables is another topic.
*Any comments are appreciated here:
https://www.openproject.org/topics/576?r=633.*