環境
Ubuntu 14.04LTS
手順
パッケージの取得
# Download Redmine package wget http://www.redmine.org/releases/redmine-2.6.1.tar.gz tar xvzf redmine-2.6.1.tar.gz sudo mv redmine-2.6.1 /opt/ # Install Ruby & Rails sudo apt-get install ruby ruby-dev make zlib1g-dev sudo gem install rails # Install MySQL sudo apt-get install mysql-server mysql-client libmysqld-dev sudo gem install mysql2
DBの作成
my_passwordは適宜変える。
$ mysql -u root -p mysql > CREATE DATABASE redmine CHARACTER SET utf8; mysql > CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password'; mysql > GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; mysql > exit;
DBの設定
cd /opt/redmine-2.6.1/config/
cp database.yml.example database.yml
vim database.yml
以下を設定
production: adapter: mysql2 database: redmine host: localhost username: redmine password: my_password encoding: utf8
いろいろ設定
sudo gem install bundler sudo apt-get update sudo apt-get install imagemagick libmagickwand-dev sudo gem install rmagick -v '2.13.4' bundle install --without development test rake generate_secret_token cd /opt/redmine-2.6.1/ RAILS_ENV=production rake db:migrate RAILS_ENV=production rake redmine:load_default_data
メールの設定
今回はsendmailコマンドを使う。
# Mail sudo apt-get install sendmail cd /opt/redmine-2.6.1/config/ cp configuration.yml.example configuration.yml vim configuration.yml
以下を設定。
production: email_delivery: delivery_method: :sendmail
WEBサーバーの起動
WEBrickの場合
cd /opt/redmine-2.6.1/ ruby script/rails server --daemon webrick -e production
http://<サーバー名>:3000から入れる。初期ユーザーはadmin:adminである。
Apacheの場合
sudo gem install passenger sudo apt-get install build-essential libcurl4-openssl-dev libssl-dev apache2-mpm-worker apache2-threaded-dev libapr1-dev libaprutil1-dev sudo passenger-install-apache2-module sudo ln -s ../sites-available/redmine.conf /etc/apache2/sites-enabled/redmine.conf sudo vim /etc/apache2/sites-available/redmine.conf
以下を記述。
LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-4.0.58/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /var/lib/gems/1.9.1/gems/passenger-4.0.58 PassengerDefaultRuby /usr/bin/ruby1.9.1 </IfModule> <VirtualHost *:80> ServerName ホスト名 DocumentRoot /opt/redmine-2.6.1/public <Directory /opt/redmine-2.6.1/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: Require all granted </Directory> </VirtualHost>
Apacheを再起動
sudo service apache2 restart
Apache + SSL
sudo su a2enmod ssl cd /etc/apache2 openssl genrsa -des3 1024 > server.key openssl req -new -key server.key > server.csr openssl x509 -in server.csr -days 365 -req -signkey server.key > server.crt vim /etc/apache2/sites-available/redmine.conf
以下を追加
<IfModule mod_ssl.c> <VirtualHost *:443> ServerName ホスト名 DocumentRoot /opt/redmine-2.6.1/public <Directory /opt/redmine-2.6.1/public> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/server.crt SSLCertificateKeyFile /etc/apache2/server.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost> </IfModule>
apacheを再起動する。
- 作者: 小川明彦,阪井誠
- 出版社/メーカー: 翔泳社
- 発売日: 2010/10/13
- メディア: 大型本
- 購入: 16人 クリック: 337回
- この商品を含むブログ (52件) を見る