无法在ubuntu上使用PostgreSQL连接Rails应用程序

我无法将My rails应用程序与在某个实例上运行的Ubuntu服务器上运行的PostgreSQL数据库连接。我使用以下命令创建了新用户和密码。

1-sudo -u postgres createuser -s user1 2-sudo -u postgres psql. 3-postgres=\\password userpass 

检查我的database.yml文件,如下所示。

database.yml的:

 development: adapter: postgresql encoding: unicode database: 100sallon_development pool: 5 username: user1 password: ******* host: 10.*.*.* test: adapter: postgresql encoding: unicode database: 100sallon_test pool: 5 username: user1 password: ******* host: 10.*.*.* production: adapter: postgresql encoding: unicode database: 100sallon_production pool: 5 username: user1 password: ****** host: 10.*.*.* 

当我尝试使用以下命令创建数据库时rake db:create它给了我以下错误。

错误:

 could not connect to server:connection refused Is the server running on the host:10.*.*.* and accepting TCP/IP connections on the port 5432 

我的Ubuntu服务器在给定的IP上运行。但仍然面临与PostgreSQL数据库连接的问题。请帮我解决这个错误。谢谢。