Linux 错误:您必须至少安装一个 postgresql-client-<version> 包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5301997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: You must install at least one postgresql-client-<version> package
提问by Guest
I am trying to install PostgreSQL in Ubuntu.
我正在尝试在 Ubuntu 中安装 PostgreSQL。
I followed the instruction from:
我按照以下说明操作:
/opt/PostgreSQL/9.0/doc/postgresql/html/installation.html
and seem to have successfully installed PostgreSQL but as Post-Installation setup, it asked me to do the following:
并且似乎已成功安装 PostgreSQL 但作为安装后设置,它要求我执行以下操作:
To do this, add the following to your shell start-up file, such as ~/.bash_profile
(or /etc/profile
, if you want it to affect all users):
为此,请将以下内容添加到您的 shell 启动文件中,例如~/.bash_profile
(或者/etc/profile
,如果您希望它影响所有用户):
PATH=/usr/local/pgsql/bin:$PATH
export PATH
but I have no idea where .bash_profile is. It said this is not required, so I just skipped it and when I was trying to create database (createdb mydb), it gives me
但我不知道 .bash_profile 在哪里。它说这不是必需的,所以我只是跳过它,当我尝试创建数据库(createdb mydb)时,它给了我
Error:
错误:
You must install at least one postgresql-client-<version> package.
I have no idea what that is. Could anyone explain why I am getting this error and how I can install postgresql-client?
我不知道那是什么。谁能解释为什么我会收到此错误以及如何安装 postgresql-client?
回答by Dirk Eddelbuettel
Do you reallyneed 9.0 right now? Otherwise use the excellent pre-built packages eg
你现在真的需要9.0吗?否则使用优秀的预建包,例如
sudo apt-get install postgresql-8.4 postgresql-client-8.4
is what I have under Ubuntu 10.10.
是我在 Ubuntu 10.10 下的。
If it has to be 9.0, you are probably best off rebuilding from the Debian package sources.
如果必须是 9.0,您可能最好从 Debian 软件包源中重建。
回答by lucian.pantelimon
You can try adding this to ~/.bashrc (i.e. /home/youruser/.bashrc).
您可以尝试将其添加到 ~/.bashrc (即 /home/youruser/.bashrc)。
Or run:
或者运行:
gedit ~/.bashrc
from the terminal. The file should already contain some code, but you can add at the end of the file, then save the file and you should be good to go.
从终端。该文件应该已经包含一些代码,但您可以在文件末尾添加,然后保存文件,您应该很高兴。
Oh.. and relog after doing this so that $PATH can be set up and exported or just run
哦..并在执行此操作后重新登录,以便可以设置和导出 $PATH 或仅运行
PATH=/usr/local/pgsql/bin:$PATH
export PATH
from the terminal without relogging. Should work... :)
从终端无需重新登录。应该管用... :)
回答by jla
You are getting the "You must install at least one..." error because you are on a Debian based system (Ubuntu) and have the postgresql-client-common package installed but do not have the binary-providing versioned package, eg postgresql-client-8.4, installed.
您收到“您必须至少安装一个...”错误,因为您使用的是基于 Debian 的系统 (Ubuntu) 并且安装了 postgresql-client-common 软件包但没有提供二进制版本的软件包,例如 postgresql -client-8.4,已安装。
You could just install the postgresql-client package which automatically installs the currently supported database client package version for PostgreSQL.
您可以只安装 postgresql-client 包,它会自动安装当前支持的 PostgreSQL 数据库客户端包版本。
I don't know what Ubuntu release you are using or what PostgreSQL version it comes with by default, but you may be better off not using client programs from the Ubuntu/Debian version of Ubuntu and instead modifying your PATH to use the installed version.
我不知道您使用的是哪个 Ubuntu 版本或它默认附带的 PostgreSQL 版本,但是您最好不要使用来自 Ubuntu/Debian 版本的 Ubuntu 的客户端程序,而是修改您的 PATH 以使用已安装的版本。
The .bash_profile is similar to .bashrc. They are both commonly in your home directory if they have been created.
.bash_profile 类似于 .bashrc。如果它们已经创建,它们通常都在您的主目录中。
回答by FacePalm
You can use this if you don't want to specify the version
如果您不想指定版本,可以使用它
sudo apt-get install postgresql-client