您的位置:首页 > 运维架构 > Linux

CentOS5.4安装redmine详细步骤

2013-01-18 16:58 232 查看
>>>>概述<<<<

这里不解释什么是redmine及用来做什么,如果不知道用来做什么,估计也不会把它安装到CentOS5.4上。哈哈……

以下为详细的步骤,筒子们可以在安装好CentOS5.4后,直接复制其命令就能安装顺利。

如果你的机器的环境与我的不同,或者本身已经在CentOS5.4上安装过其它的应用(如:mysql-server等)可以在以下安装步骤中,省略安装此包即可。

详细的步骤如下:

<<1>>需要上网环境

将安装好的CentOS5.4配置上网,并测试上网环境:

[root@localhost ~]# ping -c 3 baidu.com
PING baidu.com (123.125.114.144) 56(84) bytes of data.

64 bytes from 123.125.114.144: icmp_seq=1 ttl=48 time=37.2 ms

64 bytes from 123.125.114.144: icmp_seq=2 ttl=49 time=38.5 ms

64 bytes from 123.125.114.144: icmp_seq=3 ttl=49 time=36.6 ms

--- baidu.com ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2016ms

rtt min/avg/max/mdev = 36.666/37.488/38.555/0.821 ms
如果配置网络环境,请参见:/article/9140510.html

如需要修改自定义的快速源的,请自行baidu,不再这里详述。

<<2>>安装基础包

[root@localhost ~]# yum -y
install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-server mysql mysql-devel
以上的操作 " Complete! " 之后,接着操作如下的命令:
[root@localhost ~]# service
mysqld restart

Stopping mysqld: [ OK ]

Initializing MySQL database: Installing MySQL system tables... OK

Filling help tables... OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h bye password 'new-password'

Alternatively you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com [ OK ]

Starting mysqld: [ OK ]
[root@localhost ~]# mysqladmin -uroot password 'leekwen'

[root@localhost ~]# mysql -uroot -pleekwen

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

+--------------------+

3 rows in set (0.01 sec)

mysql> \q;

Bye

<<3>>安装ruby及rubygems等其它需求包

[root@localhost ~]# mkdir redmine-pkg

[root@localhost ~]# cd redmine-pkg/

[root@localhost redmine-pkg]# wget -c ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p371.tar.gz
--2013-01-17 21:20:16-- ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p371.tar.gz
=> `ruby-1.8.7-p371.tar.gz'

Resolving ftp.ruby-lang.org... 221.186.184.68

Connecting to ftp.ruby-lang.org|221.186.184.68|:21... connected.

Logging in as anonymous ... Logged in!

==> SYST ... done. ==> PWD ... done.

==> TYPE I ... done. ==> CWD /pub/ruby/1.8 ... done.

==> SIZE ruby-1.8.7-p371.tar.gz ... 4902800

==> PASV ... done. ==> RETR ruby-1.8.7-p371.tar.gz ... done.

Length: 4902800 (4.7M)
100%[====================================================================>] 4,902,800 731K/s in 16s
2013-01-17 21:20:38 (291 KB/s) - `ruby-1.8.7-p371.tar.gz' saved [4902800]
[root@localhost redmine-pkg]# tar zxvf ruby-1.8.7-p371.tar.gz
[root@localhost redmine-pkg]# cd ruby-1.8.7-p371

[root@localhost ruby-1.8.7-p371]# ./configure --prefix=/usr/

[root@localhostruby-1.8.7-p371]#
make
compiling tk/tkutil

compiling win32ole

compiling zlib

make[1]: Entering directory `/root/redmine-pkg/ruby-1.8.7-p371/ext/zlib'

gcc -I. -I../.. -I../../. -I../.././ext/zlib -DHAVE_ZLIB_H -DOS_CODE=OS_UNIX -D_FILE_OFFSET_BITS=64 -fPIC -g -O2 -c zlib.c

gcc -shared -o ../../.ext/i686-linux/zlib.so zlib.o -L. -L../.. -L. -rdynamic -Wl,-export-dynamic -lz -lrt -ldl -lcrypt -lm -lc

make[1]: Leaving directory `/root/redmine-pkg/ruby-1.8.7-p371/ext/zlib'

making ruby

make[1]: Entering directory `/root/redmine-pkg/ruby-1.8.7-p371'

gcc -g -O2 -DRUBY_EXPORT -D_GNU_SOURCE=1 -L. -rdynamic -Wl,-export-dynamic main.o -lruby-static -lrt -ldl -lcrypt -lm -o ruby

make[1]: Leaving directory `/root/redmine-pkg/ruby-1.8.7-p371'

