Check which version of Redmine you are going for. To check redmine versions: http://www.ubuntuupdates.org/pm/redmine
Generally you could also consider only installing ruby from Ubuntu-repos and then heading for a release of redmine from redmine's download page: http://www.redmine.org/projects/redmine/wiki/Download
Prerequisites:
Apache, mod-passenger and MySQL
Install Apache and mod-passeneger
# apt-get install apache2 libapache2-mod-passenger
Install mysql
# apt-get install mysql-server mysql-client You will be asked to set MySQL root password
Create your database and your user for your redmine installation
mysql> create database redmine; Query OK, 1 row affected (0.00 sec) mysql> create user redmine; Query OK, 0 rows affected (0.00 sec) mysql> set password for redmine = password("passwd"); Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on redmine.* to redmine@localhost identified by 'passwd'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> show databases;
Install Apache2 and php5
# apt-get install apache2 # apt-get install php5 libapache2-mod-php5
Install libyaml
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz # tar -xzvf yaml-0.1.4.tar.gz # cd yaml-0.1.4/ # ./configure # make # make install
Install Ruby
# apt-get install ruby1.9.1 ruby1.9.1-dev rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev # update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \ --slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \ /usr/share/man/man1/ruby1.9.1.1.gz \ --slave /usr/bin/ri ri /usr/bin/ri1.9.1 \ --slave /usr/bin/irb irb /usr/bin/irb1.9.1 \ --slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1 # choose your interpreter # changes symlinks for /usr/bin/ruby , /usr/bin/gem # /usr/bin/irb, /usr/bin/ri and man (1) ruby # update-alternatives --config ruby # update-alternatives --config gem # now try ruby -v # ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Download Redmine and install
# wget http://www.redmine.org/releases/redmine-2.4.5.tar.gz # tar -xzvf redmine-2.4.5.tar.gz # mv redmine-2.4.5 /var/www/redmine
Install bundle and necessary packages
# apt-get install libmysqlclient-dev # apt-get install libmagickcore-dev libmagickwand-dev # which gem /usr/local/bin/gem # gem -v 1.8.11 # gem install bundler Fetching: bundler-1.6.2.gem (100%) Successfully installed bundler-1.6.2 1 gem installed Installing ri documentation for bundler-1.6.2... Installing RDoc documentation for bundler-1.6.2... # cd /var/www/redmine/ # cp config/database.yml.example config/database.yml # vi config/database.yml production: adapter: mysql2 database: redmine host: localhost username: redmine password: "password" encoding: utf8 # bundle install --without development test postgresql sqlite ... Your bundle is complete! Gems in the groups development, test, postgresql and sqlite were not installed. Use `bundle show [gemname]` to see where a bundled gem is installed. Post-install message from rdoc: Depending on your version of ruby, you may need to install ruby rdoc/ri data: <= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install >= 1.9.2 : nothing to do! Yay! # ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Configure Redmine
# cd /var/www/redmine/ # rake generate_secret_token # RAILS_ENV=production rake db:migrate # RAILS_ENV=production rake redmine:load_default_data
Configure correct directory permissions
# mkdir public/plugin_assets # chown -R www-data:www-data files log tmp public/plugin_assets # chmod -R 755 files log tmp public/plugin_assets
Test redmine
# ruby script/rails server webrick -e productionGo to http://hostname:3000
You will see this from the command line:
=> Booting WEBrick => Rails 3.2.17 application starting in production on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2014-06-01 18:17:13] INFO WEBrick 1.3.1 [2014-06-01 18:17:13] INFO ruby 1.9.3 (2011-10-30) [x86_64-linux] [2014-06-01 18:17:13] INFO WEBrick::HTTPServer#start: pid=19921 port=3000 Started GET "/" for 99.236.20.144 at 2014-06-01 18:19:55 -0700 Processing by WelcomeController#index as HTML Current user: anonymous Rendered welcome/index.html.erb within layouts/base (84.4ms) Completed 200 OK in 524.1ms (Views: 110.9ms | ActiveRecord: 64.6ms)Also you should see this in your browser:
If all is well at this point, we can now configure Passenger to make sure it launches when Apache runs.
# apt-get install libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev # gem install passenger
Install the Passenger module for Apache:
# passenger-install-apache2-module
# vi /etc/apache2/mods-available/passenger.load add: LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so # ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load # vi /etc/apache2/mods-available/passenger.conf add =========================================== User www-data Group www-data <IfModule mod_passenger.c> PassengerRoot /var/lib/gems/1.9.1/gems/passenger-4.0.44 PassengerDefaultRuby /usr/bin/ruby1.9.1 </IfModule>===========================================
Configure Apache2
# cd /var/www/redmine/public # cp dispatch.fcgi.example dispatch.fcgi Modify dispatch.fcgi, a copy of dispatch.fcgi is attached. # chmod 755 ./dispatch.fcgi # touch .htaccess Add the following to .htaccess: ================================== #RewriteRule ^(stylesheets.*|images.*|favicon.*|javascripts.*|plugin_assets.*|themes.*|help.*)$ $1 [L] #<IfModule mod_fastcgi.c> # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] #</IfModule> #<IfModule mod_fcgid.c> # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] #</IfModule> #<IfModule mod_cgi.c> # RewriteRule ^(.*)$ dispatch.cgi [QSA,L] #</IfModule> RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] ==================================
# Then do a # a2enmod rewrite
# Install fast-cgi # apt-get install libapache2-mod-fastcgi php5-fpm # Update the config/environment.rb file to force the rails environment to production, simply uncomment this line at the start of the file: ENV['RAILS_ENV'] ||= 'production' # vi redmine/config/environment.rb add: ENV['RAILS_ENV'] ||= 'production'
Add the following to /etc/apache2/ports.conf
NameVirtualHost *:3000 Listen *:3000
Create redmine site file
# vi /etc/apache2/sites-enabled/redmine add: <VirtualHost *:3000> DocumentRoot /var/www/redmine/public RailsEnv production <directory /var/www/redmine/public> Options -Indexes +ExecCGI FollowSymLinks -MultiViews AllowOverride None Order allow,deny allow from all RailsBaseURI /redmine PassengerResolveSymlinksInDocumentRoot on </directory> ErrorLog "|/usr/sbin/rotatelogs /var/log/redmine-error.%Y-%m-%d.log 86400" CustomLog "|/usr/sbin/rotatelogs /var/log/redmine-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" </VirtualHost> # vi /etc/apache2/apache2.conf add the following: ================================= # Include passenger: Include /etc/apache2/mods-available/passenger.conf ================================= # Restart Apache2 service # service apache2 restart
Note: If you use openssl, you need to add the following instead
<VirtualHost *:3000> DocumentRoot /var/www/redmine/public RailsEnv production <directory /var/www/redmine/public> Options -Indexes +ExecCGI FollowSymLinks -MultiViews AllowOverride None Order allow,deny allow from all RailsBaseURI /redmine PassengerResolveSymlinksInDocumentRoot on </directory> SSLEngine on SSLCertificateFile /etc/ssl/certs/server.crt SSLCertificateKeyFile /etc/ssl/private/server.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdownA ErrorLog "|/usr/sbin/rotatelogs /var/log/redmine-error.%Y-%m-%d.log 86400" CustomLog "|/usr/sbin/rotatelogs /var/log/redmine-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" </VirtualHost>Also in your "default-ssl" site file, make sure you have the rewrite rules
# Redirecty network traffic to port 443 RewriteEngine on RewriteRule ^/redmine/(.*)$ https://dev2.retailigence.com:3100/$1 [R,L]
You might want to change the Redmine tmp and files permissions and ownership
# chmod -R 777 /var/www/redmine/files/ # chmod -R 777 /var/www/redmine/tmp
ortherwise you might get the following error
ActionView::Template::Error (Permission denied - /var/www/redmine/tmp/cache/900): App 31151 stderr: 9: <p><%= f.text_field :firstname, :required => true %></p>
No comments:
Post a Comment