# Tutorial: Step By Step how to install OP 3.0 with Apache (“autostart”) on Debian 7.4
**This tutorial helps you to deploy OP3. Please, aware that:**
1. it\`s primarily for testing purposes and may contain some security misconfiguration, so consider deploying outside of your local network.
2. there is only 1 requirement you have to meet, that you have to have clean Debian 7.4 x64 install (from netinstall image, minimal installation)
3. I\`m using production environment for OP3
4. I\`m using MySQL from official Debian repo (install guide icluded)
5. 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 :)
6. If you find any bugs or you have any recommendations for improving this tutorial, please, feel free to send me comment.
## Prepare you environment
**Install tools needed for DB and Ruby**
[root@debian]# apt-get install git curl build-essential libxslt1-dev libxml2-dev libmysql-ruby libmysqlclient-dev libpq-dev libsqlite3-dev libyaml-0-2
**Install some handy tools**
[root@debian]# apt-get install locate vim
**Create dedicated user for OP3**
[root@debian]# groupadd openproject
```
[root@debian]# useradd --create-home --gid openproject openproject
```
[root@debian]# passwd openproject (enter desired password)
## Install Database (MySQL) necessary packages
During installation you have to enter password for mysql root.
[root@debian]# sudo apt-get install libmagickwand-dev libmagickcore-dev libmagickcore5-extra libgraphviz-dev libgvc5 libmysqlclient-dev libsqlite3-dev libpq-dev mysql-server memcached
**Now create databases**
[root@debian]# mysql -u root -p
Replace string “openproject” with desired username in MySQL database and “my\_password” with desired password (in my case both are “openproject”)
mysql> CREATE DATABASE openproject CHARACTER SET utf8;
mysql> CREATE USER 'openproject'@'localhost' IDENTIFIED BY 'my_password';
```
mysql> GRANT ALL PRIVILEGES ON openproject.* TO 'openproject'@'localhost';
```
mysql> \q
## Install Ruby
**Switch to desired user (openproject in my case)**
**Switch to user under which will OP run (user “openproject” in my case):**
[root@debian]# su openproject -c "bash -l"
Switch to users home dir or whatever directory you want to install openproject
[openproject@debian]# cd ~
[openproject@debian]#
**Install RVM (Ruby Version Manager)**
```
[openproject@debian]# \curl -L https://get.rvm.io | bash -s stable
```
[openproject@centos]# source $HOME/.rvm/scripts/rvm
**Install Ruby via RVM**
```
[openproject@debian]# rvm autolibs disable
```
```
[openproject@debian]# rvm install 2.1.0
```
[openproject@debian]# gem install bundler
## Install OpenProject
[openproject@debian]# git clone https://github.com/opf/openproject.git
[openproject@debian]# cd openproject
[openproject@debian]# git checkout release/3.0
[openproject@debian]# bundle install
## Configure OpenProject
**Please, be aware that database configuration file and configuration file are “ident-sensitive” and consistence of these files are crucial 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: mysql2
database: openproject
host: localhost
username: openproject
password: openproject
encoding: utf8
development:
adapter: mysql2
database: openproject
host: localhost
username: openproject
password: openproject
encoding: utf8
test:
adapter: mysql2
database: openproject
host: localhost
username: openproject
password: openproject
encoding: utf8
```
**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
**Add this line into configuration.yml file at the of of file for better performance of OP:**
rails_cache_store: :memcache
**Install plugins (Optional)**: \*For general information about OpenProject plug-ins refer to to the [plug-in page](https://www.openproject.org/projects/openproject/wiki/OpenProject_Plug-Ins.*)
If you install any plugins you have to install this plugins, so before you go on please call:
[openproject@debian]# bundle install
**Finish installation of OpenProject**
[openproject@debian]# cd /home/openproject/openproject
[openproject@debian]# bundle exec rake db:create:all
[openproject@debian]# bundle exec rake db:migrate
[openproject@debian]# RAILS_ENV="production" bundle exec rake db:seed
```
[openproject@debian]# bundle exec rake generate_secret_token
```
[openproject@debian]# RAILS_ENV="production" bundle exec rake db:migrate
**Precompile OpenProjects assets**
[openproject@debian]# RAILS_ENV="production" bundle exec rake assets:precompile
## Install Apache with Passenger to autostart OpenProject with OS and loadbalance traffic
**Install necessary packages**
[root@debian]# apt-get install apache2 libcurl4-gnutls-dev apache2-threaded-dev libapr1-dev libaprutil1-dev
**Grant permission for passenger**
[root@debian]# chmod o+x "/home/openproject"
[root@debian]# su - openproject -c "bash -l"
**Install Passenger gem**
[openproject@debian]# cd ~/openproject
[openproject@debian]# 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@debian]# passenger-install-apache2-module
**Add this lines to /etc/apache2/conf/apache2.conf, but first, check if the syntax is the same as the “passenger-install-apache2-module” installer noticed:**
LoadModule passenger_module /home/openproject/.rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
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
**Create VirtualHost file for Apache:**
[root@debian]# vim /etc/apache2/conf.d/openproject.conf
**Paste these lines into it:**
```
ServerName www.myopenprojectsite.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /home/openproject/openproject/public
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
```
**Start Apache**
[root@debian]# service apache2 start
**Now your OP should be accesible on IP address and port 80 (http) of the PC where you have successfully installed openproject. It is highly recommend to configure SSL module in Apache for https communication.**
*Any comments are appreciated here:
https://www.openproject.org/topics/576?r=633.\*