以下是在CentOS上安装和配置PostgreSQL数据库的步骤:
sudo yum update
sudo yum install postgresql-server
sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo nano /var/lib/pgsql/data/pg_hba.conf
在文件末尾添加以下行以允许所有IP地址访问:
host all all 0.0.0.0/0 md5
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'your_password';"
sudo systemctl restart postgresql
至此,您已经成功在CentOS上安装和配置了PostgreSQL数据库。您可以使用psql命令连接到数据库并开始创建和管理数据库。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: CentOS如何防止僵尸进程出现