yum按照postgresql
时间: 2023-08-05 11:03:41 浏览: 65
在 CentOS 或者其他使用 Yum 包管理器的 Linux 发行版上安装 PostgreSQL,可以按照以下步骤操作:
1. 打开终端,以 root 用户身份登录。
2. 执行以下命令更新 Yum 软件包缓存:
```
yum update
```
3. 执行以下命令安装 PostgreSQL:
```
yum install postgresql-server postgresql-contrib
```
其中,`postgresql-server` 是 PostgreSQL 的服务器程序包,`postgresql-contrib` 是 PostgreSQL 的扩展组件包,包括了一些额外的插件和工具。
4. 执行以下命令初始化 PostgreSQL 数据库:
```
postgresql-setup initdb
```
5. 执行以下命令启动 PostgreSQL 服务:
```
systemctl start postgresql
```
6. 执行以下命令设置 PostgreSQL 服务自动启动:
```
systemctl enable postgresql
```
这样,PostgreSQL 就安装完成了。在默认情况下,PostgreSQL 的配置文件 `postgresql.conf` 和 `pg_hba.conf` 位于 `/var/lib/pgsql/data/` 目录下。可以使用文本编辑器打开这些文件进行编辑,以修改 PostgreSQL 的配置。
相关问题
postgresql的yum源如何配置
要配置PostgreSQL的yum源,请按照以下步骤操作:
1. 打开终端,并使用root用户登录。
2. 在终端中输入以下命令,以下载并添加PostgreSQL的yum存储库:
```
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
```
3. 然后,您需要编辑/etc/yum.repos.d/pgdg-11-redhat.repo文件,以包括正确的存储库信息。使用文本编辑器(如vim)打开此文件,并将以下代码添加到[pgdg-11]部分中:
```
name=PostgreSQL 11 for RHEL/CentOS 7 - x86_64
baseurl=https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-11
```
4. 最后,运行以下命令以安装PostgreSQL:
```
yum install postgresql11-server postgresql11
```
Linux使用yum下载postgresql-client,报Error: Unable to find a match: postgresql-client这样的错 如何解决
这个错误提示意味着yum无法找到匹配的软件包。这可能是由于您的yum存储库未正确配置或未更新引起的。您可以尝试以下步骤来解决该问题:
1. 更新yum存储库
运行以下命令更新yum存储库:
```
sudo yum update
```
2. 确认postgresql存储库已经添加
您需要确保已经添加了postgresql存储库。您可以通过在终端中运行以下命令来验证:
```
sudo yum repolist
```
如果您看到postgresql存储库,则说明它已经添加到您的系统中。否则,您需要添加postgresql存储库。
3. 安装postgresql-client
运行以下命令以安装postgresql-client:
```
sudo yum install postgresql-client
```
这应该解决您的问题。如果您仍然遇到问题,请检查您的存储库配置是否正确。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![html](https://img-home.csdnimg.cn/images/20210720083451.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)