Redmine 3.3搭建
环境介绍:
CentOS Linux release 7.6.1810 (Core)
MySQL5.7
Redmine 3.3
ruby-2.3.3
Rails 4.2.6
参考文档:http://www.redmine.org/projects/redmine/wiki/RedmineInstall
1. 环境准备
官方的yum源下载软件速度慢,把yum源替换成阿里的yum源,并安装epel源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
安装rvm及ruby
curl -L https://get.rvm.io | bash -s stable
此时会报错,按照返回的提示执行相应的命令
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
(替换成你提示的执行命令)
设置Ruby系统环境
source /etc/profile.d/rvm.sh
rvm reload
rvm install 2.3.3
切换阿里的源
gem source -r https://rubygems.org/
gem source -a http://mirrors.aliyun.com/rubygems/
安装
gem install rake -v 12.0.0
gem install rails -v 4.2.6
安装mysql数据库(5.7)
Wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
安装mysql源
yum -y install mysql80-community-release-el7-2.noarch.rpm
(注意默认安装的是MySQL8.0,所以安装好yum源后,要修改yum源的配置,把mysql8.0禁掉,开启mysql5.7的源后再进行安装)。
yum repolist enabled | grep mysql.*
yum install mysql-community-server
systemctl start mysqld.service
运行一下命令查看一下运行状态
systemctl status mysqld.service
查看一下初始密码
grep "password" /var/log/mysqld.log
登录
mysql -uroot -p
修改密码
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY '****************';
mysql>FLUSH PRIVILEGES;
设置自动启动
systemctl enable mysqld
systemctl daemon-reload
2. 数据库操作
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
3. 更改配置文件
解压软件包redmine-3.3.0.tar.gz
tar xf redmine-3.3.0.tar.gz -C /opt
cd /opt/redmine-3.3.0
cp database.yml.example database.yml
修改database.yml如下内容(这块要仔细,不要乱改数据库名,否则会出问题,最好一致)
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "redmine"
Redmine使用Bundler管理gem依赖项,需要先安装Bundler
gem install bundler
Then you can install all the gems required by Redmine using the following command:
bundle install --without development test
(执行这个命令后报错,解决办法yum -y install ImageMagick-devel,然后再执行一遍undle install --without development test)
Session store secret generation:
bundle exec rake generate_secret_token
在应用程序根目录下(/opt/redmine-3.3.0)运行以下命令,创建数据库结构:
RAILS_ENV=production bundle exec rake db:migrate
设置数据库默认数据集,通过运行以下命令,在数据库中插入默认配置数据:
RAILS_ENV=production bundle exec rake redmine:load_default_data
输入zh
至此,redmine安装完成。
3.启动redmine
cd /opt/redmine-3.3.0/bin
echo -e '#!/bin/bash\nbundle exec rails server webrick -e production -p 3000 -b 0.0.0.0 -d' >> start.sh
chmod +x start.sh
./start.sh
4.访问redmine
http://your_ip:3000