CentOS下配置Ruby on Rails并部署Redmine

分类:CentOS教程 阅读:31699 次

git
确保已安装了依赖的包:
  1. yuminstallcurl
  2. yuminstallcurl-devel
  3. yuminstallzlib-devel
  4. yuminstallopenssl-devel
  5. yuminstallperl
  6. yuminstallcpio
  7. yuminstallexpat-devel
  8. yuminstallgettext-devel

下载git包并编译安装:
  1. wgethttp://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
  2. tarxzvfgit-latest.tar.gz
  3. cdgit-2011-11-30#你的目录可能不是这个
  4. autoconf
  5. ./configure
  6. make
  7. sudomakeinstall

查看git版本:
  1. git--version

1.ruby
  1. sudoyuminstallruby

2.rails
  1. geminstallrails

3.mysql
  1. [root@xiaoluo~]#yuminstall-ymysql-servermysqlmysql-devel
  2. [root@xiaoluo~]#rpm-qimysql-server
  3. [root@xiaoluo~]#servicemysqldstart
  4. [root@xiaoluo~]#servicemysqldrestart
  5. [root@xiaoluo~]#chkconfig--list|grepmysqld
  6. mysqld0:关闭1:关闭2:关闭3:关闭4:关闭5:关闭6:关闭
  7. [root@xiaoluo~]#chkconfigmysqldon
  8. [root@xiaoluo~]#chkconfig--list|grepmysql
  9. mysqld0:关闭1:关闭2:启用3:启用4:启用5:启用6:关闭
  10. [root@xiaoluo~]#mysqladmin-urootpassword'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 tomysql2):

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 fileproduction.log)
  3. tmpandtmp/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 toAdministrationmenu and chooseSettingsto modify most of the application settings.