CentOS下配置Ruby on Rails並部署Redmine

0.git
確保已安裝了依賴的包:
yum install curl
yum install curl-devel
yum install zlib-devel
yum install openssl-devel
yum install perl
yum install cpio
yum install expat-devel
yum install gettext-devel

下載git包並編譯安裝:
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.gz
tar xzvf git-latest.tar.gz
cd git-2011-11-30 #你的目錄可能不是這個
autoconf
./configure
make
sudo make install

查看git版本:
git --version

1.ruby
sudo yum install ruby

2.rails
gem install rails

3.mysql
[root@xiaoluo ~]# yum install -y mysql-server mysql mysql-devel


[root@xiaoluo ~]# rpm -qi mysql-server


[root@xiaoluo ~]# service mysqld start
[root@xiaoluo ~]# service mysqld restart
[root@xiaoluo ~]# chkconfig --list | grep mysqld
mysqld             0:關閉    1:關閉    2:關閉    3:關閉    4:關閉    5:關閉    6:關閉
[root@xiaoluo ~]# chkconfig mysqld on
[root@xiaoluo ~]# chkconfig --list | grep mysql
mysqld             0:關閉    1:關閉    2:啓用    3:啓用    4:啓用    5:啓用    6:關閉
[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.


D

發佈了50 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章