Project

General

Profile

Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host

Added by system admin0987 about 12 years ago

Hi,
My Redmine is run on 192.168.1.10
My posgresql(9.1) is active on 192.168.1.11

*Note:If Mysql install on local host, its  work for fine but But i need to connect redmine installed on (1.10) and  posgresql installed on  1.11*
cat /var/www/redminedjtk/config/dtabase.yml
production:
  adapter: postgresql
  database: redminedb
  host: 192.168.1.11
  port: 5432
  username: redmin1
  password: my_secret
  encoding: utf8

[root@pm redminedjtk]# RAILS_ENV=production rake db:migrate
(in /var/www/redminedjtk)
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load 
-- pg)

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

Step:2 gem install activerecord-postgresql-adapter

[root@pm redminedjtk]# gem install activerecord-postgresql-adapter

Building native extensions.  This could take a while...
ERROR:  Error installing activerecord-postgresql-adapter:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1/ext/gem_make.out

  1. --trace records also attached

    [root@pm redminedjtk]# RAILS_ENV=production rake db:migrate --trace
    (in /var/www/redminedjtk)
    • Invoke db:migrate (first_time)
    • Invoke environment (first_time)
    • Execute environment
      rake aborted!
      Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load -- pg)
      /var/www/redminedjtk/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection'
      /var/www/redminedjtk/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
      /var/www/redminedjtk/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
      /var/www/redminedjtk/config/../vendor/rails/railties/lib/initializer.rb:438:in `initialize_database'
      /var/www/redminedjtk/config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
      /var/www/redminedjtk/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
      /var/www/redminedjtk/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
      /var/www/redminedjtk/config/environment.rb:24
      /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
      /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
      /var/www/redminedjtk/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
      /var/www/redminedjtk/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
      /var/www/redminedjtk/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
      /var/www/redminedjtk/vendor/rails/railties/lib/tasks/misc.rake:4
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain'
      /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:588:in `invoke_prerequisites'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `each'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:585:in `invoke_prerequisites'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:577:in `invoke_with_call_chain'
      /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
      /usr/lib64/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31
      /usr/bin/rake:19:in `load'
      /usr/bin/rake:19

Please help me to sort out problem so i can connecte my remote database

Note:please also tell me how i can check postgresql  connectivity from  redmine server(192.168.1.10).

thanks for your support.

Replies (12)

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

Thanks for your reply ,i tried but it gives and error
[root@pm redminedjtk]# gem install pg

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1/ext/gem_make.out

Urgent !!! RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

#yum install postgresql-devel ( installed without any problem)
#yum install ruby-devel ( installed without any problem)
redmine#gem install pg (given given errors)

root@pm redminedjtk]# gem install pg
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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/ruby
        --with-pg
        --without-pg
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1/ext/gem_make.out

where is problem ?

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

please help me , i googled and trying to different methods but no success.

redmine#RAILS_ENV=production rake redmine:load_default_data
(in /var/www/redminedjtk)
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load -- pg)

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

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by Etienne Massip about 12 years ago

farrukh nadeem wrote:

Thanks for your reply ,i tried but it gives and error
[root@pm redminedjtk]# gem install pg
[...]

Still you have to gem install pg.

When you have such issues while installing/building the gem, then you have to specify the paths to your PostgreSQL includes and lib path (which I don't know they are on your system).

E.g.:

gem install pg -- --with-pg-dir=<path to your PostgreSQL installation dir>

Or

gem install pg -- --with-pg-include=<path to your PostgreSQL include dir> --with-pg-lib=<path to your PostgreSQL lib dir>

I'm not familiar with PostgreSQL installation on linux so I won't be able to help you more about this installation, but Google will.

Instead of passing build arguments to your gem install command, I guess you can also temporarily set CPATH and LIBRARY_PATH envvar :

CPATH=<path to your PostgreSQL include dir>
LIBRARY_PATH=<path to your PostgreSQL lib dir>

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

E.g.:

gem install pg -- --with-pg-dir=<path to your PostgreSQL installation dir>

Or

gem install pg -- --with-pg-include=<path to your PostgreSQL include dir> --with-pg-lib=<path to your PostgreSQL lib dir>

I'm not familiar with PostgreSQL installation on linux so I won't be able to help you more about this installation

As i said , on redmine (192.168.1.10) , there is no postgreSQL installed , redmine will connected to (192.168.1.11)where postgreSql database is located.

is it necassary to installed postgresql for

[root@pm redminedjtk]# gem install activerecord-postgresql-adapter
Building native extensions.  This could take a while...
ERROR:  Error installing activerecord-postgresql-adapter:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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/ruby
        --with-pg
        --without-pg
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
        --with-pg-config
        --without-pg-config
        --with-pg_config
        --without-pg_config

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/pg-0.14.1/ext/gem_make.out

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by Etienne Massip about 12 years ago

You don't need to install the whole database but you'll need headers and libraries.

They should be at least bundled with the client.

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by Etienne Massip about 12 years ago

This package matches your need : https://admin.fedoraproject.org/pkgdb/acls/name/postgresql.

After installing it you should try to install the gem without any build specific arguments in the first place.

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

[root@pm redminedjtk]# gem install postgres-pr
Successfully installed postgres-pr-0.6.3
1 gem installed
Installing ri documentation for postgres-pr-0.6.3...
Installing RDoc documentation for postgres-pr-0.6.3...
[root@pm redminedjtk]# RAILS_ENV=production rake db:migrate
(in /var/www/redminedjtk)

RAILS_ENV=production rake redminedb:load_default_data

[root@pm redminedjtk]# RAILS_ENV=production rake  redminedb:load_default_data
(in /var/www/redminedjtk)
rake aborted!
Don't know how to build task 'redminedb:load_default_data'

(See full trace by running task with --trace)
[root@pm redminedjtk]# RAILS_ENV=production rake redminedb:load_default_data
(in /var/www/redminedjtk)
rake aborted!
Don't know how to build task 'redminedb:load_default_data'

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

Now how to check redmine is going to(postgresql) 192.168.1.11 or not ???

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

[root@pm redminedjtk]# RAILS_ENV=production rake redminedb:load_default_data

i have change it to Changed rake redminedb -> redmine

[root@pm redmine]# RAILS_ENV=production rake  redmine:load_default_data

its work fine with me.

and redmine is working fine now and i can load it .

redmine#RAILS_ENV=production rake redmine:load_default_data
(in /var/www/redminedjtk)
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (no such file to load -- pg)

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

Above error will resolved by .

redmine#gem install postgres-pr

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by Etienne Massip about 12 years ago

system admin0987 wrote:

[root@pm redminedjtk]# gem install postgres-pr
Successfully installed postgres-pr-0.6.3
1 gem installed

I would still recommend to use postgresql gem instead of postgres-pr since the lattest is not maintained anymore and has some known incompatibilities with latest PostgreSQL versions.

RE: Please install the postgresql adapter: redmine 1.2.1 with posgresql(9.1) installed on remote host - Added by system admin0987 about 12 years ago

#gem install postgres-pr

postgres-pr has issue ,when i restart my remote postgresql 9.1 database then redmine stop working .i have to restart nginx server over redmine
#service nginx restart

it makes redmine and postgresql connectivity again.But This can't be done on production server. to restart nginx server.

i have read the article
[[http://www.redmine.org/boards/2/topics/21912 ]]
which show postgres-pr is old adopter and not compatible with postgresql 9.1 . so need to install

#yum install gcc
#gem install pg

Building native extensions.  This could take a while...
Successfully installed pg-0.14.1

[root@pm1_test gems]# gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.14, 2.3.11)
actionpack (2.3.14, 2.3.11)
activerecord (2.3.14, 2.3.11)
activeresource (2.3.14, 2.3.11)
activesupport (2.3.14, 2.3.11)
bundle (0.0.1)
bundler (1.2.0)
countloc (0.4.0)
dev (1.0.53)
i18n (0.4.2)
*pg (0.14.1)
postgres-pr (0.6.3)*
rack (1.1.0)
rails (2.3.14, 2.3.11)
rainbow (1.1.4)
rake (0.8.7, 0.8.3)
semver (1.0.1)
systemu (2.5.2)

Now how can i Switch for postgres-pr to pg adopters ?
Will pg works ?

    (1-12/12)