PostgreSQL(发音为“post-gres-Q-L”)是一个免费的开源对象关系 数据库 管理系统(object-RDBMS),类似于 MySQL,符合标准且可扩展。 它通常用作 Web 和移动应用程序的后端。 PostgreSQL,或绰号为“Postgres”,与修订版一起采用 ANSI/ISO SQL 标准。
飞行前检查
- 这些说明专门用于在 Fedora 21.
- 我将从 Liquid Web Self Managed 工作 Fedora 21服务器,我将以root身份登录。
第 1 步:添加 PostgreSQL 9.3 存储库
在这种情况下,我们想直接从 Postgres 存储库安装 PostgreSQL 9.3。 让我们添加那个 repo:
rpm -iUvh https://yum.postgresql.org/9.3/fedora/fedora-21-x86_64/pgdg-fedora93-9.3-1.noarch.rpm
第 2 步:安装 PostgreSQL
首先,您将遵循一个简单的最佳实践……在安装任何新内容之前确保可用软件包列表是最新的:
yum -y update
然后只需通过 apt-get 运行一个安装命令即可:
yum -y install postgresql93 postgresql93-server postgresql93-contrib postgresql93-libs --enablerepo=pgdg93
现在应该安装 PostgreSQL。
第 3 步:启动 PostgreSQL
配置 Postgres 在服务器启动时启动:
systemctl enable postgresql-9.3
使用以下两个命令启动 Postgres:
/usr/pgsql-9.3/bin/postgresql93-setup initdb
systemctl start postgresql-9.3
第 4 步:切换到默认 PostgreSQL 用户
作为安装的一部分,Postgres 添加了系统用户 postgres 并设置为使用“身份”身份验证。 角色 Postgres 内部(类似于用户)与系统用户帐户匹配。
让我们切换到该系统用户:
su – postgres
然后连接到 PostgreSQL 终端(在 postgres 角色):
psql
就是这样! 您已连接并准备好在 PostgreSQL 中运行命令 postgres 角色。