FreeBSD_Servers_IV 2017-05-11

Redmineを使っているサーバのお引越しに伴い,改めてインストールからやってみる。
今度の環境は,FreeBSD11

材料




  1. OS Install
  2. update
  3. pkg install
  4. sudo install

iSCSI Initiator Target to TS5400D [#z032c7e5]

FreeBSD 11.0のイニシエータからBuffalo TeraStation TS5400DをターゲットとしてiSCSIで接続した。
iSCSIはSCSI(Small Computer System Interface)をTCP/IPネットワーク上で実現したものである。
iSCSIでは,サーバ側のデバイスを提供する側を「ターゲット」と呼び、サービスを利用する側を「イニシエータ」と呼ぶ。

Target TeraStation側の設定

Tera StationをiSCSIターゲットとして使用するには,最初にボリュームを作成する必要がある。

  1. ボリュームを作成する。
    1. Tera StationにWeb経由でアクセスし,「ディスク」をクリックする。
  2. LVMを有効にする
    1. LVMをクリックし,LVMメニューの「LVMを有効にする」をクリックし,LVMを有効にする。
  3. iSCSIのSWをONにする。
  4. iSCSIメニューに入る。
    1. ボリュームを作成する。
    2. ボリュームを作成するとIQNが表示されるので,メモしておく。

FreeBSD Initiator側の設定

FreeBSD ハンドブック 28.12. iSCSI Initiator and Target Configurationを参照して設定した。

FreeBSD 10以降,iSCSIはカーネルレベルでネイティブに動作するようになったので,デーモンであるiscsidを起動する。

  1. rc.conf
    1. rc.confに以下を追加する。
    2. iscsid_enable=“YES”
  2. iscsidを起動する。(再起動後は不要)
    # service iscsid start

InitiatorからTargetに接続する

とりあえず,Handbookの通り手動でつないでみる。

# iscsictl -A -p 10.10.10.10 -t iqn.xxx.xxx.xxx

繋がったかどうかの確認をしてみる。

# iscsictl
Target Name                 Target Portal  State
iqn.xxx.xxx.xxx.target0     10.10.10.10    Connected: da1
#

Connectedと表示されていれば,/dev/da1としてターゲットを接続できている。

接続できないときは,

# iscsictl
Target Name                 Target Portal  State
iqn                         10.10.10.10    Service unavailable
#

と表示され,コンソールにも以下のメッセージが表示される。

WARNING: 10.10.10.10(iqn): login timed out after 61 seconds; reconnecting

この場合は,Initiatorは,再接続にトライし続けるため,コンソールにメッセージが表示され続ける。
iscsictlコマンドにより明示的に切断する必要がある。

# iscsictl -R -p 10.10.10.10 -t iqn.xxx.xxx.xxx.target0

接続後は...

iscsiにより接続すたあとは,ファイルシステムを作ってマウントすればディスクとして使える。
もちろん,ファイルシステムを作成するのは,最初だけね。

# newfs -U /dev/da0
# mount /dev/da0 /mnt

起動時に自動的にマウントする

/etcにiscsi.confを作成する。

# cat /etc/iscsi.conf
TeraStation { # nickname
    targetaddress = 10.10.10.10
    targetname    = iqn.xxx.xxx.xxx.target0
}

/etc/rc.confにiscsictlを有効にするよう記述する

     :
iscsictl_enable="YES"
iscsictl_flags="-Aa"

iscsi.confを記述することで,ニックネームによる接続/切断が可能となる。

# iscsictl -An TeraStation

だとそのニックネームのターゲットが接続する。
全部接続する場合は,

# iscsictl -Aa

切断は-Aを-Rにすれば良い。

Shutdownの順序

イニシエータであるFreeBSDをShutdownする分には(とりあえず)気にすることなく落とせる。
ターゲットであるTeraStationを落とす場合は,イニシエータ側のFreeBSDがターゲットをマウントしたままになっていると,
iSCSIが応答しなくなるので,ちょうどその時,アクセスすると張り付く。
ターゲットが起動すれば正常に終わるかどうかは別にしてiSCSIの処理からは帰ってくるっぽい。

Targetは,Initiatorより先に落としてはいけない。
Initiatorでは,unmountする前にiscsiデバイスとremoveしてはいけない。
[まっそうだよね。普通にディスクをぶっこ抜いたらどうなるかとおんなじだもんね。]




mysql5.7 [#p3654d95]




Apache-2.4.25 Install [#b9467248]

apache web serverの2.4は,APRと分離されたので,先にapr, apr-utilを
インストールする必要がある。
apr(Apache Portable Runtime)は Apache HTTP Server のサポートライブラリ。
OSとソフトウェアの間でOSなどの環境の違いを吸収するAPI

apr-1.5.2

$ tar xvjf apr-1.5.2.tar.bz2
$ cd apr-1.5.2
$ ./configure
$ make
# make install

apr-util-1.5.4

$ tar xvjf apr-util-1.5.4.tar.bz2
$ cd apr-util-1.5.4
$ ./configure --with-apr=/usr/local/apr --with-mysql=/usr/local/mysql
もしかしたら
$ ./configure --with-apr=/usr/local/apr --with-mysql=/usr/local/mysql --with-iconv=/usr/local
$ make
# make install

pcre-8.40 : ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.bz2

$ tar xvjf pcre-8.40.tar.bz2
$ ./configure
$ make
# make install

または,portsでインストール

# cd /usr/ports/devel/pcre
# make
# make install
# make clean

または,
pkgでさくっとインストール

# pkg install pcre

httpd-2.4.25

$ tar xvjf httpd-2.4.25.tar.bz2
$ ./configure --enable-so
$ make
# make install

テストしてみる。

# /usr/local/apache2/bin/apachectl start

ブラウザからIPアドレス直打ちで "It works!"

自動起動の設定
/etc/rc.confに以下を記述

apache2_enable="YES"
apache2_http_accept_enable="YES" <-- see http://nhh.mo-blog.jp/ttt/2006/10/freebsd_aparch2_b1ae.html

/usr/local/etc/rc.d/にapache.shを配置

php-7.1.5

PHPをインストールする前にlibxml2をインストールする。

apxsが存在せずとエラーがでた。
よくよく見るとperlが見つからない。

$ perl -v

としてもエラーになっていた。 というわけで,pkgでさくっとインストール

$ sudo pkg install perl5

でもって,apxsのパスを修正

libxml2はpkgを使う

$ sudo pkg install libxml2

PHPのインストール

$ tar xvjf php-7.1.5.bz2
$ cd php-7.1.5
$ ./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-mbstring \
--enable-mysqlnd
$ make
$ make test
$ sudo make install

phpを使うためにapacheの設定を変更する。
変更するファイルは、/usr/local/apache2/conf/httpd.conf

LoadModule php5_module     modules/libphp7.so  ←はphpでインストールされるはず
AddType application/x-httpd-php  .php

ImageMagick

ImageMagickは,多くのライブライに依存しているので,パッケージでインストールしてしまう。

# pkg install imagemagick-nox11
===========================================================================

Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

bsddb           databases/py-bsddb
gdbm            databases/py-gdbm
sqlite3         databases/py-sqlite3
tkinter         x11-toolkits/py-tkinter

===========================================================================
Message from trousers-0.3.14_1:
To run tcsd automatically, add the following line to /etc/rc.conf:

tcsd_enable="YES"

You might want to edit /usr/local/etc/tcsd.conf to reflect your setup.

If you want to use tcsd with software TPM emulator, use the following
configuration in /etc/rc.conf: 

tcsd_enable="YES"
tcsd_mode="emulator"
tpmd_enable="YES"

To use TPM, add your_account to '_tss' group like following:

# pw groupmod _tss -m your_account
Message from freetype2-2.8:
The 2.7.x series now uses the new subpixel hinting mode (V40 port's option) as
the default, emulating a modern version of ClearType. This change inevitably
leads to different rendering results, and you might change port's options to
adapt it to your taste (or use the new "FREETYPE_PROPERTIES" environment
variable).

The environment variable "FREETYPE_PROPERTIES" can be used to control the
driver properties. Example:

FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
        cff:no-stem-darkening=1 \
        autofitter:warping=1

This allows to select, say, the subpixel hinting mode at runtime for a given
application.

The controllable properties are listed in the section "Controlling FreeType
Modules" in the reference's table of contents
(/usr/local/share/doc/freetype2/reference/ft2-toc.html, if documentation was installed).
Message from ghostscript9-agpl-base-9.16_5:
Note: in order to use the script "dvipdf", dvips must be installed.
This program is provided by another package print/tex-dvipsk. 

FAPIfontmap and FAPIcidfmap in /usr/local/share/ghostscript/9.16/Resource/Init
have to be configured if you want to use FAPI feature.
Message from liblqr-1-0.4.2:
==========================================================================
NOTE: In order to compile examples for liblqr, you will
also need pngwriter port (/usr/ports/graphics/pngwriter).
Examples are located in /usr/local/share/examples/liblqr-1
==========================================================================
#

Mercurial [#h1f5ed17]

Pythonインストール

Pythonは,pkgでインストールしてしまう。

# pkg install python

Mercurialインストール

Mercurial自体のインストールはportsでインストールしてしまう。

# cd /usr/ports/devel/mercurial
# make; make install

hgユーザの作成

hgユーザを作成しリポジトリのオーナー/グループをhgにしておく。
ユーザー: hg (143)
グループ: hg (143)

分散処理と中央集権

MercurialはサーバにPushするためにSSHとHTTP経由が使える(らしい)。
今回は,HTTP経由を選択した。

HTTP経由で公開するには,hgweb.cgiを公開する必要がある。
今回portsでインストールしたMercurial4.2では,hgweb.fcgiとhgweb.wsgiが
/usr/local/share/mercurial/www
にあり,hgweb.cgiは無かった。
Mercurial Wikiでもhgweb.cgiを使えるような記述になっていたので
sourceを覗いたら,直下にhgweb.cgiがありました。
これをWebサーバにcgi-binにコピーして使う。
ちなみに/usr/local/share/mercurial/contribにはhgrcとかのサンプルもあった。(テストインストールの時は気がつかなかったorz...)

hgweb.cgi

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://www.mercurial-scm.com/wiki/PublishingRepositories 

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/PATH/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")
import os
os.environ["HGENCODING"] = "UTF-8"

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)

hgweb.config

[web]
description = repository
author = mail@address
push_ssl = false
allow_push = *

[trusted]
users=hg
groups=hg

[collections]
/PATH/hg/repos = /PATH/hg/repos

[paths]

Redmine

Installing Redmine によれば,現時点(July 14th, 2017)でのrubyバージョンとRedmineのバージョンは以下の通り。

Redmine versionSupported Ruby versionsRails version used
3.4ruby 1.9.34, 2.0.03, 2.1, 2.22, 2.3, 2.41Rails 4.2
3.3ruby 1.9.34, 2.0.03, 2.1, 2.22, 2.3Rails 4.2
3.2ruby 1.9.34, 2.0.03, 2.1, 2.22Rails 4.2

Redmine 3.4, Ruby 2.3, Rails 4.2の組合せでインストールする。

Ruby [#c7eab92c]

Rubyはパッケージでインストールする。

# pkg install lang/ruby23
Message from ruby-2.3.4_1,1:
====
Some of the standard commands are provided as separate ports for ease
of upgrading:

        devel/ruby-gems:        gem - RubyGems package manager
        devel/rubygem-rake:     rake - Ruby Make

And some of the standard libraries are provided as separate ports
since they require extra dependencies:

        databases/ruby-gdbm:    GDBM module

Install them as occasion demands.
====

gem [#q85238f0]

# pkg install devel/ruby-gems

gem自身でgemのアップデートをする

# gem update --system
Latest version currently installed. Aborting.

ということで,アップデートの必要はないらしい。

rails [#d97d205a]

# gem install rails
   :
   :
Done installing documentation for i18n, thread_safe, 
tzinfo, minitest, concurrent-ruby, activesupport, 
rack, rack-test, mini_portile2, nokogiri, loofah, 
rails-html-sanitizer, rails-dom-testing, builder, 
erubi, actionview, actionpack, activemodel, arel, 
activerecord, globalid, activejob, mime-types-data, 
mime-types, mail, actionmailer, nio4r, 
websocket-extensions, websocket-driver, actioncable, 
rake, thor, method_source, railties, bundler, sprockets, 
sprockets-rails, rails after 47 seconds
38 gems installed

さて,ここまでが,redmineをインストールするための種 ここから先は,redmineにインストール手順に従ってっやてみましょ。

Redmine

redmienのソースをサイトからgetする。

これを展開してインストールしていくんだけど,展開した先でredmineが動作する(?)
ようなので,/usr/local/redmineに配置する。

% tar xvzf redmine-3.4.2
# mv redmine-3.4.2 /usr/local/redmine-3.4.2
# cd /usr/local/redmine-3.4.2

config/database.example.yml をコピーして config/database.yml を作成する。

# cp config/database.yml.example config/database.yml
# vi database.yml
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: MY_PASSWORD
  encoding: utf8
[redmine.jpのインストール手順では,記載されて]
[いなかったので,コメントにしておく          ]
[--MySQLのC bindingをインストール            ]
[ # gem install mysql2                       ]
[Redmine.jpのインストールでmysqlに失敗する場合,rails wiki pages ]
[を参照せよとあるので,そちらをみて,                            ]
[ # gem install mysql – –with-mysql-config=/usr/bin/mysql_config ]
[を実行してみた。                                                ]
[
[ # gem install mysql - -with-mysql-config=/usr/local/mysql/bin/mysql_config]
[Fetching: mysql-2.8.1.gem (100%)                                           ]
[Building native extensions.  This could take a while...                    ]
[Successfully installed mysql-2.8.1                                         ]
[1 gem installed                                                            ]
[Installing ri documentation for mysql-2.8.1...                             ]
[Installing RDoc documentation for mysql-2.8.1...                           ]
[                                                                           ]
[ # setenv LD_LIBRARY_PATH /usr/local/mysql/lib                             ]
[ # ldconfig                                                                ]
[ # gem install mysql -- --with-mysql-lib=/usr/local/mysql/lib              ]
[                     --with-mysql-config=/usr/local/mysql/bin/mysql_config ]
[ # rake db:migrate                                                         ]
[                                                                           ]   
[このページを参考にした                                                     ]
[>http://www.binrand.com/post/1080301-gems-ruby-undefined-method-init-for-mysql-class.html]
# mkdir tmp public/plugin_assets 
# chown -R redmine:redmine files log tmp public/plugin_assets
# chmod -R 755 files log tmp public/plugin_assets

WEBrickが起動したら、ブラウザで http://localhost:3000/にアクセスする

デフォルトでは,ユーザ名,パスワードともadmin




以降順次更新




Apacheとpassengerを連携させる

setenv APXS2 /usr/local/sbin/apxs
setenv APR_CONFIG /usr/local/lib/apache2/apr-config
setenv APU_CONFIG /usr/local/lib/apache2/apu-config

2012-09-04

rake db:migrateとpassengerでエラー

結局,このエラーは,passengerにてApacheとrailsを連携したときもでている。

undefined method `init' for Mysql:Class

切り分けるために素の状態からインストールしていく。
最初にインストールしたときは,ruby1.9系だった。
2回目は,ruby1.8系だった。rubyが1.8系の時はマイグレーションの時
LD_LIBRARY_PATHを設定するとうまくいくが,
結局passengerでapacheと連携するとうまくいかいない。

なので,rubyを1.9系にしてpassengerでApacheとRailsの連携まで行ってみる。

% ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [amd64-freebsd9]

gemのインストール

# cd /usr/ports/devel/ruby-gems
# make install clean
# gem upate --system
Latest version currently installed. Aborting.
#

ちゃんとインストールできたっぽい。

このあと,railsのインストールに進むのである。gem install railsでインストールされるrailsのバージョンは,3.2.8。

ところが,redmineのbundlerでインストールされるrailsは3.2.6。

この差が気になるので,今回は,railsのインストールはredmineのbundlerに任せることにして
データベースを設定しましょ。

データベースを起動して,ユーザを作る

まえのまま。

さて,redmineをインストール

  1. cd /usr/local/
  2. tar xvzf redmine-2.0.3.tar.gz
  3. mf redmine-2.0.3 redmine
  4. cd redmine/config
  5. cp database.yml.example database.yml
  6. vi database.yml productionの項目を合わせる
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: password
  1. gem install bundler --no-rdoc --no-ri bundlerがインストールできたので,
    # cd /usr/local/redmine
    # bundle install --without development test postgresql sqlite
    がしかし,mysqlのところでエラー発生。
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native  extension.
        /usr/local/bin/ruby18 extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no 
checking for mysql_query() in -lmysqlclient... no 
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options. 

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby18
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mygcclib
        --without-mygcclib
        --with-mysqlclientlib
        --without-mysqlclientlib
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql- 2.8.1/ext/mysql_api/gem_make.out
An error occurred while installing mysql (2.8.1), and Bundler cannot continue.
Make sure that `gem install mysql -v '2.8.1'` succeeds before bundling.

redmine.jpに1.0系でインストールするときはmysql2を使えと書いてあったので,

# gem install mysql2

を行ったあと,mysqlも除いてbundlerでインストールしてみる。

# bundle install --without development test postgresql sqlite mysql

無事に終わった模様

セッションストア鍵を作ります。

# rake generate_secret_token
rake aborted!
no such file to load -- iconv

(See full trace by running task with --trace)

おや,iconvでエラーですか。ならば,

# gem install iconv
Fetching: iconv-0.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing iconv:
        ERROR: Failed to build gem native extension. 

        /usr/local/bin/ruby18 extconf.rb
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

そうですか,portsのconverterからruby-iconvをインストールする。

# cd /usr/ports/converters/ruby-iconv
# make install clean
# rake generate_secret_token
#

成功!

さて,次が問題のマイグレーション

# rake db:migrate RAILS_ENV=production

rake aborted!
Please install the mysql adapter: `gem install activerecord-mysql-adapter`  (mysql is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

ん?いままでとはちょっと違うメッセージ
メッセージの通りしてみましょ。

# gem install activerecord-mysql-adapter

gem i activerecord-mysql-adapter
ERROR:  Could not find a valid gem 'activerecord-mysql-adapter' (>= 0) 
in any repository

activerecord-mysql-adapterの意味が違ったか。うーむ。

とりえあず,mysql2をuninstallしてmysqlをインストールしてみる。 今度は,mysql-dirを指定してみる。

# gem install mysql -- --with-mysql-dir=/usr/local/mysql
Building native extensions.  This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
Installing RDoc documentation for mysql-2.8.1...

素直に入った。

さて...

# gem install mysql -- --with-mysql-dir=/usr/local/mysql \
                       --with-mysql-include=/usr/local/mysql/include \
                       --with-mysql-lib=/usr/local/mysql/lib

なんか,Provided configuration options:にmysql関連のオプションがあったので,こんふぃぐ以外を全部つけてみた。

# rake db:migrate RAILS_ENV=production
   :
   :

成功!

# rake redmine:load_default_data REILS_ENV=production

webricで確認してきた。ふぅ。

Passengerで連携 #なんかできそうな気がしてきた。

# gem install passenger
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions.  This could take a while...
Fetching: daemon_controller-1.0.0.gem (100%)
Fetching: passenger-3.0.17.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-1.0.0
Successfully installed passenger-3.0.17
3 gems installed

passengerがインストールできたのでコマンドですね。

# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.17.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application. 

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
 
--------------------------------------------

Checking for required software...
 * GNU C++ compiler... found at /usr/bin/g++
 * Curl development headers with SSL support... not found
 * OpenSSL development headers... found
 * Zlib development headers... found
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/local/bin/rake
 * rack... found
 * Apache 2... not found
 * Apache 2 development headers... not found
 * Apache Portable Runtime (APR) development headers... not found
 * Apache Portable Runtime Utility (APU) development headers... not found

 Some required software is not installed.
 But don't worry, this installer will tell you how to install them.

Press Enter to continue, or Ctrl-C to abort.

見つからないといっているのは,curlとapache関連

まずは,curl

# cd /usr/ports/ftp/curl
# make install clean;

次にapache関連

setenv APXS2 /usr/local/apache2/bin/apxs
setenv APR_CONFIG /usr/local/apache2/bin/apr-1-config
setenv APU_CONFIG /usr/local/apache2/bin/apu-1-config

再度,passenger-install-apache2-moduleを実行すると今度は,必要な素材が見つかってapache用のモジュールが生成された。

で,これをapacheに設定するばよいのね。

 LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
 PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.17
 PassengerRuby /usr/local/bin/ruby18

サブディレクトリをredmineにする

シンボリックリンクを使って,redmineをapache配下に

# ln -s /usr/local/redmine/public /usr/local/apache/htdocs/redmine

Apacheへの設定追加

RailsBaseURI /redmine

2012-09-06

VMマシン上でテストしていたんだけど,本機のテスト環境でインストールしようとしたらやっぱり,「undefined method `init' for Mysql:Class」に悩まされる。

この前dbはmysql一本で行こうってことにしたけど,ここは,SQLite3を使ってみたら,あっさり稼働した。

本番機は,SQLiteかな。

RoRとMySQLの連携で悩むよりRedmineを使っていきたいし。 http://htrmine.blog52.fc2.com/category3-1.html


2012-09-08

本機の環境は,FreeBSD71 #今度アップしよう + MySQL5.1
ここでは,undefined method `init' for Mysql:Classに悩まされた。mysql2を使えば解決するとかruby-mysqlを使えば大丈夫だとか。

config/database.ymlのadapterをmysqlからmysql2に変えたりしたけど効果なしだった。 これは,どうもruby1.8が使われていたためにmysql2を使用していなかったらしい。

いろいろなページを眺めていて, FreeBSD 9.0 + Redmine + Ruby19

# Install required dependancies
echo "RUBY_VERSION=1.9.3" >> /etc/make.conf

によりrubyのバージョンを固定すれば...と さっそく,make.confに記述し,ruby, gem, bundlerを再インストールした。

bundlerによりredmine関連のモジュールをインストールするときにmysqlの項目がmysql2に代わっていた。

その後,rake db:migrateを行うと問題なく終了!

これで,mysqlを使うことができる。

#mysqlを必ず使わなくてはならないわけぢゃないんだけど,

#できないと気になるじゃん。

評価で使ってもらおうと思ったらどかーんと使ってしまっているユーザもいるので,sqliteからmysqlへデータの移行をしなくちゃ。

最初から飛ばすぜっって感じでいろいろ体験できちゃう。


2012-09-10

まだまだ続いていたりする。

ruby1.9系のテストをしていたら,ruby1.8系でテストドライブしていたRedmineを止めてしまったので,ruby1.8系に戻した。

そうしたらruby1.8系と1.9系が混在していた環境となってしまい,エラーが出ていなかったところでもエラーが報告されるようになってしまった。

なので,rubyを含め,Redmine関連でインストールしたものを全て削除した。

改めてruby1.9系で,Redmine環境を作ってwebrickで動作していることを確認したので, passengerを入れてApacheと連携させようとしたら...奥さんっ!

NotImplementedError: fork() function is unimplemented on this machine

forkのエラーが出る orz...

thread forkとprocess forkの違いという記述もどこかで見つけた。そうするとApacheのコンフィグレーションも関連しているかもしれないなと。

ということで,現状では,ruby1.8系でRedmineをドライブすることにする。


Last-modified: 2022-05-05 (木) 22:27:10