Ubuntu10.4でRedmine
※※※
Ubuntu10.4でRedmine1.0.1(まとめ直し版)にRedmine1.0.1でのインストール手順をまとめました。
当エントリの情報も整理した上でまとめ直していますので、こちらを見るのをおすすめします。
※※※
Ubuntu10.4(virtualbox)にRedmineをインストールしてみました。
やったことは以下の通り。
GitやSVNとの連携はまだ出来ていないので、あとでやります。
[Rubyのインストール]
Ruby本体のインストール
$ sudo apt-get install ruby $ ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
Ruby Developperのインストール(足りないライブラリなどがあるため)
$ sudo apt-get install ruby1.8-dev
[Railsのインストール]
Railsをインストールしようとするが失敗
プロキシが邪魔してインストールできない模様。
$ sudo gem install rails ERROR: http://gems.rubyforge.org/ does not appear to be a repository ERROR: could not find gem rails locally or in a repository
ググって調べると同じようなエラーが発生した人を発見。参考にする。
参考;[Ruby]Proxy 経由のネット接続環境におけるGems
http://trwtnb.blogspot.com/2009/11/rubyproxygems.html
HTTP_PROXYにセットしたがNG
$ HTTP_PROXY=http://your.proxy.hostname:port_no $ export HTTP_PROXY $ sudo gem install rails ERROR: http://gems.rubyforge.org/ does not appear to be a repository ERROR: could not find gem rails locally or in a repository
-pオプションでプロキシ設定でできた
$ sudo gem install rails -p http://your.proxy.hostname:port_no Successfully installed rake-0.8.7 Successfully installed activesupport-2.3.8 Successfully installed activerecord-2.3.8 Successfully installed rack-1.1.0 Successfully installed actionpack-2.3.8 Successfully installed actionmailer-2.3.8 Successfully installed activeresource-2.3.8 Successfully installed rails-2.3.8 8 gems installed
Railsがどこにインストールされたかがわからなくなったのでググる。
参考;Railsのインストール先
http://rubyforge.org/frs/?group_id=1850
パスが通っていないので、.bashrcにパスを設定
PATH="/var/lib/gems/1.8/bin:$PATH"
[MySQLのインストール]
参考URL
http://debianj.com/ubuntu/install/mysql.html
MySQLの起動確認をするがエラーが発生。
$ sudo mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
調べてみると、このエラーはパスワードが設定されているユーザーを使用してMySQL サーバに接続する際に、
パスワードを送信しなかった場合にこのエラーが表示されるらしい。
参考;MySQLでいこう! ERROR 1045 (28000)
http://mysql.deikou.com/pages/000060.html
mysqlでユーザー(-u)とパスワードオプション(-p)を付けて実行する。
$ sudo mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 43 Server version: 5.1.41-3ubuntu12.1 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
出来た!
[Apcheのインストール]
apache2をインストール
$ sudo apt-get install apache2
DocumentRootのオーナーがrootだと面倒なので、変更する。
$ chown user:users /var/www
apache2の起動・停止・再起動
$ sudo /etc/init.d/apache2 start $ /etc/init.d/apache2 stop $ sudo /etc/init.d/apache2 restart
httpd.confの場所
/etc/apache2/httpd.conf
httpd.confは空なので実際にはこっちを直す
/etc/apache2/apache2.conf
UbuntuのApacheのDocumentRootはここに書かれている。
/etc/apache2/sites-available/default
DocumentRootを変更
/var/www → /var/www/html
[MySQLにRedmine用のデータベースの作成]
参考URL
http://redmine.jp/guide/RedmineInstall/
データベースの作成
mysql> create database redmine character set utf8; Query OK, 1 row affected (0.00 sec) mysql> show databases;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Database |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
information_schema |
mysql |
redmine |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
[Redmineのインストール]
Redmineのダウンロード
Redmineダウンロードページからredmine-0.9.4.tar.gzをダウンロード。
参考;Redmineダウンロードページ
http://rubyforge.org/frs/?group_id=1850
ドキュメントルートにRedmineを配置
$ cp -p zxf redmine-0.9.4.tar.gz /var/www/html/ $ cd /var/www/html/ $ tar zxf redmine-0.9.4.tar.gz $ mv redmine-0.9.4 redmine
database.ymlの設定
ファイル:/var/www/html/redmine/config/database.yml
production: adapter: mysql database: redmine host: localhost username: redmine password: ******** encoding: utf8
session_store.rbの実行
$ rake config/initializers/session_store.rb
migrateするがエラーが発生(Rackのバージョンがおかしい?らしい?)
$ rake db:migrate RAILS_ENV=production (in /var/www/html/redmine) rake aborted! RubyGem version error: rack(1.1.0 not ~> 1.0.1) (See full trace by running task with --trace)
参考URL
http://symfoware.blog68.fc2.com/blog-entry-422.html
/vendor/rails/actionpack/lib/action_controller.rbを書き換え
このように編集します。
/vendor/rails/actionpack/lib/action_controller.rb
#gem 'rack', '~> 1.0.1' gem 'rack', '~> 1.1.0'
また、migrateでエラー(httpsが足りない?)
$ rake db:migrate RAILS_ENV=production(in /var/www/html/redmine) rake aborted! no such file to load -- net/https (See full trace by running task with --trace)
libopenssl-rubyをインストール
$ sudo apt-get install libopenssl-ruby
またまた、migrateでエラー(gemのmysqlが足りない?)
$ rake db:migrate RAILS_ENV=production(in /var/www/html/redmine) !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! no such file to load -- mysql (See full trace by running task with --trace)
gemのmysqlをインストールしようとするがエラー
$ sudo gem install mysql -p http://your.proxy.hostname:port_no Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 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... no 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... yes 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/bin/ruby1.8 --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 /var/lib/gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out user@ubuntu:/var/www/html/redmine$ rake db:migrate RAILS_ENV=production (in /var/www/html/redmine) !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! no such file to load -- mysql (See full trace by running task with --trace)
libmysql-ruby1.8が足りなかったらしいのでインストール。
$ sudo apt-get install libmysql-ruby1.8
[passengerのインストール]
参考URL
http://redmine.jp/tech_note/apache-passenger/
passengerのインストール
$ sudo gem install passenger -p http://your.proxy.hostname:port_no ~ 省略 ~ Installing RDoc documentation for passenger-2.2.14...
passenger-install-apache2-moduleをインストールしようとするがエラー
色々足りないとモジュールがあるようだ。
$ passenger-install-apache2-module Welcome to the Phusion Passenger Apache 2 module installer, v2.2.14. 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.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
足りないパッケージをインストール
$ sudo apt-get install build-essential $ sudo sudo apt-get install apache2-prefork-dev
パーミッションが足りないとエラー発生
$ passenger-install-apache2-module Welcome to the Phusion Passenger Apache 2 module installer, v2.2.14. 〜 省略 〜 Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config Permission problems
sudoでインストール
$ sudo passenger-install-apache2-module
成功!
インストールの最後の方で表示される以下の文をhttpd.confに記述する。
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.14/ext/apache2/mod_passenger.so PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.14 PassengerRuby /usr/bin/ruby1.8ServerName redmine.example.jp DocumentRoot /var/lib/rails/redmine/public
Apacheを再起動して、http://localhost/にアクセス。
出来たーーー!