### 说明,最近研发需要redmine,但又没有服务器,就找个PC代替,最后为了网卡驱动选择了操作系统:Ubuntu13.10 ,安装比较顺当一路apt,结果用的时候遇到N多问题,谷歌翻遍了为解决问题。由于时间紧,直接贴出安装用参考英文文档,其余修改是自己完成的,仅供参考。
HowTo Install Redmine on Ubuntu step by step
·HowTo Install Redmine on Ubuntu step by step
oPrerequisite: check your ubuntu version against intended Redmine version
oIntroduction
oPrerequisites: Apache, mod-passenger, and MySQL
oInstalling and configuring the Ubuntu Redmine package
oConfiguring Apache
oBacking up Redmine
·Additional semi-optional packages
oEmail setup
oRevision control repository setup
Prerequisite: check your ubuntu version against intended Redmine version
Before using or studying this guide you should check which Redmine versionyou are going for. Be aware that only latest stable releases will be fullycompatible with current releases of plugins.
To check redmine versions versus your ubuntu version have a look athttp://www.ubuntuupdates.org/pm/redmine
Generally you could also consider only installing ruby from ubuntu-reposand then heading for a release of redmine from redmine's download page:http://www.redmine.org/projects/redmine/wiki/Download(this is the more common way of installing redmine on ubuntu). In thiscasethis guide is not suitedfor you and you should check for an alternate guide. Google provides lotsof resources for this alternate installation procedure.
If you are sure that you want to install from ubuntu-repositories, keep onreading:
Introduction
This tutorial walks you step-by-step through installing Redmine on aclean/fresh Ubuntu 12.04 installation. This is intended to be a completecookbook method for getting Redmine installed and running. It makes noassumptions about other things being installed or configured. Since I have hadsome issues when using the graphical package managers, we will be doing thisfrom the command line prompt to keep things as clear and clean as possible.
I recommend that you install any Ubuntu updates prior to beginning thisprocess. There are almost always some waiting to be applied after Ubuntu isfirst set up.
Prerequisites: Apache, mod-passenger, and MySQL
There are several support packages that we will install first. The apacheinstallation is pretty simple if you just follow the prompts and accept thedefaults.
$ sudo apt-get install apache2 libapache2-mod-passenger
Installing mysql takes just a little more, so the details are spelled out.
$ sudo apt-get install mysql-server mysql-client
The installation process for mysql is going to prompt you for a passwordfor the "root" access for the database server, then ask you toconfirm the password in a follow-up screen. This sets the databaseadminstration password.
Package configuration
┌────────────────────┤ Configuringmysql-server-5.5 ├─────────────────────┐
│ While not mandatory, it ishighly recommended that you set a password │
│ for the MySQL administrative"root" user. │
│ │
│ If this field is left blank, thepassword will not be changed. │
│ │
│ New password for the MySQL"root" user: │
│ │
│_______________________________________________________________________ │
│ │
│
│ │
└─────────────────────────────────────────────────────────────────────────┘
┌────┤ Configuringmysql-server-5.5 ├──────────┐
│ │
│ Repeat password for the MySQL"root" user. │
│ │
│ │
│____________________________________________ │
│ │
│
│ │
└──────────────────────────────────────────────┘
Installing and configuring the Ubuntu Redmine package
Now it is time to install redmine itself.
$ sudo apt-get install redmine redmine-mysql
You want to allow dbconfig-common to configure the database when promptedso selectYesfrom the prompt in the panel below.
Package configuration
┌──────────────────────────┤Configuring redmine ├──────────────────────────┐
│ │
│ The redmine/instances/defaultpackage must have a database installed and │
│ configured before it can beused. This can be optionally handledwith │
│ dbconfig-common. │
│ │
│ If you are an advanced databaseadministrator and know that you want to │
│ perform this configurationmanually, or if your database has already │
│ been installed and configured,you should refuse this option. Details │
│ on what needs to be done shouldmost likely be provided in │
│/usr/share/doc/redmine/instances/default. │
│ │
│ Otherwise, you should probablychoose this option. │
│ │
│ Configure database forredmine/instances/default with dbconfig-common? │
│ │
│
│ │
└───────────────────────────────────────────────────────────────────────────┘
Then you want to provide the "root" password for the database,so that the installer can create the redmine database. This is the password setwhen you installed mysql.
Package configuration
┌──────────────────────────┤Configuring redmine ├──────────────────────────┐
│ Please provide the password forhte administrative account with which │
│ this package should create itsMySQL database and user. │
│ │
│ Password of the database'sadministrative user: │
│ │
│******__________________________________________________________________ │
│ │
│
│ │
└───────────────────────────────────────────────────────────────────────────┘
Tell the redmine installer we are using mysql for this installation byhighlighting "mysql" from the list of database choices:
Package configuration
┌──────────────────────────┤Configuring redmine ├──────────────────────────┐
│ The redmine/instances/defaultpackage can be configured to use one of │
│ several database types. Below,you will be presented with the available │
│ choices. │
│ │
│ Database type to be used byredmine/instances/default: │
│ │
│ sqlite3 │
│ pgsql │
│ mysql │
│ │
│ │
│
│ │
└───────────────────────────────────────────────────────────────────────────┘
Now you are asked to provide a password that will be used to protect theredmine database. Redmine itself will use this when it wants to access mysql.
Package configuration
┌──────────────────────────┤Configuring redmine ├──────────────────────────┐
│ Please provide a password forredmine/instances/default to register with │
│ the database server. If left blank, a random password will be │
│ generated. │
│ │
│ MySQL application password forredmine/instances/default: │
│ │
│*******__________________________________________________________________│
│ │
│
│ │
└───────────────────────────────────────────────────────────────────────────┘
Now confirm the redmine password.
Package configuration
┌────┤ Configuring redmine├─────┐
│ │
│ │
│ Password confirmation: │
│ │
│ *******_______________________│
│ │
│
│ │
└────────────────────────────────┘
Configuring Apache
You need to modify two files for apache. The first is/etc/apache2/mods-available/passenger.conf which needs the textPassengerDefaultUser www-dataadded as seenhere:
PassengerDefaultUser www-data
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
Now create a symlink to connect Redmine into the web document space:
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
And modify /etc/apache2/sites-available/default to insert the followingwith the other
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
Now restart apache:
$ sudo service apache2 restart
You should now be able to access redmine from the local host
$ firefox http://IP/redmine
In the upper right corner of the browser window you should see the"Sign in" link. Click that and enter "admin" at both theLogin:andPassword:prompts. Note:this is not the password you set during the installation process. Click theLoginbutton.
I recommend that the next thing you do is to click onMy accountin the upper right corner and changethat password. In the page that is displayed there should be aChange passwordlink in theupper right of the white area of the page. Click to change the password.
Backing up Redmine
You should arrange a regular backup of the Redmine database and the filesthat users upload/attach. The database can be dumped to a text file with:
/usr/bin/mysqldump -u root -p
where
The p_w_uploads are stashed in /var/lib/redmine/default/files and can bebacked up with something like:
rsync -a /var/lib/redmine/default/files /path/to/backups/files
You can have these commands run automatically by creating a script called/etc/cron.daily/redmine that contains:
#!/bin/sh
/usr/bin/mysqldump -u root -p
rsync -a /var/lib/redmine/default/files /path/to/backups/files
Again, be sure to substitute the mysql root password for
Additional semi-optional packages
There are some services that Redmine can use that are not absolutelynecessary, but are useful. These are email and software repository/revisioncontrol systems.
Email setup
At some point you will probably want Redmine to be able to send email. Forthis you will need to install and configure email. This can be achieved byinstalling thepostfixpackage. I do not recommend the exim4 package, as there have been someincompatibilities in the way the "sendmail" command line is handledbetween Redmine and exim4. Unless everyone has an email account on the redmineserver you will want to set up external email as a full internet host. Onceemail service is installed, you will have to restart apache for Redmine to knowthat it has access to email services.
$ sudo apt-get install postfix
Now that you can send email, you have to tell Redmine about it. You needto create/edit the file/etc/redmine/default/configuration.ymland add the following lines:
production:
email_delivery:
delivery_method: :sendmail
Then restart apache so that Redmine reloads the configuration file:
$ sudo service apache2 restart
Revision control repository setup
In order to have your software repository on the system Redmine will needthe corresponding software installed.
$ sudo apt-get install git subversion cvs mercurial
$ sudo service apache2 restart
That covers it as far as I have gotten in my use of Redmine to date.
#### FAQ:
1、admin用户使用admin密码无法登陆,提示:Redmine500 error且日志中会报出:
NoMethodError (undefined method `options'for {:user_id=>1, :ctime=>1383335524, :atime=>1383335524}:Hash):
/usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb:329:in`commit_session'
解决:
(1)核实数据库-redmine_default中表users,admin用户字段status是否是 1,若不是修改
mysql> select login,status from users;
+-------+--------+
| login | status |
+-------+--------+
| admin | 1 |
| | 0 |
| test | 1 |
+-------+--------+
mysql>update users set status=1 wherelogin="admin";
(2)更新rack版本
# gem install rack –version 1.4.5
# echo "gem 'rack', '1.4.5'"
# tee -a /usr/share/redmine/Gemfile
# chown -R www-data:www-data /usr/share/redmine/
# service apache2 restart
(3)修改apache配置文件
# cd/etc/apache2/sites-available
#vim 000-default.conf
#ServerName www.example.com
ServerName localhost:80
ServerAdmin webmaster@localhost
DocumentRoot /var/www
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
Allow from all
AllowOverride all
RailsEnv production
RackBaseURI /redmine
Options -MultiViews
AllowOverride all
Options -MultiViews
2、apache2启动日志报错: * Restarting web server apache2 AH00558:apache2: Could not reliably determine theserver's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
解决:
# vim /etc/apache2/apache2.conf //加入:
#ServerRoot "/etc/apache2"
ServerName localhost:80
3、redmine新建项目版本库无法显示,报错404错误,提示不存在条目或其修订版本
# cd /usr/share/redmine
# svn --config-dir webserverRedmine co https://IP/neo/all test
#chown -R www-data:www-data webserverRedmine/
# rm -rf test //刚下载的可以删除了
# cd/usr/share/redmine/lib/redmine/scm/adapters
# vim subversion_adapter.rb //注释后修改内容,灰色字体内容
def credentials_string
str = ''
str << " --username #{shell_quote(@login)}" [email protected]?
str << " --password #{shell_quote(@password)}" [email protected]? || @password.blank?
str<< " --trust-server-cert --no-auth-cache --non-interactive--config-dir /usr/share/redmine/webserverRedmine"
#str<< " --no-auth-cache --non-interactive"
str
end
#### 以上内容解释:####
# cd redmine所在目录
# svn --config-dir webserverRedmine co https://<目标SVN地址> <目录名>(目录名随意,该目录会生成是从svn服务器上同步下来的内容,可以删除)。命令输入完成后,会出现提示,输入svn用户名和密码,然后又提示:“是否永久保存ssl凭证?”输入p确定---yes。此时会在redmine所在文件夹下生成webserverRedmine目录,目录内容为该SVN的ssl凭证。
###End ###
###说明:若还是不行,尝试:
# cd /usr/share/redmine/config
# mv configuration.yml.exampleconfiguration.yml
# vim configuration.yml //修改以下内容,理论上默认就是svn
scm_subversion_command: svn
版本信息:
Environment:
Redmine version 2.3.1.stable
Ruby version 1.9.3 (x86_64-linux)
Rails version 3.2.13
Environment production
Database adapter Mysql2
Redmine plugins:
noplugin installed