【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 @   代码诠释的世界  阅读(415)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示