[root@localhost ruby-1.8.7-p371]# make install

./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./instruby.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"

installing binary commands

installing command scripts

installing library scripts

installing headers

installing manpages

installing extension objects

installing extension scripts
[root@localhost ruby-1.8.7-p371]#ruby -v

ruby 1.8.7 (2012-10-12 patchlevel 371) [i686-linux]

[root@localhost ruby-1.8.7-p371]# cd ..
[root@localhost redmine-pkg]# wget -c http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
--2013-01-17 21:28:00-- http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
Resolving production.cf.rubygems.org... 54.240.168.218, 54.240.168.202, 54.240.168.14, ...

Connecting to production.cf.rubygems.org|54.240.168.218|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 380101 (371K) [application/x-tar]

Saving to: `rubygems-1.8.24.tgz'

50% [=========================================================> ] 380,101 771K/s in 0.5s

2013-01-17 21:28:01 (771 KB/s) - `rubygems-1.8.24.tgz' saved [380101/380101]
[root@localhost redmine-pkg]# tar zxf rubygems-1.8.24.tgz

[root@localhost redmine-pkg]# cd rubygems-1.8.24

[root@localhost rubygems-1.8.24]# ruby setup.rb

RubyGems 1.8.24 installed

== 1.8.24 / 2012-04-27

* 1 bug fix:

* Install the .pem files properly. Fixes #320

* Remove OpenSSL dependency from the http code path

----------------------------------------------------------

RubyGems installed the following executables:

/usr/bin/gem

[root@localhost rubygems-1.8.24]# gem --version

1.8.24
[root@localhost rubygems-1.8.24]# cd ..

[root@localhost redmine-pkg]# wget -c http://rubyforge.org/frs/download.php/76681/redmine-2.1.6.tar.gz Connecting to files.rubyforge.vm.bytemark.co.uk|80.68.94.54|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 3717789 (3.5M) [application/x-gzip]

Saving to: `redmine-2.1.6.tar.gz'

100%[==================================================================>] 3,717,789 904K/s in 4.0s

2013-01-17 21:42:44 (904 KB/s) - `redmine-2.1.6.tar.gz' saved [3717789/3717789]

[root@localhost redmine-pkg]# tar zxf redmine-2.1.6.tar.gz -C /usr/local/

[root@localhost redmine-pkg]# cd /usr/local/redmine-2.1.6/

[root@localhost redmine-2.1.6]# gem install bundler

Fetching: bundler-1.2.3.gem (100%)

Successfully installed bundler-1.2.3

1 gem installed

Installing ri documentation for bundler-1.2.3...

Installing RDoc documentation for bundler-1.2.3...
[root@localhost redmine-2.1.6]# bundle install --without development test postgresql sqlite rmagick

Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (10.0.3)

Using i18n (0.6.1)

Using multi_json (1.5.0)

Using activesupport (3.2.11)

Using builder (3.0.0)

Using activemodel (3.2.11)

Using erubis (2.7.0)

Using journey (1.0.4)

Using rack (1.4.4)

Using rack-cache (1.2)

Using rack-test (0.6.2)

Using hike (1.2.1)

Using tilt (1.3.3)

Using sprockets (2.2.2)

Using actionpack (3.2.11)

Using mime-types (1.19)

Using polyglot (0.3.3)

Using treetop (1.4.12)

Using mail (2.4.4)

Using actionmailer (3.2.11)

Using arel (3.0.2)

Using tzinfo (0.3.35)

Using activerecord (3.2.11)

Using activeresource (3.2.11)

Using bundler (1.2.3)

Using coderay (1.0.8)

Using fastercsv (1.5.5)

Using rack-ssl (1.3.2)

Using json (1.7.6)

Using rdoc (3.12)

Using thor (0.16.0)

Using railties (3.2.11)

Using jquery-rails (2.0.3)

Installing mysql (2.8.1) with native extensions

Installing net-ldap (0.3.1)

Installing ruby-openid (2.1.8)

Installing rack-openid (1.3.1)

Installing rails (3.2.11)

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

[root@localhost redmine-2.1.6]# gem install tlsmail

Fetching: tlsmail-0.0.1.gem (100%)

Successfully installed tlsmail-0.0.1

1 gem installed

Installing ri documentation for tlsmail-0.0.1...

Installing RDoc documentation for tlsmail-0.0.1...

<<4>>建立redmine连接的数据库(注意,数据库字符码)

