centos7 redmine安裝過程

 

 mysql安裝配置
 

redmine 部署過程

redmin官方文檔寫的太爛加上不熟悉ruby搞了半天,回到家後以爲仍是記錄下好,但願能夠幫助有須要的人,少走彎路.css

版本說明

下面的版本很重要
redmine 版本 3.3 官方居然給了個百度雲盤mysql

wget http://olvimidkv.bkt.clouddn.com/redmine-3.3.0.tar.gz

系統版本 centos7.2nginx

ruby 版本 2.3.3
gem 版本 2.6.12
rails 版本 4.2.6web

準備工做

新裝系統的話就更新下吧,不是的話,就儘可能不要這樣更新sql

yum update

安裝epel源數據庫

yum install epel-release 

依賴vim

yum install curl-devel sqlite-devel libyaml-devel 

開始部署

ruby yum安裝版本對不上 源碼安裝各類報錯,應該是openssl版本低 因而不折騰了 直接rvmcentos

安裝rvm及ruby

rvm 能夠安裝管理多個ruby版本ruby

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3     curl -L https://get.rvm.io | bash -s stable source /etc/profile.d/rvm.sh  #set up system environment for Ruby, 這步不可少 rvm reload   rvm install 2.3.3

簡單的使用bash

rvm list 查看ruby rvm use 2.2.0 使用ruby rvm install xxxx 安裝一個版本的ruby rvm remove xxxx 卸載一個版本的ruby 

安裝rails及rake

上一步安裝完成以後,下面的就很簡單了.

若是嫌慢能夠換阿里的源

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

安裝redmine

[root@ihuilian ~]#yum install -y mysql mysql-server
[root@ihuilian ~]#yum install -y mysql*  
[root@ihuilian ~]# chkconfig mysqld on
[root@ihuilian ~]# service mysqld start
[root@ihuilian ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
 ... skipping.
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!

[root@ihuilian ~]# setenforce 0

[root@ihuilian ~]# mysql -uroot -hlocalhost -phuilian123
mysql> create database redmine_db character set utf8;
Query OK, 1 row affected (0.23 sec)

mysql> create user 'redmine_admin'@'localhost' identified by 'redmine_pass';

mysql> grant all privileges on redmine_db.* to "redmine_admin"@"localhost";
Query OK, 0 rows affected (0.14 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

[root@ihuilian redmine]# tar zxf redmine-2.5.0.tar.gz

[root@ihuilian redmine]# ln -sv redmine-2.5.0 redmine
[root@ihuilian redmine]# cd redmine/config
[root@ihuilian config]# cp database.yml.example database.yml
修改以下
production:
  adapter: mysql2
  database: redmine_db
  host: 192.168.74.128
  username: redmine_admin
  password: "redmine_pass"
  encoding: utf8


[root@ihuilian redmine]# bundle install

  

redmine 須要用到數據庫,因此先裝個mysql或者meriadb(centos7默認meriadb)
修改數據庫默認字符爲utf8
在數據庫配置文件/etc/my.cnf(centos7在/etc/my.cnf.d/下面)的[mysqld]下面加上

character-set-server=utf8

而後啓動數據庫,建立一個數據庫 redmine

用戶名密碼隨意
權限以下,若是你用root這個就能夠忽略.

grant all on redmine.* to redmine; grant all on redmine.* to redmine @localhost; set password for redmine@localhost=password('redmine');

把你下載的redmie解壓放到須要放的目錄下面,而後進入redmine/config,下面的操做都在這個目錄下

cd database.yml.example database.yml

修改內容以下,數據庫名不要擅自改,不管你用的是mysql仍是meriadb

production:  adapter: mysql2  database: redmine  host: localhost  username: redmine  password: "redmine"  encoding: utf8

建立表,這一步會出現各類問題,若是按照上面的裝的話,基本就沒有什麼問題了.

提示缺乏ruby擴展,不想一個個裝的話,在當前目錄下

bundle install 而後 rake db:migrate RAILS_ENV="production"

載入配置

rake redmine:load_default_data RAILS_ENV="production"

這時候會提示你選擇語言,輸入:zh

爲rails生產cookie祕鑰

rake generate_secret_token

啓動redmine

使用如下命令啓動 -d 是把輸出打印到後臺,ruby使用絕對路徑

/usr/local/rvm/rubies/ruby-2.3.3/bin/ruby /home/work/redmine/bin/rails server webrick -e production -d

這樣會啓動一個監聽localhost的3000端口

可使用

curl http://localhost:3000

檢查,沒問題的話,使用Nginx作個反向代理就能夠了.

server { listen 80; server_name redmine.xxx.com; access_log logs/redmine_access.log main; error_log logs/redmine_error.log; location / { proxy_pass http://localhost:3000; } }
相關文章
相關標籤/搜索