【Redmine安装--Ubuntu篇】Redmine3.4.x (Ubuntu 14.04 , MySQL , Apache2 , Phusion Passenger)

Redmine管理工具

Tags: redmine 项目管理工具 团队管理工具 问题管理工具 Ubuntu下安装redmine

安装环境说明

  • redmine 3.4.6
  • Ubuntu 14.04
  • Mysql 5.5
  • Ruby 2.1.9
  • Passenger 5.3.4
  • Apache 2.4.7

一、安装依赖

1.输入以下两条指令;

$ sudo apt-get update && sudo apt-get upgrade -y
$ sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server php5-mysql libapache2-mod-perl2 libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev libmysqlclient-dev libmagickcore-dev libmagickwand-dev curl git-core gitolite 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 ssh zip libicu-dev libssh2-1 libssh2-1-dev cmake libgpg-error-dev subversion libapache2-svn

我不知道是否需要每个包,但它有效。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'apache2-dev' instead of 'apache2-prefork-dev'
curl is already the newest version.
libyaml-0-2 is already the newest version.
patch is already the newest version.
The following extra packages will be installed:
  apache2-bin apache2-data cmake-data comerr-dev debhelper dh-apparmor
  dpkg-dev g++ g++-4.8 gettext ghostscript gir1.2-freedesktop
  gir1.2-gdkpixbuf-2.0 gir1.2-rsvg-2.0 git git-man gsfonts icu-devtools
  imagemagick-common intltool-debian krb5-multidev libaio1
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl
  libapache2-mod-svn libapache2-reload-perl libapr1 libaprutil1
  libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive13 libasprintf-dev
  libauthen-sasl-perl libbison-dev libbsd-resource-perl libbz2-dev
  libcairo-script-interpreter2 libcairo2-dev libcdt5 libcgraph6 libcroco3
  libcupsfilters1 libcupsimage2 libdbd-mysql-perl libdbi-perl
  libdevel-symdump-perl libdjvulibre-dev libdjvulibre-text libdjvulibre21
  libdpkg-perl libelfg0 libencode-locale-perl liberror-perl libexif-dev
  libexpat1-dev libfftw3-double3 libfile-fcntllock-perl libfile-listing-perl
  libfont-afm-perl libfontconfig1-dev libfreetype6-dev libgcrypt11-dev
  libgdk-pixbuf2.0-dev libgettextpo-dev libgettextpo0 libglib2.0-bin
  libglib2.0-dev libgnutls-dev libgnutlsxx27 libgraphviz-dev libgs9
  libgs9-common libgssrpc4 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgvc6
  libgvc6-plugins-gtk libgvpr2 libhtml-form-perl libhtml-format-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl
  libhttp-message-perl libhttp-negotiate-perl libice-dev libidn11-dev
  libijs-0.35 libilmbase-dev libilmbase6 libio-html-perl
  libio-socket-inet6-perl libio-socket-ssl-perl libjasper-dev libjbig-dev
  libjbig2dec0 libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libkadm5clnt-mit9
  libkadm5srv-mit9 libkdb5-7 libkrb5-dev liblcms2-dev libldap2-dev liblqr-1-0
  liblqr-1-0-dev libltdl-dev liblwp-mediatypes-perl liblwp-protocol-https-perl
  liblzma-dev liblzo2-2 libmagickcore5 libmagickcore5-extra libmagickwand5
  libmail-sendmail-perl libmailtools-perl libmysqlclient18 libnet-http-perl
  libnet-smtp-ssl-perl libnet-ssleay-perl libnetpbm10 libnettle4
  libopenexr-dev libopenexr6 libp11-kit-dev libpaper-utils libpaper1
  libpathplan4 libpcre3-dev libpcrecpp0 libperl5.18 libpixman-1-dev
  libpng12-dev libpq-dev libpq5 libpthread-stubs0-dev librsvg2-2
  librsvg2-common librsvg2-dev librtmp-dev libsctp-dev libsctp1 libserf-1-1
  libsm-dev libsocket6-perl libssl-doc libstdc++-4.8-dev libsvn1
  libsys-hostname-long-perl libtasn1-6-dev libterm-readkey-perl libtiff5-dev
  libtiffxx5 libtinfo-dev libunistring0 liburi-perl libwmf-dev libwmf0.2-7
  libwww-perl libwww-robotrules-perl libx11-dev libx11-doc libxau-dev
  libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxdmcp-dev libxdot4
  libxext-dev libxrender-dev libxslt1.1 libxt-dev lksctp-tools m4
  mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server-5.5
  mysql-server-core-5.5 netpbm php5-cli php5-common php5-json php5-readline
  pkg-config po-debconf poppler-data ssl-cert unzip uuid-dev x11proto-core-dev
  x11proto-input-dev x11proto-kb-dev x11proto-render-dev x11proto-xext-dev
  xorg-sgml-doctools xtrans-dev
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom autoconf2.13
  autoconf-archive gnu-standards autoconf-doc bison-doc codeblocks eclipse
  doc-base dh-make apparmor-easyprof debian-keyring g++-multilib
  g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg gettext-doc ghostscript-x
  hpijs git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui
  gitk gitweb git-arch git-bzr git-cvs git-mediawiki git-svn imagemagick-doc
  autotrace cups-bsd lpr lprng enscript ffmpeg gimp gnuplot grads hp2xx
  html2ps libwmf-bin mplayer povray radiance sane-utils texlive-base-bin
  transfig xdg-utils ufraw-batch krb5-doc php-pear db5.3-util lrzip
  libdigest-hmac-perl libgssapi-perl libcairo2-doc libcurl4-doc libcurl3-dbg
  libclone-perl libmldbm-perl libnet-daemon-perl libplrpc-perl
  libsql-statement-perl libfftw3-bin libfftw3-dev libgcrypt11-doc
  libglib2.0-doc gnutls26-doc gnutls-bin fonts-droid krb5-user gvfs
  libdata-dump-perl libipc-sharedcache-perl libice-doc icu-doc libtool-doc
  libcrypt-ssleay-perl liblzma-doc postgresql-doc-9.3 librsvg2-bin
  librsvg2-doc libsm-doc sqlite3-doc libstdc++-4.8-doc automaken gfortran
  fortran95-compiler gcj-jdk libwmf-doc libwmf0.2-7-gtk libauthen-ntlm-perl
  libxcb-doc libxext-doc libxt-doc tinyca mailx php5-user-cache
  libmail-box-perl poppler-utils fonts-japanese-mincho fonts-ipafont-mincho
  fonts-japanese-gothic fonts-ipafont-gothic fonts-arphic-ukai
  fonts-arphic-uming fonts-unfonts-core openssl-blacklist subversion-tools
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-dev apache2-utils autoconf automake
  autotools-dev bison build-essential cmake cmake-data comerr-dev debhelper
  dh-apparmor dpkg-dev g++ g++-4.8 gettext ghostscript gir1.2-freedesktop
  gir1.2-gdkpixbuf-2.0 gir1.2-rsvg-2.0 git git-core git-man gitolite gsfonts
  icu-devtools imagemagick imagemagick-common intltool-debian krb5-multidev
  libaio1 libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libapache2-mod-perl2 libapache2-mod-php5
  libapache2-mod-svn libapache2-reload-perl libapache2-svn libapr1 libapr1-dev
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-dev libaprutil1-ldap
  libarchive13 libasprintf-dev libauthen-sasl-perl libbison-dev
  libbsd-resource-perl libbz2-dev libcairo-script-interpreter2 libcairo2-dev
  libcdt5 libcgraph6 libcroco3 libcupsfilters1 libcupsimage2
  libcurl4-openssl-dev libdbd-mysql-perl libdbi-perl libdevel-symdump-perl
  libdjvulibre-dev libdjvulibre-text libdjvulibre21 libdpkg-perl libelfg0
  libencode-locale-perl liberror-perl libexif-dev libexpat1-dev
  libfftw3-double3 libfile-fcntllock-perl libfile-listing-perl
  libfont-afm-perl libfontconfig1-dev libfreetype6-dev libgcrypt11-dev
  libgdk-pixbuf2.0-dev libgettextpo-dev libgettextpo0 libglib2.0-bin
  libglib2.0-dev libgnutls-dev libgnutlsxx27 libgpg-error-dev libgraphviz-dev
  libgs9 libgs9-common libgssrpc4 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common
  libgvc6 libgvc6-plugins-gtk libgvpr2 libhtml-form-perl libhtml-format-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl
  libhttp-message-perl libhttp-negotiate-perl libice-dev libicu-dev
  libidn11-dev libijs-0.35 libilmbase-dev libilmbase6 libio-html-perl
  libio-socket-inet6-perl libio-socket-ssl-perl libjasper-dev libjbig-dev
  libjbig2dec0 libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libkadm5clnt-mit9
  libkadm5srv-mit9 libkdb5-7 libkrb5-dev liblcms2-dev libldap2-dev liblqr-1-0
  liblqr-1-0-dev libltdl-dev liblwp-mediatypes-perl liblwp-protocol-https-perl
  liblzma-dev liblzo2-2 libmagickcore-dev libmagickcore5 libmagickcore5-extra
  libmagickwand-dev libmagickwand5 libmail-sendmail-perl libmailtools-perl
  libmysqlclient-dev libmysqlclient18 libnet-http-perl libnet-smtp-ssl-perl
  libnet-ssleay-perl libnetpbm10 libnettle4 libopenexr-dev libopenexr6
  libp11-kit-dev libpaper-utils libpaper1 libpathplan4 libpcre3-dev
  libpcrecpp0 libperl5.18 libpixman-1-dev libpng12-dev libpq-dev libpq5
  libpthread-stubs0-dev libreadline6-dev librsvg2-2 librsvg2-common
  librsvg2-dev librtmp-dev libsctp-dev libsctp1 libserf-1-1 libsm-dev
  libsocket6-perl libsqlite3-dev libssh2-1 libssh2-1-dev libssl-dev libssl-doc
  libstdc++-4.8-dev libsvn1 libsys-hostname-long-perl libtasn1-6-dev
  libterm-readkey-perl libtiff5-dev libtiffxx5 libtinfo-dev libtool
  libunistring0 liburi-perl libwmf-dev libwmf0.2-7 libwww-perl
  libwww-robotrules-perl libx11-dev libx11-doc libxau-dev libxcb-render0-dev
  libxcb-shm0-dev libxcb1-dev libxdmcp-dev libxdot4 libxext-dev libxml2-dev
  libxrender-dev libxslt1-dev libxslt1.1 libxt-dev libyaml-dev lksctp-tools m4
  mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server
  mysql-server-5.5 mysql-server-core-5.5 netpbm php5 php5-cli php5-common
  php5-json php5-mysql php5-readline pkg-config po-debconf poppler-data
  sqlite3 ssh ssl-cert subversion unzip uuid-dev x11proto-core-dev
  x11proto-input-dev x11proto-kb-dev x11proto-render-dev x11proto-xext-dev
  xorg-sgml-doctools xtrans-dev zip zlib1g-dev
