【转载】HowTo Install Redmine 3.0.x on Ubuntu 14.04 with Apache2, Phusion Passenger, MySQL, Subversion and Git (Gitolite)

文章原地址

https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_30x_on_Ubuntu_1404_with_Apache2_Phusion_Passenger_MySQL_Subversion_and_Git_(Gitolite)

参考此文档安装Redmine 3.x,重装了N次,一直未成功。结合另一个2.x的安装文档,在自己摸索下终于安装成功。记录一下安装步骤,安装过程中去掉了教程里Git的安装。

参考另一个2.x的安装教程

https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_25x_on_Ubuntu_1404_with_Apache2_Phusion_Passenger_MySQL_and_Subversion

Installing dependencies

sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server php5-mysql phpmyadmin libapache2-mod-perl2 libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev libmysqlclient-dev libmagickcore-dev libmagickwand-dev curl git-core patch build-essential bison zlib1g-dev libssl-dev libxml2-dev libxml2-dev sqlite3 libsqlite3-dev autotools-dev libxslt1-dev libyaml-0-2 autoconf automake libreadline6-dev libyaml-dev libtool imagemagick apache2-utils

Configure Subversion

sudo mkdir -p /var/lib/svn
sudo chown -R www-data:www-data /var/lib/svn
sudo a2enmod dav_svn

Open config file

sudo vim /etc/apache2/mods-enabled/dav_svn.conf

Uncomment following lines

<Location /svn>
    DAV svn
    SVNParentPath /var/lib/svn
    AuthType Basic
    AuthName "My repository" 
    AuthUserFile /etc/apache2/dav_svn.passwd
    AuthzSVNAccessFile /etc/apache2/dav_svn.authz
    <LimitExcept GET PROFIND OPTIONS REPORT>
    Require valid-user
    </LimitExcept>
</Location>
sudo a2enmod authz_svn

Add the redmine user for reading from repository

sudo htpasswd -c /etc/apache2/dav_svn.passwd redmine

sudo service apache2 restart

Create the repository

sudo svnadmin create --fs-type fsfs /var/lib/svn/my_repository
sudo chown -R www-data:www-data /var/lib/svn

Open file for configuration of repository access

sudo vim /etc/apache2/dav_svn.authz

Add access rights for redmine to the repository in the config file

[my_repository:/]
redmine = r

Installing Ruby

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get -y install ruby2.1 ruby-switch ruby2.1-dev ri2.1 libruby2.1 libssl-dev zlib1g-dev
sudo ruby-switch --set ruby2.1

Installing of Redmine

Redmine

Exampe for version 3.0.4, change the version number for other releases

sudo su - redmine
wget http://www.redmine.org/releases/redmine-3.0.4.tar.gz
tar zxf redmine-3.0.4.tar.gz
rm redmine-3.0.4.tar.gz
ln -s /opt/redmine/redmine-3.0.4 redmine
exit

MySQL

mysql -u root -p

Execute following lines to MySQL

CREATE DATABASE redmine character SET utf8;
CREATE user 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost';
exit

Configure Redmine database connection

sudo cp redmine/config/database.yml.example redmine/config/database.yml

Open database config file

sudo vim redmine/config/database.yml

Change the username and the password in the config file

database.yml:
production:
 adapter: mysql2
 database: redmine
 host: localhost
 username: redmine
 password: my_password
 encoding: utf8

Configuration

gem install bundler
cd /usr/share/redmine/
sudo bundle install --without development test postgresql sqlite
sudo rake generate_secret_token
sudo RAILS_ENV=production rake db:migrate 
sudo RAILS_ENV=production rake redmine:load_default_data
sudo mkdir public/plugin_assets
sudo chown -R www-data:www-data files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

Installing Phusion Passenger

Add repository

Add repository for Phusion Passenger

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates

Open repository config file

sudo vim /etc/apt/sources.list.d/passenger.list

Add following repository source

deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main
sudo chown root: /etc/apt/sources.list.d/passenger.list
sudo chmod 600 /etc/apt/sources.list.d/passenger.list

Installing

sudo apt-get update
sudo apt-get install libapache2-mod-passenger

Configuration

Open passenger config file

sudo vim /etc/apache2/mods-available/passenger.conf

Add following line to passenger config file

PassengerDefaultUser www-data

Open apache2 config file

sudo vim /etc/apache2/sites-available/000-default.conf

Add following part to apache2 config file

<Directory /var/www/html/redmine>
    RailsBaseURI /redmine
    PassengerResolveSymlinksInDocumentRoot on
</Directory>
sudo a2enmod passenger
sudo service apache2 restart

Start Redmine

Remine should now available at your host

http://yourhost/redmine

Login data:
Username: admin
Password: admin


e-Mail configuration

Example for smtp and encryption

Open redmine config file

sudo vim /usr/share/redmine/config/configuration.yml

Add following to redmine config file

# Outgoing email settings

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: smtp.host.com
      port: 587
      domain: host.com
      authentication: :login
      user_name: myname
      password: mypassword

You can check the e-Mail config in web interface with testmail function


Autoupdate Subversion repository view

In the project archive settings over web interface its needed to enable the web service for project archives and generate a api key

The following cronjob updates redmine to current subversion changesets every 15 minutes

sudo crontab -e

Add the cronjob

*/15 *    * * * curl "http://yourhost/redmine/sys/fetch_changesets?key=APIKEY" > /dev/null

教程中多了一个步骤

Prerequist

sudo su - redmine
gpg --keyserver hkp://pgp.mit.edu --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
exit

Its necessary to logout and login again

sudo su - redmine
rvm install 2.1.4
exit

开始每次都按此步骤安装,装了N次,都是安装完成后输入网址Redmine打不开,快崩溃了。

后面没有执行这个步骤,安装完成后,Redmine终于可以正常启动了。

发表评论

邮箱地址不会被公开。 必填项已用*标注