【ubuntu 18.04】安装readmine

1. 官网

https://www.redmine.org/projects/redmine/wiki/Guide

2. 插件

https://www.redmine.org/projects/redmine/wiki/Plugin_List

3. 安装

# 解压缩
tar -zxvf redmine-4.2.3.tar.gz
cd redmine-4.2.3/
cp config/database.yml.example config/database.yml

gem -v
ruby -v

# 配置国内源sudo gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
vim ~/.gemrc
sudo apt install ruby-bundler
bundle config mirror.https://rubygems.org https://gems.ruby-china.com
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem sources -l
ping gems.ruby-china.com

# 安装依赖
sudo gem update --system
sudo apt-get install libxml2-dev libxslt-dev ruby-dev
sudo gem install racc -v '1.6.0'
# sudo apt-get install libmariadb-dev libmysqlclient-dev mysql-devel
sudo apt-get install libmariadb-dev libmysqlclient-dev
bundle install --without development test
# 初始化配置
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R redmine:redmine files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets
sudo chown -R master:master files log tmp public/plugin_assets
# 测试运行(由于端口占用,需要换个端口运行) bundle exec rails server webrick
-e production netstat -an | grep 3000 # 运行服务 bundle exec rails server webrick -e production -p 3001 -b 0.0.0.0 -d # 插件安装 mv redmine_code_review ./plugins/ ls ./plugins/ rake redmine:plugins:migrate RAILS_ENV=production ps -ef | grep readmine ps -ef | grep 3001 kill 70295 ps -ef | grep 3001 bundle exec rails server webrick -e production -p 3001 -b 0.0.0.0 -d

 4. 报错提示‘mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h’

sudo apt-get install ruby-dev

 5. 添加启动脚本

vim /etc/init.d/redmined
#!/bin/bash
#redmine   Startup script for the redmine server

#chkconfig:  2345 85 15
Prog=redmine

#find the redmine's pid

ProgPort=3001 #默认端口3000



ReturnCode=`ss -tlnp | awk -F' ' '{print$4}' | grep "\<$ProgPort\>" &> /dev/null;echo $?`

start() {
        ReturnCode=`ss -tlnp | awk -F' ' '{print$4}' | grep "\<$ProgPort\>" &> /dev/null;echo $?`
        if [ $ReturnCode -eq 0 ] &> /dev/null;then
            echo " Redmine is Already Running !!! "
        else
            /usr/bin/ruby2.5 /home/master/redmine-4.2.3/bin/rails server -e  production -b 0.0.0.0 -p $ProgPort -d >/dev/null
            echo -e "Starting redmine ….. \e[32m[ OK ]\e[m"
        fi
}

stop() {
        if [ $ReturnCode  -ne 0 ] &> /dev/null;then
            echo " Redmine is Already  Stopped !!!"     
        else
            PID=$(ps -ef | grep $Prog | grep ruby | grep -v grep | awk '{ print $2 }')
            kill -9 $PID
            echo -e "Stopping redmine ….. \e[32m[ OK ]\e[m"
        fi
}

status() {
        if [ $ReturnCode -eq 0 ] &> /dev/null;then
            echo " Redmine is Running !!! "
        else
            echo " Redmine is Stopped !!! "
        fi
}

case "$1"  in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status
        ;;
    restart)
        stop
        start
        ;;
        *)
        echo "Usage: $Prog {start|stop|status|restart}"
esac

做了一些修改

 

 

参考链接:https://www.cnblogs.com/maowenqiang/p/10616633.html

 

posted @ 2021-12-20 19:54  代码诠释的世界  阅读(401)  评论(0编辑  收藏  举报