0 upgraded, 244 newly installed, 0 to remove and 0 not upgraded.
Need to get 105 MB of archives.
After this operation, 467 MB of additional disk space will be used.
Do you want to continue? [Y/n]

2.输入: Y 回车

3.设置MySQL数据库root 例如:123456,回车,重复输入密码。

MySQL安装界面

二.安装ruby

1.输入以下五个命令;

$ 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

2.输入ruby -v验证是否安装成功,显示内容如下:

ruby 2.1.9p495 (2017-12-15 revision 54437) [x86_64-linux-gnu]

三.用户和SSH密码

1.用户

a.为Redmine创建用户(redmine):

$ sudo adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine

2.Visudo配置

a.编辑配置文件

$ sudo visudo

添加以下内容

# temp - *REMOVE* after installation
redmine    ALL=(ALL)      NOPASSWD:ALL

请注意,redmine用户将能够运行root命令,但这只是为了简化后续步骤。 安装后删除此行。

四.安装Redmine

1.准备工作,安装rvm

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

必须注销并再次登录

$ sudo su - redmine
$ rvm install 2.1.4
$ exit

2.安装Redmine,以3.4.6版的示例,安装其他版本请更改版本号

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

3.MySQL

a.进入mysql控制台

$ sudo mysql -u root -p

