PostgreSQL 10.0 源码安装 in Centos

来源:互联网 发布:fade打击垫软件 编辑:程序博客网 时间:2024/06/07 10:49


# 源码安装tar zxvf postgresql-10.0.tar.gzmv postgresql-10.0 /usr/local/pgsqlcd /usr/local/pgsql/./configure --prefix=/usr/local/pgsql --without-readlinemakemake install# 添加用户,设置目录权限adduser postgrespasswd postgresmkdir -p /usr/local/pgsql/datachown -R postgres:root /usr/local/pgsql# 设置环境变量> su - postgres> vim ~/.bash_profileexport PATH=$PATH:/usr/local/pgsql/bin> source ~/.bash_profile# 允许所有连接> vim /usr/local/pgsql/data/pg_hba.confhost    all             all             0.0.0.0/0               trust# 侦听所有连接> vim /usr/local/pgsql/data/postgresql.conf listen_addresses = '*'logging_collector = on# 添加启动服务(确认文件postgresql内的目录正确)cp /usr/local/pgsql/contrib/start-scripts/linux  /etc/init.d/postgresql chmod u+x /etc/init.d/postgresql # 添加开启自启动chkconfig --add postgresql# 启动服务service postgresql start# 切换用户,初始化数据并创建测试库(确认data目录下为空)su - postgres/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/datacreatedb testpsql test




pgadmin4 安装:

#下载 pgadmin4https://www.pgadmin.org/download/pgadmin-4-python-wheel/# 安装 pgadmin4> pip install pgadmin4-2.0-py2.py3-none-any.whl# 设置服务器地址> vim /usr/lib/python2.7/site-packages/pgadmin4/config.pyDEFAULT_SERVER = '192.168.40.10'# 设置邮箱用户&密码,启动服务> python /usr/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py# 浏览器访问http://192.168.40.10:5050/



官方安装参考:

https://www.postgresql.org/docs/10/static/installation.html (EN)

http://www.postgres.cn/docs/9.3/installation.html (CN)


pgadmin4 文档:https://www.pgadmin.org/docs/pgadmin4/dev/index.html


原创粉丝点击