項目管理軟件Readmine安裝配置

2018年10月20日11:48:11 發(fā)表評論 9,139 ℃

1、安裝依賴

#yum install curl-devel sqlite-devel libyaml-devel -y  

 

2、安裝rvm

#curl -L https://get.rvm.io | bash -s stable  #網(wǎng)絡(luò)問題可能失敗,多執(zhí)行幾次

如果報錯如下:

項目管理軟件Readmine安裝配置 

執(zhí)行:

#gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

#curl -L https://get.rvm.io | bash -s stable

 

#echo "source /etc/profile.d/rvm.sh" >> /root/.bashrc

#source /etc/profile.d/rvm.sh

 

3、安裝ruby

#rvm list known #查看版本

#rvm install ruby-2.5.1

#gem -v  #安裝好以后查看版本

 

4、更改gem源

#gem source -l    #查看鏡像源

#gem source --remove https://rubygems.org/  #刪除默認(rèn)源

#gem source -a https://ruby.taobao.org  #新增gem的鏡像源(確保只有ruby.taobao.org)

#gem sources -a https://mirrors.aliyun.com/rubygems/ #或者添加這個

 

5、安裝MySQL

a.給Centos添加rpm源,并且選擇較新的源命令:

#wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

#yum -y install mysql57-community-release-el7-7.noarch.rpm

#yum repolist all | grep mysql

#yum-config-manager --disable mysql55-community

#yum-config-manager --disable mysql56-community

#yum-config-manager --enable mysql57-community

#yum repolist enabled | grep mysql

b.安裝MySQL服務(wù)器

#yum install mysql-community-server

#systemctl enable mysqld 設(shè)置開機(jī)啟動

c、設(shè)置mysql的賬號和密碼,并創(chuàng)建redmine數(shù)據(jù)庫

#systemctl start mysqld

#grep "password" /var/log/mysqld.log #查看默認(rèn)密碼

#mysql -u root -p

>set password=password('new password')

>ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; #密碼永不過期

>flush privileges;

>create database redmine character set utf8; # 創(chuàng)建redmine數(shù)據(jù)庫

>create user 'redmine'@'localhost' IDENTIFIED BY 'new password'; #設(shè)置用戶redmine的密碼

>grant all privileges on redmine.* to 'redmine'@'localhost';  #賦予redmine賬號最大權(quán)限

> ALTER USER 'redmine'@'localhost' PASSWORD EXPIRE NEVER;#密碼永不過期

>flush privileges;

 

6、安裝rails和相關(guān)依賴包

#gem install rails  

#gem install rake  

#gem install mysql2  #如果報錯就執(zhí)行yum install mysql-devel  

 

7、安裝redmine

#wget https://www.redmine.org/releases/redmine-3.4.6.tar.gz

#tar -zxvf redmine-3.4.6.tar.gz

#mv redmine-3.4.6 /usr/local/redmine

#cd /usr/local/redmine

#bundle install  #如果報錯An error occurred while installing rmagick (2.16.0), and Bundler cannot continue. 執(zhí)行yum install ImageMagick-devel

 

8、配置redmine并初始化

#cp config/database.yml.example config/database.yml  

#vim config/database.yml #選擇product部分修改數(shù)據(jù)庫密碼

#rake generate_secret_token  #如果報錯Could not find gem 'mysql2 (~> 0.4.6)' in any of the gem sources listed in your Gemfile. 再次執(zhí)行bundle install

#RAILS_ENV=production rake db:migrate #生成表結(jié)構(gòu)  

#RAILS_ENV=production rake redmine:load_default_data #初始化數(shù)據(jù)選擇zh  

 

9、啟動redmine

#nohup /usr/local/rvm/rubies/ruby-2.5.1/bin/ruby /usr/local/redmine/bin/rails server -e  production -b 0.0.0.0 >/dev/null 2>&1 & #nohup后臺啟動

#/usr/local/rvm/rubies/ruby-2.5.1/bin/ruby /usr/local/redmine/bin/rails server -e  production -b 0.0.0.0 -d #或者-d后臺啟動

 

10、添加啟動腳本

# 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

Pid=`ps aux | grep "\<$Prog\>" | pidof ruby`

 

ProgPort=80 #默認(rèn)端口3000

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

 

start() {

        if [ $ReturnCode -eq 0 ] &> /dev/null;then

            echo " Redmine is Already Running !!! "

        else

            /usr/local/rvm/rubies/ruby-2.5.1/bin/ruby /usr/local/redmine/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

            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

#chmod +x /etc/init.d/redmined

#/etc/init.d/redmined start

#chkconfig --add redmined

 

11、訪問項目

#firewall-cmd --add-port=3000/tcp --permanent --zone=public #如果是80 此處就設(shè)置80

#firewall-cmd --reload

http://192.168.133.130:3000 初始賬號admin 密碼admin

項目管理軟件Readmine安裝配置 


12、備份或遷移

只需要備份(或者遷移)mysql的redmine庫,config下面的yml配置文件,以及files下面的附件。

#!/bin/bash

bk_time=`date +"%Y%m%d"`

redmine_dir='/usr/local/redmine'

cd $redmine_dir

tar -zcf /root/backup_data/files/conf_file_${bk_time}.tar.gz files/ config/*.yml  &> /dev/null

mysqldump  redmine | gzip > /root/backup_data/mysql/redmine_${bk_time}.sql.gz


注意: mysql5.6以后不能在命令行直接輸入密碼,解決辦法

#vim /root/.my.cnf

[mysqldump]

user=yourusername

password=yourpassword

host=localhost

【騰訊云】云服務(wù)器、云數(shù)據(jù)庫、COS、CDN、短信等云產(chǎn)品特惠熱賣中

發(fā)表評論

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: