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

【Redmine安装--Ubuntu篇】Redmine3.4.x (Ubuntu 14.04 , MySQL , Apache2 , Phusion Passenger)_第1张图片
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,回车,重复输入密码。

【Redmine安装--Ubuntu篇】Redmine3.4.x (Ubuntu 14.04 , MySQL , Apache2 , Phusion Passenger)_第2张图片
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的配置文件中添加以下内容:


    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

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

你可能感兴趣的:(【Redmine安装--Ubuntu篇】Redmine3.4.x (Ubuntu 14.04 , MySQL , Apache2 , Phusion Passenger))