b.在MySQL控制台执行以下命令

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

c.配置Redmine数据库连接

$ sudo su - redmine
$ sudo cp redmine/config/database.yml.example redmine/config/database.yml

d.编辑数据库配置文件

$ sudo vi redmine/config/database.yml

e.修改配置文件中的用户名和密码

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

4.构造

$ gem install bundler
$ cd redmine/
$ bundle install --without development test postgresql sqlite
$ rake generate_secret_token
$ RAILS_ENV=production rake db:migrate 
$ RAILS_ENV=production rake redmine:load_default_data
$ exit

注意:选择语言时,简体中文请输入zh,回车;

五.移除redmine用户管理员权限

$ sudo visudo

移除以下内容:

# temp - *REMOVE* after installation
redmine    ALL=(ALL)      NOPASSWD:ALL

六.验证Redmine安装

1.启动Redmine服务(自带的webrick服务)

$ sudo su - redmine
$ cd redmine
$ ruby bin/rails server -p3000 webrick -e production -b0.0.0.0 -d
  • 后台启动一个端口为3000的webrick服务

2.登录Redmine验证

  • 现在登录Redmine验证安装是否正确。
http://your_ip_or_fqdn:3000
  • 如果可以正常打开Redmine首页,即安装成功。

  • 以下内容为Redmine在Phusion Passenger 和Apache2上面的部署步骤

