centos7.9安装redmine5.1.1

发布时间:2024年01月23日

前提:

安装mysql并新建数据库--教程太多了此步骤省略;

用sqlyog连上mysql创建数据库redmine;

1.下载redmine-5.1.1.tar.gz,上传到/usr/local/software目录下;

2.解压

cd /usr/local/software
tar -zxvf redmine-5.1.1.tar.gz

?配置mysql

cd /usr/local/software/redmine-5.1.1
#复制一份配置文件
cp config/database.yml.example config/database.yml
#编辑配置文件
vi config/database.yml
#修改后的内容如下

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: Test@2024
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
  variables:
    # Recommended `transaction_isolation` for MySQL to avoid concurrency issues is
    # `READ-COMMITTED`.
    # In case of MySQL lower than 8, the variable name is `tx_isolation`.
    # See https://www.redmine.org/projects/redmine/wiki/MySQL_configuration
    transaction_isolation: "READ-COMMITTED"

#development:
  #adapter: mysql2
  #database: redmine_development
  #host: localhost
  #username: root
  #password: ""
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  #encoding: utf8mb4
  #variables:
    #transaction_isolation: "READ-COMMITTED"

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
#test:
  #adapter: mysql2
  vdatabase: redmine_test
  #host: localhost
  #username: root
  #password: ""
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  #encoding: utf8mb4
  #variables:
    #transaction_isolation: "READ-COMMITTED"

# PostgreSQL configuration example
#production:
#  adapter: postgresql
#  database: redmine
#  host: localhost
#  username: postgres
#  password: "postgres"

# SQLite3 configuration example
#production:
#  adapter: sqlite3
#  database: db/redmine.sqlite3

# SQL Server configuration example
#production:
#  adapter: sqlserver
#  database: redmine
#  host: localhost
#  username: jenkins
#  password: jenkins

#然后执行保存
wq

?3.安装需要的库

yum install -y gcc gcc-c++ make automake cmake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel mysql-devel ruby ruby-devel rubygems

4.安装rvm

curl -L get.rvm.io | bash -s stable

如果报错拒接链接如下图

则添加代理:

vi /etc/hosts
#增加下面这行
199.232.28.133 raw.githubusercontent.com
#保存
wq

然后再执行

curl -L get.rvm.io | bash -s stable

find / -name rvm.sh

?

source /etc/profile.d/rvm.sh
rvm -v

?

rvm requirements

rvm install 3.0

ruby -v
gem -v

gem sources --remove https://rubygems.org/
gem sources -a https://gems.ruby-china.com/
 gem install rails -v 6.1.7.6

如果安装rails报错如下:

ERROR:  SSL verification error at depth 3: certificate has expired (10)
/usr/local/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/net/protocol.rb:46: warning: exception in verify_callback is ignored
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired) (https://index.ruby-china.com/quick/Marshal.4.8/rails-6.1.7.6.gemspec.rz)

解决方式:

1)下载证书:https://curl.se/ca/cacert.pem

2)上传证书到服务器:/home/ssl/cacert.pem

3)配置环境变量

vi /etc/profile
#增加
export SSL_CERT_FILE=/home/ssl/cacert.pem
wq
source /etc/profile
然后执行:
gem install rails -v 6.1.7.6

配置bundler国内源

bundle config mirror.https://rubygems.org https://gems.ruby-china.com

?执行安装依赖

bundle install

如果报这个错:

mysql2 0.5.5安装失败,需要执行下面命令安装依赖

 yum install mysql-devel --nogpgcheck

?然后再执行

bundle install

?至此bundle的依赖安装完成

5.添加会话缓存

bundle exec rake generate_secret_token

?

?6.生成库表结构

RAILS_ENV=production bundle exec rake db:migrate

?

?7.加载默认数据

RAILS_ENV=production bundle exec rake redmine:load_default_data

?选择zh即中文

?8.文件系统权限设置

#1.创建目录
mkdir -p tmp tmp/pdf public/plugin_assets
#2.目录所属用户配置
#如果创建了redmine用户执行
sudo chown -R redmine:redmine files log tmp public/plugin_assets
#如果直接用root用户执行
sudo chown -R root:root files log tmp public/plugin_assets
#3.目录权限配置
sudo chmod -R 755 files log tmp public/plugin_assets

?9.启动服务

nohup bundle exec rails server -e production -b 0.0.0.0 -p 3000 &

?通过curl可以看到服务已经启动成功了

?如果防火墙没有关闭,需要把3000端口开放一下,执行命令

#开放3000端口,以便局域网可以访问
firewall-cmd --permanent --add-port=3000/tcp
#重启防火墙生效
firewall-cmd --reload

?

此时通过局域网浏览器输入

?http://局域网ip:3000看到下面页面即安装成功

10.登录

默认账号admin,默认密码admin

?登录成功需要重置默认密码

其他操作这里就不细述了。。。

文章来源:https://blog.csdn.net/c5211314963/article/details/135742423
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。