環境介紹:mysql
CentOS Linux release 7.6.1810 (Core) web
MySQL5.7sql
Redmine 3.3數據庫
ruby-2.3.3ruby
Rails 4.2.6bash
參考文檔:http://www.redmine.org/projects/redmine/wiki/RedmineInstallcurl
1. 環境準備ide
官方的yum源下載軟件速度慢,把yum源替換成阿里的yum源,並安裝epel源ui
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupurl
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
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