安装过程走了一点弯路,写下教程让大家可以尽量避坑
参考链接
官方安装教程 Install Redmine 421 on Centos 7 - Redmine
官方文档其实已经很完善,但还存在一些问题
首先就是版本的问题,redmine 和使用到的ruby, gems, 数据库 之间存在版本兼容问题,稍微搞错可能导致要重装
其次是资源来源问题,国外的资源链接拉取慢,访问不了,要切换成国内的资源链接
1、安装必要的资源包并配置host
安装资源包
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison sqlite-devel wget mariadb-server mariadb-devel httpd mod_ssl curl |
2、创建一个MySQL数据库
Redmine支持MySQL/MariaDB、Microsoft SQL Server、SQLite 3和PostgreSQL,我们将MariaDB用作数据库后端。
启动MariaDB服务并通过运行以下命令使其在启动时自动启动:
systemctl enable --now mariadb |

转存失败重新上传取消
使用以下命令登录到MySQL Shell:
在MySQL Shell中,运行以下SQL语句以创建新数据库、新用户并授予用户对该数据库的访问权限:
CREATE DATABASE redmine CHARACTER SET utf8; GRANT ALL ON redmine.* TO 'redmine' @ 'localhost' IDENTIFIED BY 'qwer1234' ; |
redmine为用户名,qwer1234为密码。
完成后,退出MySQL Shell,运行:

转存失败重新上传取消
如果需要从外部访问数据库
[root @kylin plugins]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 202 Server version: 10.3 . 9 -MariaDB MariaDB Server Copyright (c) 2000 , 2018 , Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> MariaDB [(none)]> grant all PRIVILEGES on *.* to root@ '%' identified by 'qwer1234' ; Query OK, 0 rows affected ( 0.000 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected ( 0.001 sec) MariaDB [(none)]> exit Bye [root @kylin plugins]# firewall-cmd --zone= public --add-port= 3306 /tcp --permanent success [root @kylin plugins]# firewall-cmd --reload success |
3、安装Ruby
1、配置host(解决访问慢的问题)
$ vim /etc/hosts 199.232.4.133 raw.githubusercontent.com |
2.拉取资源连接
这句资源链接如果拉取不了
gpg2 --keyserver hkp: //pool .sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB |
要改成
gpg2 --keyserver hkp: //pgp .mit.edu --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB |

转存失败重新上传取消
如果执行成功,仅执行下面的命令即可;
curl -L get.rvm.io | bash -s stable |

转存失败重新上传取消
如果拉取资源连接不成功,直接执行下面的命令
curl -L get.rvm.io | bash -s stable |

转存失败重新上传取消
然后根据提示,执行如下两条命令
curl -sSL https: //rvm .io /mpapis .asc | gpg2 -- import - curl -sSL https: //rvm .io /pkuczynski .asc | gpg2 -- import - |

转存失败重新上传取消
然后重新执行
curl -L get.rvm.io | bash -s stable |

转存失败重新上传取消
3、检查依赖安装情况
执行
source /etc/profile .d /rvm .sh rvm reload rvm requirements run |

转存失败重新上传取消
4、修改ruby安装源
修改 RVM 的 Ruby 安装源到 Ruby China 的 Ruby 镜像服务器,这样能提高安装速度
5、安装ruby,redmine4.1.5版本需要安装2.6的ruby

转存失败重新上传取消
6、验证Ruby安装成功

转存失败重新上传取消
4、安装Redmine 4.2.3
这里把安装路径设定为 /var/www/
mkdir -p /var/www cd /var/www wget https: //redmine .org /releases/redmine-4 .1.5. tar .gz --no-check-certificate tar zxvf redmine-4.1.5. tar .gz export REDMINE= /var/www/redmine-4 .1.5 cd $REDMINE cp config /database .yml.example config /database .yml |
做一下配置文件配置,可以看到这里面是关于数据库登录名密码的一些相关配置

转存失败重新上传取消
5、安装Gems 和创建Database Schema
切换gem源和bundler源
$ gem sources --add https: //gems .ruby-china.com/ --remove https: //rubygems .org/ $ gem sources -l https: //gems .ruby-china.com # 确保只有 gems.ruby-china.com 如果你使用 Gemfile 和 Bundler (例如:Rails 项目) 你可以用 Bundler 的 Gem 源代码镜像命令。 $ bundle config mirror.https: //rubygems .org https: //gems .ruby-china.com |

转存失败重新上传取消
安装bundler
cd $REDMINE gem install bundler |

转存失败重新上传取消
在执行以下命令时,先出现黄色字体,耐心再等一下
bundle install --without development test |

转存失败重新上传取消

转存失败重新上传取消
运行以下命令以生成密钥
bundle exec rake generate_secret_token |
执行以下两句往数据库建表并插入初始数据
RAILS_ENV=production REDMINE_LANG=en bundle exec rake db:migrate RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data |

转存失败重新上传取消
***

转存失败重新上传取消
6、安装Passenger
这里不指定版本会装成最新的

转存失败重新上传取消
yum install -y mod_passenger |
验证安装是否成功
passenger-config validate- install |

转存失败重新上传取消
使用如下命令确定RVM Ruby安装位置
passenger-config --ruby- command |

转存失败重新上传取消
7、配置httpd
配置文件
创建新的配置文件,配置redmine 网站连接
确认本机ip后执行
vim /etc/httpd/conf .d /redmine .conf PassengerRuby /usr/local/rvm/gems/ruby-2 .6.6 /wrappers/ruby <VirtualHost *:80> ServerName yourserver.domain.org DocumentRoot "/var/www/redmine-4.1.5/public" ErrorLog logs /redmine_error_log LogLevel warn <Directory "/var/www/redmine-4.1.5/public" > Options Indexes ExecCGI FollowSymLinks Require all granted AllowOverride all < /Directory > < /VirtualHost > |
修改里面的ServerName项,如无域名可以ip替代

转存失败重新上传取消
配置权限
cd $REDMINE cd .. chown -R apache:apache redmine-4.1.5 |
配置环境变量
在以下文件后添加两行
vim /etc/sysconfig/httpd PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 |

转存失败重新上传取消
重启httpd并设置开机启动
systemctl restart httpd systemctl enable httpd |
8、访问redmine
访问http://ip即可访问redmine
登录名admin
密码admin
如果网站打不开,可能是防火墙没有打开相关端口
查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports |
开放80端口,配置立即生效
firewall-cmd --zone=public --add-port=80 /tcp --permanent firewall-cmd --reload |

转存失败重新上传取消
登陆后会要求重置密码
设置系统参数,管理员信息

转存失败重新上传取消