七.安装Phusion Passenger

1.添加库

a.为Phusion Passenger添加库

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

b.编辑库的配置文件

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

c.添加以下库的来源

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

2.安装

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

3.配置

a.打开passenger的配置文件

$ sudo vi /etc/apache2/mods-available/passenger.conf

b.在配置文件中添加以下指令

PassengerUserSwitching on
PassengerUser redmine
PassengerGroup redmine

c.打开Apache2配置文件

$ sudo vi /etc/apache2/sites-available/000-default.conf

d.在Apache2的配置文件中添加以下内容:

<VirtualHost *:80>
    DocumentRoot /var/www/html/redmine
    # Normally Passenger would have assumed that the
    # application root is "/var/rails/zena/sites/example.com".
    # This overrides it.
    PassengerAppRoot /opt/redmine/redmine
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

e.执行以下命令

$ sudo a2enmod passenger
$ sudo ln -s /opt/redmine/redmine/public/ /var/www/html/redmine
$ sudo service apache2 restart

f.生成新的密钥

$ sudo su - redmine
$ cd redmine
$ rake generate_secret_token
$ rake db:migrate RAILS_ENV=production
$ rake redmine:plugins:migrate RAILS_ENV=production
$ rake tmp:cache:clear
$ rake tmp:sessions:clear
$ exit

八.启动redmine

现在Redmine应该可以在你的主机上运行起来了。

http://your_ip_or_fqdn/redmine

Login data:
Username: admin
Password: admin

参考资料:
1.http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_30x_on_Ubuntu_1404_with_Apache2_Phusion_Passenger_MySQL_Subversion_and_Git_(Gitolite)#Installing-dependencies
2.https://serverfault.com/questions/895683/apache-isnt-started-via-mod-passenger
3.https://blog.phusion.nl/2018/01/29/passenger-5-2-0/
4.https://www.phusionpassenger.com/library/config/apache/reference/#passengerapproot

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,386评论 6 479
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,939评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,851评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,953评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,971评论 5 369
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,784评论 1 283
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,126评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,765评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,148评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,744评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,858评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,479评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,080评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,053评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,278评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,245评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,590评论 2 343

推荐阅读更多精彩内容