> CentOS > CentOS教程 >

CentOS下配置Ruby on Rails并部署Redmine

git
确保已安装了依赖的包:
[plain] view plaincopy
 
  1. yum install curl  
  2. yum install curl-devel  
  3. yum install zlib-devel  
  4. yum install openssl-devel  
  5. yum install perl  
  6. yum install cpio  
  7. yum install expat-devel  
  8. yum install gettext-devel  

下载git包并编译安装:
[plain] view plaincopy
 
  1. wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz  
  2. tar xzvf git-latest.tar.gz  
  3. cd git-2011-11-30 #你的目录可能不是这个  
  4. autoconf  
  5. ./configure  
  6. make  
  7. sudo make install  

查看git版本:
[plain] view plaincopy
 
  1. git --version  

1.ruby
[plain] view plaincopy
 
  1. sudo yum install ruby  

2.rails
[plain] view plaincopy
 
  1. gem install rails  

3.mysql
[plain] view plaincopy
 
  1. [root@xiaoluo ~]# yum install -y mysql-server mysql mysql-devel  
  2.   
  3.   
  4. [root@xiaoluo ~]# rpm -qi mysql-server  
  5.   
  6.   
  7. [root@xiaoluo ~]# service mysqld start  
  8. [root@xiaoluo ~]# service mysqld restart  
  9. [root@xiaoluo ~]# chkconfig --list | grep mysqld  
  10. mysqld             0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭  
  11. [root@xiaoluo ~]# chkconfig mysqld on  
  12. [root@xiaoluo ~]# chkconfig --list | grep mysql  
  13. mysqld             0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭  
  14. [root@xiaoluo ~]# mysqladmin -u root password 'root'  // 通过该命令给root账号设置密码为 root  

 

4.Redmine

1)mysql

 

CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
2)Database connection configuration

 

Example for a MySQL database using ruby 1.9 (adapter must be set to mysql2):

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: my_password

3)Dependencies installation

 

gem install bundler
bundle install --without development test

 

If ImageMagick is not installed on your system, you should skip the installation of the rmagick gem using:

bundle install --without development test rmagick
4)Session store secret generation

 

  • with Redmine 2.x:
rake generate_secret_token
5) Database schema objects creation

 

 

RAILS_ENV=production rake db:migrate
6) Database default data set

 

 

RAILS_ENV=production rake redmine:load_default_data
7)File system permissions

 

 

The user account running the application must have write permission on the following subdirectories:

  1. files (storage of attachments)
  2. log (application log file production.log)
  3. tmp and tmp/pdf (create these ones if not present, used to generate PDF documents among other things)
  4. public/plugin_assets (assets of plugins)

E.g., assuming you run the application with a redmine user account:

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
8) Test the installation

 

  • with Redmine 2.x:
ruby script/rails server webrick -e production

 

Use default administrator account to log in:

  • login: admin
  • password: admin

You can go to Administration menu and choose Settings to modify most of the application settings.

 
(责任编辑:IT)