前言:
而今朋友们对“yum安装失败的原因”都比较关切,姐妹们都需要剖析一些“yum安装失败的原因”的相关知识。那么小编也在网络上网罗了一些有关“yum安装失败的原因””的相关资讯,希望咱们能喜欢,兄弟们快快来学习一下吧!yum 安装了 PostgreSQL
安装
yum install install postgresql96
初始化数据库
cd pgsql-9.6//usr/pgsql-9.6/bin/postgresql96-setup initdb
执行完毕显示:
Initializing database ... OK
创建用户组和用户:
创建用户组:
sudo groupadd postgresql
创建用户:
sudo useradd -gpostgresql postgresql
实现开机自启服务
systemctl enable postgresql-9.6Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-9.6.service to /usr/lib/systemd/system/postgresql-9.6.service.
启动数据库服务
systemctl start postgresql-9.6
如果发生报错情况:
Job for postgresql-9.6.service failed because the control process exited with error code. See "systemctl status postgresql-9.6.service" and "journalctl -xe" for details.
解决方案1:
systemctl status postgresql-9.6
查看启动状态:
有如下报错:
postgresql-9.6.service - PostgreSQL 9.6 database server Loaded: loaded (/usr/lib/systemd/system/postgresql-9.6.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2020-06-10 13:26:43 CST; 26s ago Docs: ; Process: 24750 ExecStart=/usr/pgsql-9.6/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE) Process: 24743 ExecStartPre=/usr/pgsql-9.6/bin/postgresql96-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS) Main PID: 24750 (code=exited, status=1/FAILURE)Jun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 systemd[1]: Starting PostgreSQL 9.6 database server...Jun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 postmaster[24750]: < 2020-06-10 13:26:43.566 CST > LOG: redirecting log output to logging collector processJun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 postmaster[24750]: < 2020-06-10 13:26:43.566 CST > HINT: Future log output will appear in directory "pg_log".Jun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 systemd[1]: postgresql-9.6.service: main process exited, code=exited, status=1/FAILUREJun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 systemd[1]: Failed to start PostgreSQL 9.6 database server.Jun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 systemd[1]: Unit postgresql-9.6.service entered failed state.Jun 10 13:26:43 hecs-x-xlarge-2-linux-20200604174817 systemd[1]: postgresql-9.6.service failed.
权限的问题,授权一下:
chmod 700 /var/lib/pgsql/9.6/data
再次启动:正常了。
解决方案2:很有可能是以前安装过PostgreSQL ,那就是需要删除/var/lib/pgsql
rm -rf /var/lib/pgsql
再次启动:正常了。
查看是否安装成功
[root@hecs-x-xlarge-2-linux-20200604174817 data]# netstat -tlun | grep 5432 #postgres是占用5432端口tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN tcp6 0 0 :::5432 :::* LISTEN
版权声明:
本站文章均来自互联网搜集,如有侵犯您的权益,请联系我们删除,谢谢。
标签: #yum安装失败的原因