goo blog サービス終了のお知らせ 

つれづれなるまゝに

単なる作業メモ。主に、Linux, arduino, raspberry piとか?

redmineのインストール db編

2013-11-03 21:07:44 | linux
ということで、先にpostgresの設定

1) パッケージのインストール

apt-get install postgresql


2) DBの初期設定

postgresユーザができているので、パスワードを設定しsu -、psqlでひとまずdbにログインできたらOK。

psql -lを打ってみると

List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 |
template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)

という状態だった。

再度psqlでログインして、以下の設定を行う。

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';

※'my_password' は適宜変更しないとねっ。間違ってそのまま打っちゃったよw そんな時はalterで変更だねっ^^;

CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

psql -lを打ってみると

List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 |
redmine | redmine | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 |
template0 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | ja_JP.UTF-8 | ja_JP.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)

できてるできてる。

/var/lib/redmine/configに移動して、configuration.yml.exampleをもとに、configuration.yml作成。
例ではipaフォントを指定していたので、私もIPAフォントをwgetで落として/usr/share/fontsに解凍して設定。


3) database.ymlの設定

以下のように設定

production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: "ひみつ"
encoding: utf8
schema_search_path: public

redmineのインストール

2013-11-03 20:19:39 | linux
さて、それではredmineをインストール。
参考は、Redmine.JP


1) bundlerのインストール

~$ rvmsudo gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...

~$ rvmsudo bundle install --without development test
Bundler::GemfileNotFound

ありゃ、早速問題が、というかそりゃないよね。

先に、/var/lib/redmineにSubversionでリリースパッケージをダウンロード。
#UbuntuにはSubversionが入ってないので、その前にapt-getしておく

/var/lib$ sudo svn checkout http://svn.redmine.org/redmine/branches/2.3-stable redmine

/var/libというインストール先はRedmine.JPでpassengerでredmineを動作させる場合のケースに書いてあったパスを採用した。/var/lib/redmine配下にGemfileがあることを確認。


2) bundlerの実行

/var/lib/redmine$ rvmsudo bundle install --without development test
Please configure your config/database.yml first
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Installing i18n (0.6.1)
Using multi_json (1.8.2)
Installing activesupport (3.2.13)
Installing builder (3.0.0)
Installing activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Installing actionpack (3.2.13)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Installing actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.38)
Installing activerecord (3.2.13)
Installing activeresource (3.2.13)
Using bundler (1.3.5)
Installing coderay (1.0.9)
Using rack-ssl (1.3.3)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.18.1)
Installing railties (3.2.13)
Installing jquery-rails (2.0.3)
Installing net-ldap (0.3.1)
Installing ruby-openid (2.3.0)
Installing rack-openid (1.4.0)
Installing rails (3.2.13)
Installing rmagick (2.13.2)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in /usr/local/rvm/gems/ruby-1.9.3-p448/bin:/usr/local/rvm/gems/ruby-1.9.3-p448@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p448/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

*** 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/rvm/rubies/ruby-1.9.3-p448/bin/ruby


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p448/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p448/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

An error occurred while installing rmagick (2.13.2), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.


ぬぬ。先にconfig/database.yml を設定しろというメッセージと、rmagickでエラーが、、、

<続く>

rails 4のアンインストール

2013-11-02 23:30:10 | linux
Railsを3.x系にダウングレードするために、いったんRailsをアンインストールすることに

あっさり

gem uninstall rails

でOKと思ったが、gemはアンインストール成功メッセージを出すし、gem search -lで見つからないのだが、rails -vを実行するとちゃんと

Rails 4.0.0

とかえってくる。。。

で、もっと調べてみたところ、"gem uninstall rails"ではだめらしく、

gem uninstall railties -v '4.0.0'

とする必要があるらしい。いろんなところに落とし穴があるなと。。。


アンインストールできたので、3.2.14をインストール

~$ rvmsudo gem install rails -v '3.2.14'
Fetching: activesupport-3.2.14.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.14.gem (100%)
Fetching: rack-1.4.5.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: sprockets-2.2.2.gem (100%)
Fetching: actionpack-3.2.14.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: activerecord-3.2.14.gem (100%)
Fetching: activeresource-3.2.14.gem (100%)
Fetching: actionmailer-3.2.14.gem (100%)
Fetching: rack-ssl-1.3.3.gem (100%)
Fetching: json-1.8.1.gem (100%)
Building native extensions. This could take a while...
Fetching: rdoc-3.12.2.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Fetching: railties-3.2.14.gem (100%)
Fetching: rails-3.2.14.gem (100%)
Successfully installed activesupport-3.2.14
Successfully installed builder-3.0.4
Successfully installed activemodel-3.2.14
Successfully installed rack-1.4.5
Successfully installed rack-cache-1.2
Successfully installed journey-1.0.4
Successfully installed sprockets-2.2.2
Successfully installed actionpack-3.2.14
Successfully installed arel-3.0.2
Successfully installed activerecord-3.2.14
Successfully installed activeresource-3.2.14
Successfully installed actionmailer-3.2.14
Successfully installed rack-ssl-1.3.3
Successfully installed json-1.8.1
Successfully installed rdoc-3.12.2
Successfully installed railties-3.2.14
Successfully installed rails-3.2.14
17 gems installed
Installing ri documentation for activesupport-3.2.14...
Installing ri documentation for builder-3.0.4...
Installing ri documentation for activemodel-3.2.14...
Installing ri documentation for rack-1.4.5...
Installing ri documentation for rack-cache-1.2...
Installing ri documentation for journey-1.0.4...
Installing ri documentation for sprockets-2.2.2...
Installing ri documentation for actionpack-3.2.14...
Installing ri documentation for arel-3.0.2...
Installing ri documentation for activerecord-3.2.14...
Installing ri documentation for activeresource-3.2.14...
Installing ri documentation for actionmailer-3.2.14...
Installing ri documentation for rack-ssl-1.3.3...
Installing ri documentation for json-1.8.1...
Installing ri documentation for rdoc-3.12.2...
Installing ri documentation for railties-3.2.14...
Installing ri documentation for rails-3.2.14...
Installing RDoc documentation for activesupport-3.2.14...
Installing RDoc documentation for builder-3.0.4...
Installing RDoc documentation for activemodel-3.2.14...
Installing RDoc documentation for rack-1.4.5...
Installing RDoc documentation for rack-cache-1.2...
Installing RDoc documentation for journey-1.0.4...
Installing RDoc documentation for sprockets-2.2.2...
Installing RDoc documentation for actionpack-3.2.14...
Installing RDoc documentation for arel-3.0.2...
Installing RDoc documentation for activerecord-3.2.14...
Installing RDoc documentation for activeresource-3.2.14...
Installing RDoc documentation for actionmailer-3.2.14...
Installing RDoc documentation for rack-ssl-1.3.3...
Installing RDoc documentation for json-1.8.1...
Installing RDoc documentation for rdoc-3.12.2...
Installing RDoc documentation for railties-3.2.14...
Installing RDoc documentation for rails-3.2.14...