[root@localhost redmine-2.1.6]# mysql -uroot -pleekwen

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

+--------------------+

3 rows in set (0.00 sec)

mysql> create database redmine character set utf8;

Query OK, 1 row affected (0.02 sec)

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| redmine |

| test |

+--------------------+

4 rows in set (0.00 sec)

mysql> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'leekwen';

Query OK, 0 rows affected (0.03 sec)

mysql> \q;

Bye
<<5>>配置redmine服务

[root@localhost redmine-2.1.6]# cp config/database.yml.example config/database.yml

[root@localhost redmine-2.1.6]# vi config/database.yml

[root@localhost redmine-2.1.6]# cat config/database.yml

# Default setup is given for MySQL with ruby1.8. If you're running Redmine

# with MySQL and ruby1.9, replace the adapter name with `mysql2`.

# Examples for PostgreSQL and SQLite3 can be found at the end.
#只保留如下的几行信息即可:

production:

adapter: mysql

database: redmine

host: localhost

username: root

password: leekwen

encoding: utf8

[root@localhost redmine-2.1.6]# rake generate_secret_token

[root@localhost redmine-2.1.6]# RAILS_ENV=production rake db:migrate

== Setup: migrating ================================================
=========-------------------中间部分省略显示-------------------========

== AddBoardsParentId: migrated (0.0188s) ===========================

[root@localhost redmine-2.1.6]# RAILS_ENV=production rake redmine:load_default_data

Select language: ar, bg, bs, ca, cs, da, de, el, en, en-GB, es, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en]zh

====================================

Default configuration data loaded.

[root@localhost redmine-2.1.6]# finger redmine

finger: redmine: no such user.

[root@localhost redmine-2.1.6]# groupadd redmine

[root@localhost redmine-2.1.6]# adduser redmine -g redmine

[root@localhost redmine-2.1.6]# chown -R redmine:redmine files/ log/ tmp/ public/

[root@localhost redmine-2.1.6]# chmod -R 755 files/ log/ tmp/ public/

[root@localhost redmine-2.1.6]# ruby script/rails server webrick -e production &

[1] 23791

=> Booting WEBrick

=> Rails 3.2.11 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach

=> Ctrl-C to shutdown server

[2013-01-18 00:39:10] INFO WEBrick 1.3.1

[2013-01-18 00:39:10] INFO ruby 1.8.7 (2012-10-12) [i686-linux]

[2013-01-18 00:39:10] INFO WEBrick::HTTPServer#start: pid=23791 port=3000

[root@localhost redmine-2.1.6]# netstat -tln

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN

tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN

tcp 0 0 0.0.0.0:924 0.0.0.0:* LISTEN

tcp 0 0 :::22 :::* LISTEN

[root@localhost redmine-2.1.6]# chkconfig iptables --list

iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[root@localhost redmine-2.1.6]# chkconfig iptables off

[root@localhost redmine-2.1.6]# chkconfig iptables --list

iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@localhost redmine-2.1.6]# ifconfig eth0 |grep addr:

inet addr:192.168.160.11 Bcast:192.168.160.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fed1:a6ed/64 Scope:Link

[root@localhost redmine-2.1.6]# telnet 192.168.160.11 3000

Trying 192.168.160.11...

Connected to 192.168.160.11 (192.168.160.11).

Escape character is '^]'.

^]

[2013-01-18 00:50:00] ERROR bad Request-Line `^]'.

HTTP/1.1 400 Bad Request

Content-Type: text/html; charset=ISO-8859-1

Content-Length: 288

Date: Fri, 18 Jan 2013 08:50:00 GMT

Server: WEBrick/1.3.1 (Ruby/1.8.7/2012-10-12)

Connection: close

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<HTML>

<HEAD><TITLE>Bad Request</TITLE></HEAD>

<BODY>

<H1>Bad Request</H1>

bad Request-Line `^]'.

<HR>

<ADDRESS>

WEBrick/1.3.1 (Ruby/1.8.7/2012-10-12) at

bye.localdomain:3000

</ADDRESS>

</BODY>

</HTML>

Connection closed by foreign host.

[root@localhost redmine-2.1.6]# service iptables stop

Flushing firewall rules: [ OK ]

Setting chains to policy ACCEPT: filter [ OK ]

Unloading iptables modules: [ OK ]

此时简单的配置已经完成,你就可以对redmine进行页面的访问了。访问方式为:http://IP:3000
如果无法访问,请检查自己的服务器是否开了防火墙,我这里为了测试方便直接地将防火墙给禁用了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: