贺州网站建设公司,便民服务,公司ui设计是什么,公司网站怎么设计零、前置条件
系统CentOS 7#xff0c;并已联网#xff0c;已安装gcc或者g编译器#xff0c;GNU make版本3.80或以上#xff0c;系统有至少一个除root之外的普通用户user gcc安装-参考链接查看make命令的版本——make --version更新make版本-参考链接postgresql的使用一般…零、前置条件
系统CentOS 7并已联网已安装gcc或者g编译器GNU make版本3.80或以上系统有至少一个除root之外的普通用户user gcc安装-参考链接查看make命令的版本——make --version更新make版本-参考链接postgresql的使用一般不用root用户而是普通用户这里假设普通用户名为user。Linux创建新用户-参考链接 Xshell建立起与CentOS 7系统的会话Xftp同样建立了与CentOS 7的链接
一、下载、转移、解压
下载
首先在本地打开以链接下载postgresql-xx.xreadline-7.0zlib-1.2.xx
https://www.postgresql.org/ftp/source/PostgresSQL建议下载最新版本打开后的版本列表中选择最新的正式版本最好不要选带beta的
http://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz下载zlib前先开官网http://www.zlib.net/看一下最新版本号比如这里是1.2.13那么下面下载链接中的版本号就改成最新的版本号
http://www.zlib.net/zlib-1.x.xx.tar.gz转移
在root用户下的/root目录下操作
[rootlocalhost ~]# mkdir pgsoft打开xftp将刚刚下载好的三个压缩包拖到刚刚建立目录下面/root/pgsoft
解压
[rootlocalhost pgsoft]# tar -xf readline-7.0.tar.gz
[rootlocalhost pgsoft]# tar -xf zlib-1.x.xx.tar.gz
[rootlocalhost pgsoft]# tar -xf postgresql-xx.x.tar.gz版本号根据实际情况来
二、安装
readline安装
[rootlocalhost pgsoft]# cd readline-7.0
[rootlocalhost readline-7.0]# ./configure
[rootlocalhost readline-7.0]# make
[rootlocalhost readline-7.0]# make install安装readline开发包readline-devel不然后面安装postgresql时会提示错误configure: error: readline library not found
[rootlocalhost readline-7.0]# yum install readline-develzlib安装
[rootlocalhost readline-7.0]# cd /root/pgsoft/zlib-1.x.xx
[rootlocalhost zlib-1.x.xx]# ./configure
[rootlocalhost zlib-1.x.xx]# make
[rootlocalhost zlib-1.x.xx]# make installpostgresql安装
# 为pg安装新建一个目录/opt/pgsql-xx.x
[rootlocalhost ~]# mkdir -p /opt/pgsql-xx.x# 将opt目录的拥有权给予给普通用户user
[rootlocalhost ~]# chown user -R /opt # 进入下载转移解压后的postgresql目录
[rootlocalhost ~]# cd /root/pgsoft/postgresql-xx.x# 配置postgresql
[rootlocalhost postgresql-xx.x]# ./configure --prefix/opt/pgsql-xx.x# 编译postgresql这一步耗时稍微较长
[rootlocalhost postgresql-xx.x]# make world# 安装postgresql
[rootlocalhost postgresql-xx.x]# make install -world验证postgres是否安装成功
# 查看安装目录/opt/pgsql-xx.x安装成功的话会出现以下四个目录
[rootlocalhost postgresql-15.3]# ll /opt/pgsql-xx.x/
总用量 16
drwxr-xr-x. 2 root root 4096 6月 9 09:29 bin
drwxr-xr-x. 6 root root 4096 6月 9 09:29 include
drwxr-xr-x. 4 root root 4096 6月 9 09:29 lib
drwxr-xr-x. 6 root root 4096 6月 9 09:29 share# 查看安装的postgres版本是否对应这里以15.3版本为例
[rootlocalhost postgresql-15.3]# /opt/pgsql-15.3/bin/postgres --version
postgres (PostgreSQL) 15.3三、安装数据目录
数据目录即后续数据库使用中数据存放的目录
# 递归创建新目录版本号记得根据实际情况更换
[rootlocalhost ~]# mkdir -p /pgdata/15.3/poc/{data,archive,scripts,backup}# 将该目录的拥有权赋给普通用户user
[rootlocalhost ~]# chown -R user /pgdata/15.3/# 初始化数据目录
# 首先由root切换到普通用户
[rootlocalhost pgsoft]# su - user
上一次登录五 6月 9 09:32:48 CST 2023pts/0 上
# 进入数据目录用initdb命令初始化该目录初始化成功后最后出现Success字样
[userlocalhost ~]$ cd /pgdata/15.3/poc
[userlocalhost poc]$ /opt/pgsql-15.3/bin/initdb -D /pgdata/15.3/poc/data/ -E UTF-8
……
……
Success. You can now start the database server using:/opt/pgsql-15.3/bin/pg_ctl -D /pgdata/15.3/poc/data/ -l logfile start# 对数据目录开放读写执行权限
[userblocalhost poc]$ chmod 0700 data/# 启动PostgreSQL启动成功后最后一行会出现server started
[userblocalhost poc]$ /opt/pgsql-15.3/bin/pg_ctl -D /pgdata/15.3/poc/data/ start
waiting for server to start....2023-06-09 09:43:50.826 CST [18923] LOG: starting PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2023-06-09 09:43:50.828 CST [18923] LOG: listening on IPv6 address ::1, port 5432
2023-06-09 09:43:50.828 CST [18923] LOG: listening on IPv4 address 127.0.0.1, port 5432
2023-06-09 09:43:50.832 CST [18923] LOG: listening on Unix socket /tmp/.s.PGSQL.5432
2023-06-09 09:43:50.836 CST [18926] LOG: database system was shut down at 2023-06-09 09:42:19 CST
2023-06-09 09:43:50.855 CST [18923] LOG: database system is ready to accept connectionsdone
server started四、创建PostgreSQL第一个数据库实例
# 使用createdb命令创建第一个数据库实例如果不产生任何响应则表示该步骤成功
[userblocalhost poc]$ /opt/pgsql-15.3/bin/createdb my_first_pgdb五、将PostgreSQL的安装路径添加到Shell的搜索路径
# 注意切换到root用户
[rootlocalhost ~]# su - root
password:# 当前环境变量中的路径
[rootlocalhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin# 将postgres安装目录/opt/pgsql-xx.x/bin添加到环境变量中
[rootlocalhost ~]# export PATH$PATH:/opt/pgsql-15.3/bin# 再次查看环境变量PATH值
[rootlocalhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/pgsql-15.3/bin# 验证是否有效不在安装目录下直接运行postgres --version如果能出现相关信息则表示已经添加成功
[rootlocalhost ~]# postgres --version
postgres (PostgreSQL) 15.3# 添加完成路径后可以直接使用/opt/pgsql-15.3/bin下的命令而不需要加绝对路径例如上面创建数据库实例可以直接写成
[userblocalhost poc]$ createdb my_first_pgdb
文章转载自: http://www.morning.yysqz.cn.gov.cn.yysqz.cn http://www.morning.npbnc.cn.gov.cn.npbnc.cn http://www.morning.ltbwq.cn.gov.cn.ltbwq.cn http://www.morning.dzfwb.cn.gov.cn.dzfwb.cn http://www.morning.wklmj.cn.gov.cn.wklmj.cn http://www.morning.fysdt.cn.gov.cn.fysdt.cn http://www.morning.msfqt.cn.gov.cn.msfqt.cn http://www.morning.sbrxm.cn.gov.cn.sbrxm.cn http://www.morning.rnpt.cn.gov.cn.rnpt.cn http://www.morning.rnlx.cn.gov.cn.rnlx.cn http://www.morning.xxsrm.cn.gov.cn.xxsrm.cn http://www.morning.lfdzr.cn.gov.cn.lfdzr.cn http://www.morning.ahlart.com.gov.cn.ahlart.com http://www.morning.frpb.cn.gov.cn.frpb.cn http://www.morning.lctrz.cn.gov.cn.lctrz.cn http://www.morning.rjrh.cn.gov.cn.rjrh.cn http://www.morning.djxnw.cn.gov.cn.djxnw.cn http://www.morning.syglx.cn.gov.cn.syglx.cn http://www.morning.hjjhjhj.com.gov.cn.hjjhjhj.com http://www.morning.xlyt.cn.gov.cn.xlyt.cn http://www.morning.jjwzk.cn.gov.cn.jjwzk.cn http://www.morning.xxwfq.cn.gov.cn.xxwfq.cn http://www.morning.mdmxf.cn.gov.cn.mdmxf.cn http://www.morning.cbqqz.cn.gov.cn.cbqqz.cn http://www.morning.yrms.cn.gov.cn.yrms.cn http://www.morning.rjynd.cn.gov.cn.rjynd.cn http://www.morning.gsdbg.cn.gov.cn.gsdbg.cn http://www.morning.ltypx.cn.gov.cn.ltypx.cn http://www.morning.rqjxc.cn.gov.cn.rqjxc.cn http://www.morning.rxpp.cn.gov.cn.rxpp.cn http://www.morning.ltrz.cn.gov.cn.ltrz.cn http://www.morning.yltyz.cn.gov.cn.yltyz.cn http://www.morning.rbbzn.cn.gov.cn.rbbzn.cn http://www.morning.bpttm.cn.gov.cn.bpttm.cn http://www.morning.tynqy.cn.gov.cn.tynqy.cn http://www.morning.eronghe.com.gov.cn.eronghe.com http://www.morning.nzhzt.cn.gov.cn.nzhzt.cn http://www.morning.xzrbd.cn.gov.cn.xzrbd.cn http://www.morning.xzrbd.cn.gov.cn.xzrbd.cn http://www.morning.mwrxz.cn.gov.cn.mwrxz.cn http://www.morning.rrdch.cn.gov.cn.rrdch.cn http://www.morning.bwmm.cn.gov.cn.bwmm.cn http://www.morning.ykxnp.cn.gov.cn.ykxnp.cn http://www.morning.xqndf.cn.gov.cn.xqndf.cn http://www.morning.xkzmz.cn.gov.cn.xkzmz.cn http://www.morning.ntyks.cn.gov.cn.ntyks.cn http://www.morning.pnmtk.cn.gov.cn.pnmtk.cn http://www.morning.dtnjr.cn.gov.cn.dtnjr.cn http://www.morning.fbmjw.cn.gov.cn.fbmjw.cn http://www.morning.rkwwy.cn.gov.cn.rkwwy.cn http://www.morning.tjpmf.cn.gov.cn.tjpmf.cn http://www.morning.sjwzz.cn.gov.cn.sjwzz.cn http://www.morning.jcrfm.cn.gov.cn.jcrfm.cn http://www.morning.rqfzp.cn.gov.cn.rqfzp.cn http://www.morning.fndfn.cn.gov.cn.fndfn.cn http://www.morning.wpmqq.cn.gov.cn.wpmqq.cn http://www.morning.mrfjr.cn.gov.cn.mrfjr.cn http://www.morning.kpcky.cn.gov.cn.kpcky.cn http://www.morning.chmkt.cn.gov.cn.chmkt.cn http://www.morning.daidudu.com.gov.cn.daidudu.com http://www.morning.pwksz.cn.gov.cn.pwksz.cn http://www.morning.hflrz.cn.gov.cn.hflrz.cn http://www.morning.pmghz.cn.gov.cn.pmghz.cn http://www.morning.xcszl.cn.gov.cn.xcszl.cn http://www.morning.dfckx.cn.gov.cn.dfckx.cn http://www.morning.rlwcs.cn.gov.cn.rlwcs.cn http://www.morning.bryyb.cn.gov.cn.bryyb.cn http://www.morning.mjkqj.cn.gov.cn.mjkqj.cn http://www.morning.mwmxs.cn.gov.cn.mwmxs.cn http://www.morning.wjhpg.cn.gov.cn.wjhpg.cn http://www.morning.yhwmg.cn.gov.cn.yhwmg.cn http://www.morning.yfphk.cn.gov.cn.yfphk.cn http://www.morning.hrpmt.cn.gov.cn.hrpmt.cn http://www.morning.srnhk.cn.gov.cn.srnhk.cn http://www.morning.pmptm.cn.gov.cn.pmptm.cn http://www.morning.dmzmy.cn.gov.cn.dmzmy.cn http://www.morning.qrlkt.cn.gov.cn.qrlkt.cn http://www.morning.kwxr.cn.gov.cn.kwxr.cn http://www.morning.wnpps.cn.gov.cn.wnpps.cn http://www.morning.nrll.cn.gov.cn.nrll.cn