sh 安装postgres 9.3

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 安装postgres 9.3相关的知识,希望对你有一定的参考价值。

sudo touch /etc/apt/sources.list.d/pgdg.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update
sudo apt-get -y install postgresql-9.3 libpq-dev postgresql-contrib-9.3
sudo apt-get autoremove

sudo pg_dropcluster --stop 9.3 main
sudo pg_createcluster --start -e UTF-8 9.3 main

#Change username and password as desired. Username need not be put in quotes but password need to be.
#In case of any extensions, login to psql with psql -h <hostname> -d <database_name> -U <username> -P
#Enter Password:
#You can avoid entering password always, by maintaining .pgpass.
sudo -u postgres psql -c "create role <username> with PASSWORD '<password>' SUPERUSER CREATEDB LOGIN;"
sudo -u postgres psql -c 'grant all on schema public to <username>;'

sudo service postgresql start

以上是关于sh 安装postgres 9.3的主要内容,如果未能解决你的问题,请参考以下文章

postgres 9.3 windows的空密码登录失败

如何在 Postgres 9.3 中获取当前时区名称?

/usr/pgsql-9.3/share/extension 中不存在 Postgres plpythonu 扩展

Ubuntu下postgre与postgis安装

如何安装/更新到 Postgres 9.4?

sh 在OS X上安装Postgres