Postgresql 中文操作指南
1.1. Installation #
在使用 PostgreSQL 之前,您当然需要先安装它。PostgreSQL 可能已经在您的网站安装,可能是因为它包含在您的操作系统发行版中,或者系统管理员已经安装了它。如果是这种情况,您应该从操作系统文档或系统管理员那里获取有关如何访问 PostgreSQL 的信息。
Before you can use PostgreSQL you need to install it, of course. It is possible that PostgreSQL is already installed at your site, either because it was included in your operating system distribution or because the system administrator already installed it. If that is the case, you should obtain information from the operating system documentation or your system administrator about how to access PostgreSQL.
如果您不确定是否已经安装了 PostgreSQL,或者是否可以使用它进行试验,那么您可以自行安装。这样做并不难,而且可能是一个很好的练习。任何非特权用户都可以安装 PostgreSQL;不需要超级用户 (root) 访问权限。
If you are not sure whether PostgreSQL is already available or whether you can use it for your experimentation then you can install it yourself. Doing so is not hard and it can be a good exercise. PostgreSQL can be installed by any unprivileged user; no superuser (root) access is required.
如果您自己安装 PostgreSQL,请参阅 Chapter 17获取安装说明,并在安装完成后返回本指南。务必仔细遵循有关设置适当的环境变量的部分。
If you are installing PostgreSQL yourself, then refer to Chapter 17 for instructions on installation, and return to this guide when the installation is complete. Be sure to follow closely the section about setting up the appropriate environment variables.
如果您的网站管理员没有以默认方式设置,您可能需要做更多的工作。例如,如果数据库服务器计算机是远程计算机,您需要将 PGHOST 环境变量设置为数据库服务器计算机的名称。可能还需要设置 PGPORT 环境变量。底线是:如果您尝试启动应用程序,并且它抱怨无法连接到数据库,您应该咨询您的网站管理员或者(如果是您本人)查看文档,以确保您的环境设置正确。如果您不理解前一段,请阅读下一节。
If your site administrator has not set things up in the default way, you might have some more work to do. For example, if the database server machine is a remote machine, you will need to set the PGHOST environment variable to the name of the database server machine. The environment variable PGPORT might also have to be set. The bottom line is this: if you try to start an application program and it complains that it cannot connect to the database, you should consult your site administrator or, if that is you, the documentation to make sure that your environment is properly set up. If you did not understand the preceding paragraph then read the next section.