我正在尝试按照此处的说明安装 Postgres 9.3 。但是安装失败。
[ubuntu:~]$ lsb_release -c
Codename: raring
[ubuntu:~]$
[ubuntu:~]$ cat /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ raring-pgdg main
[ubuntu:~]$
[ubuntu:~]$ sudo apt-get update
Hit http://us-west-2.ec2.archive.ubuntu.com raring Release.gpg
Hit http://us-west-2.ec2.archive.ubuntu.com raring-updates Release.gpg
Hit http://us-west-2.ec2.archive.ubuntu.com raring Release
Hit http://us-west-2.ec2.archive.ubuntu.com raring-updates Release
Hit http://us-west-2.ec2.archive.ubuntu.com raring/main Sources
Hit http://us-west-2.ec2.archive.ubuntu.com raring/universe Sources
Hit http://us-west-2.ec2.archive.ubuntu.com raring/main amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com raring/universe amd64 Packages
Hit http://us-west-2.ec2.archive.ubuntu.com raring/main Translation-en
Hit http://us-west-2.ec2.archive.ubuntu.com raring/universe Translation-en
Hit http://us-west-2.ec2.archive.ubuntu.com raring-updates/main Sources
Hit http://us-west-2.ec2.archive.ubuntu.com raring-updates/universe Sources
Hit http://us-west-2.ec2.archive.ubuntu.com raring-updates/main amd64 Packages
Hit …Run Code Online (Sandbox Code Playgroud) 我正在运行 Ubuntu 13.04 并安装了 pgadmin3 1.16。
我从http://www.postgresql.org/ftp/pgadmin3/release/v1.18.1/src/下载了 pgadmin3-1.18.1.tar.gz
我按照安装文件中的所有说明进行操作,make install 似乎运行良好。问题是当我尝试运行 pgadmin3 时,它仍然打开 1.16。
我尝试卸载 1.16,然后重新安装 1.18,但后来我什至找不到可执行文件。
我的猜测是安装了 1.18,我如何/在哪里可以找到它?如果没有,我如何将 1.16 升级到 1.18
谢谢!
编辑
我运行的命令是:
摘自如何将 pgadmin3 更新到 v1.14? 和 http://linuxrails.blogspot.co.il/2012/09/install-pgadmin-for-postgresql-92-on.html
从 pgadmin3-1.18.1/安装
上午的大部分时间我都在做这件事。于是我昨晚升级到了ubuntu 14.04,很顺利。但是 postgres 用户和对我的 postgresql 数据库数据目录的访问存在问题。
因此数据库文件夹位于单独的硬盘上。当我安装驱动器时,系统根据当前udisks2标准将其安装到 /media/krishnab/{drive} 文件夹。所以现在 postgres 用户必须浏览我的home目录才能到达数据库文件夹。
我已将 postgres 用户包含在我的krishnab组中,并为该帐户指定了 linux 密码。我的主文件夹的所有者和组为“Me”(krishnab) krishnab。我也多次重启电脑。但是,每当 postgres 用户尝试访问该/media/krishnab文件夹时,总会出现permission denied错误。我还检查了我的/home/krishnab/文件夹权限,以确保它们是好的 -krishnab是组 - 并且它们都很好。我也检查了该文件夹的权限,它们是drwxrwxr-x+。所以还是没有运气。
我唯一注意到的是,当我使用 gnome-system-tools 时,我没有将postgres用户视为该组的成员krishnab,但是当我这样做时,sudo cat /etc/group我发现 krishnab 组的唯一成员是krishnab:x:1000:postgres。所以我想知道为什么我自己krishnab不是我自己小组的成员krishnab。
有什么建议么?我似乎无法弄清楚我错过了什么。谢谢。
在 14.04 安装时,postgresql 是通过安装
sudo apt-get install postgresql postgresql-contrib libpq-dev
此安装旨在成为从属设备,但如果不运行 pg_resetxlog,则无法启动。即使/usr/lib/postgresql/9.3/bin/有 pg_resetxlog,系统也需要安装“postgres-xc”。
apt-get install postgres-xc
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages …Run Code Online (Sandbox Code Playgroud) 我在 Utopic Unicorn 上,我需要安装 Postgresql 9.3 服务器和客户端。当我尝试自动完成时sudo apt-get install postgres,我只看到 9.4 个包:
postgresql postgresql-autodoc
postgresql-9.4 postgresql-client
postgresql-9.4-asn1oid postgresql-client-9.4
postgresql-9.4-dbg postgresql-client-common
postgresql-9.4-debversion postgresql-common
postgresql-9.4-ip4r postgresql-comparator
postgresql-9.4-orafce postgresql-contrib
postgresql-9.4-pgespresso postgresql-contrib-9.4
postgresql-9.4-pgextwlist postgresql-doc
postgresql-9.4-pgfincore postgresql-doc-9.4
postgresql-9.4-pgmemcache postgresql-filedump
postgresql-9.4-pgmp postgresql-hll
postgresql-9.4-pgpool2 postgresql-plperl-9.4
postgresql-9.4-pgq3 postgresql-plpython3-9.4
postgresql-9.4-pgrouting postgresql-plpython-9.4
postgresql-9.4-pgrouting-doc postgresql-pltcl-9.4
postgresql-9.4-pllua postgresql-prioritize
postgresql-9.4-plproxy postgresql-server-dev-9.4
postgresql-9.4-plr postgresql-server-dev-all
postgresql-9.4-plsh postgres-xc
postgresql-9.4-plv8 postgres-xc-client
postgresql-9.4-postgis-2.1 postgres-xc-contrib
postgresql-9.4-postgis-2.1-scripts postgres-xc-dbg
postgresql-9.4-postgis-scripts postgres-xc-doc
postgresql-9.4-prefix postgres-xc-plperl
postgresql-9.4-preprepare postgres-xc-plpython
postgresql-9.4-repmgr postgres-xc-pltcl
postgresql-9.4-slony1-2 postgres-xc-server-dev
Run Code Online (Sandbox Code Playgroud)
我如何安装他们的 9.3 版本?
我正在执行此命令以在我的 ubuntu 14.04 中安装 postgesql
sudo apt-get install postgresql postgresql-contrib
Run Code Online (Sandbox Code Playgroud)
我在安装过程中遇到错误:
Failed to issue method call: Unit postgresql@10-main.service failed to load: No such file or directory. See system logs and 'systemctl status postgresql@10-main.service' for details
Run Code Online (Sandbox Code Playgroud)
这是完整的日志:
Creating config file /etc/postgresql-common/createcluster.conf with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
en_us
Removing obsolete dictionary files:
* No PostgreSQL clusters exist; see "man pg_createcluster"
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postgresql-10 (10.1-1.pgdg14.04+1) ...
Creating new PostgreSQL cluster 10/main ... …Run Code Online (Sandbox Code Playgroud) 我正在编写一个使用 psql (Postgresql) 的 bash 脚本。
DATABASE='scifi'
sudo -u postgres psql
count=SELECT COUNT(*) FROM (SELECT datname FROM pg_catalog.pg_database WHERE lower(datname)=lower($DATABASE)
Run Code Online (Sandbox Code Playgroud)
我想删除数据库(如果存在)并使用相同的名称重新创建并分配给用户。
还有其他与 psql 相关的操作。
我的问题是,一旦我输入 psql,我就无法传递 bash 命令和检索信息。我有点理解为什么(因为我正在从 bash 转移到 psql),但我必须找到解决方案。
我正在尝试使用此处的说明设置 PostgreSQL 服务器。我通过以下方式安装了该软件包apt-get install postgresql,现在我正在执行以下步骤:
sudo -u postgres psql postgres
这给出了错误:
psql: 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"?
Run Code Online (Sandbox Code Playgroud)
我猜服务器没有运行,但我不知道如何启动它。任何提示将不胜感激。
更新:service postgresql status即使在sudo service postgresql start.
更新 #2:运行ps auxw | grep post也没有任何结果,所以我猜服务器守护进程没有运行。
我忘记了安装时使用的密码postgres。它要求为我执行的每个操作输入密码。在这种情况下我能做什么?
我什至尝试删除 postgres 并重新安装它,但它仍然要求输入密码。
我整个周末都在努力将现有的 postgresql 数据库从版本 8.4 升级到 9.1。在我将操作系统从 10.0.4 更新到 12.04 后,我拥有了两个版本的数据库。
我终于被激怒了,在一个错误的判断中,我强行从我的机器上删除了所有 8.4 相关的文件,使用:
find / -type d -name 8.4 2>/dev/null | xargs rm -rf {}
我决定删除它的更好方法是“apt-get remove postgresql-8.4”
当我尝试这样做时,apt-get 报告:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
postgresql-8.4
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 15.5 MB disk space will be freed.
Do you want to …Run Code Online (Sandbox Code Playgroud) 为了给 postgres 更多空间,我在 /mnt/fast_data/ 安装了一个 SSD
我想要完成的是将 postgres 用户所有权授予 postgresql 目录,因此它不会说权限被拒绝。
$ sudo chown -R root:root /mnt/fast_data/
$ sudo chown -R postgres:postgres /mnt/fast_data/postgresql/
Run Code Online (Sandbox Code Playgroud)
当我测试时:
su postgres
postgres@my_machine: cd /mnt/fast_data/postgresql
Run Code Online (Sandbox Code Playgroud)
我收到错误=>>
bash: cd: /mnt/fast_data/postgresql: Permission denied
Run Code Online (Sandbox Code Playgroud)
chown -R postgres:postgres /mnt/fast_data当我授予整个新驱动器的所有权时,它确实有效。但肯定有一种方法可以只授予对子目录的访问权限。postgres 拥有所有权,var/lib/postgres尽管var/lib它是由 root 拥有的。我是否遗漏了有关附加驱动器的信息?
额外要求的信息:
$ sudo ls -ld /mnt/fast_data /mnt/fast_data/postgresql
drwxrwx--- 3 main_user main_user 4096 Jul 22 00:18 /mnt/fast_data
drwxr-xr-x 6 postgres postgres 4096 Jul 18 22:07 /mnt/fast_data/postgresql
Run Code Online (Sandbox Code Playgroud)
$ mount | grep /mnt/fast_data
/dev/nvme0n1 on /mnt/fast_data …Run Code Online (Sandbox Code Playgroud)