Rails app - problems running rails server using pg d/b

rails

#1

PG::ConnectionBad (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
):
activerecord (4.2.8) lib/active_record/connection_adapters/postgresql_adapter.rb:651:in initialize' activerecord (4.2.8) lib/active_record/connection_adapters/postgresql_adapter.rb:651:innew’
activerecord (4.2.8) lib/active_record/connection_adapters/postgresql_adapter.rb:651:in connect' activerecord (4.2.8) lib/active_record/connection_adapters/postgresql_adapter.rb:242:ininitialize’
activerecord (4.2.8) lib/active_record/connection_adapters/postgresql_adapter.rb:44:in new' activerecord (4.2.8) lib/active_record/connection_adapters/postgresql_adapter.rb:44:inpostgresql_connection’
activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in new_connection' activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:448:incheckout_new_connection’
activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in acquire_connection' activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:349:inblock in checkout’
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/monitor.rb:214:in mon_synchronize' activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:348:incheckout’
activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in block in connection' /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/monitor.rb:214:inmon_synchronize’
activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in connection' activerecord (4.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:571:inretrieve_connection’
activerecord (4.2.8) lib/active_record/connection_handling.rb:113:in retrieve_connection' activerecord (4.2.8) lib/active_record/connection_handling.rb:87:inconnection’
activerecord (4.2.8) lib/active_record/migration.rb:383:in connection' activerecord (4.2.8) lib/active_record/migration.rb:370:incall’
actionpack (4.2.8) lib/action_dispatch/middleware/callbacks.rb:29:in block in call' activesupport (4.2.8) lib/active_support/callbacks.rb:88:inrun_callbacks
activesupport (4.2.8) lib/active_support/callbacks.rb:778:in _run_call_callbacks' activesupport (4.2.8) lib/active_support/callbacks.rb:81:inrun_callbacks’
actionpack (4.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack (4.2.8) lib/action_dispatch/middleware/reloader.rb:73:incall’
actionpack (4.2.8) lib/action_dispatch/middleware/remote_ip.rb:78:in call' actionpack (4.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:17:incall’
web-console (2.3.0) lib/web_console/middleware.rb:20:in block in call' web-console (2.3.0) lib/web_console/middleware.rb:18:incatch’
web-console (2.3.0) lib/web_console/middleware.rb:18:in call' actionpack (4.2.8) lib/action_dispatch/middleware/show_exceptions.rb:30:incall’
railties (4.2.8) lib/rails/rack/logger.rb:38:in call_app' railties (4.2.8) lib/rails/rack/logger.rb:20:inblock in call’
activesupport (4.2.8) lib/active_support/tagged_logging.rb:68:in block in tagged' activesupport (4.2.8) lib/active_support/tagged_logging.rb:26:intagged’
activesupport (4.2.8) lib/active_support/tagged_logging.rb:68:in tagged' railties (4.2.8) lib/rails/rack/logger.rb:20:incall’
actionpack (4.2.8) lib/action_dispatch/middleware/request_id.rb:21:in call' rack (1.6.10) lib/rack/methodoverride.rb:22:incall’
rack (1.6.10) lib/rack/runtime.rb:18:in call' activesupport (4.2.8) lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall’
rack (1.6.10) lib/rack/lock.rb:17:in call' actionpack (4.2.8) lib/action_dispatch/middleware/static.rb:120:incall’
rack (1.6.10) lib/rack/sendfile.rb:113:in call' railties (4.2.8) lib/rails/engine.rb:518:incall’
railties (4.2.8) lib/rails/application.rb:165:in call' rack (1.6.10) lib/rack/lock.rb:17:incall’
rack (1.6.10) lib/rack/content_length.rb:15:in call' rack (1.6.10) lib/rack/handler/webrick.rb:88:inservice’
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/webrick/httpserver.rb:140:in service' /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/webrick/httpserver.rb:96:inrun’
/usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread’

Rendered /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/_source.erb (2.7ms)
Rendered /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.4ms)
Rendered /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.7ms)
Rendered /usr/local/rvm/gems/ruby-2.4.1/gems/actionpack-4.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (21.0ms)

I imported a rails app in C9 but i am struggling to get it running and keep getting the above error.
I have read several posts and tried to start the pg d/b but it did not work either.

sudo service postgresql start.

Appreciate any workable solutions as I am a novice in rails apps.
Tks