> /etc/hosts mount /dev/cdrom /mnt 02、安装pg所需要的" /> > /etc/hosts mount /dev/cdrom /mnt 02、安装pg所需要的" />
1、linux上源码方式安装postgresql12 01、准备操作系统环境 echo "192.168.1.61 tsepg61" >> /etc/hosts mount /dev/cdrom /mnt 02、安装pg所需要的
echo "192.168.1.61 tsepg61" >> /etc/hosts
mount /dev/cdrom /mnt
yum install -y cmake make GCc zlib gcc-c++ perl readline readline-devel zlib
zlib-devel perl python36 tcl openssl ncurses-devel openldap pam
groupadd -g 60000 pgsql
useradd -u 60000 -g pgsql pgsql
echo "pgsql" |passwd --stdin pgsql
mkdir -p /postgresql/{pgdata,arcHive,scripts,backup,pg12,soft}
chown -R pgsql:pgsql /postgresql
chmod -R 775 /postgresql
#进入pgsql用户开始解压pg源码
su - pgsql
cd /postgresql/soft
tar zxvf postgresql-12.2.tar.gz
cd postgresql-12.2
#prefix是安装的目录,--without-readline代表命令行中不现实历史命令,就是history这个命令
./configure --prefix=/postgresql/pg12 --without-readline
make
make install
su - pgsql
vi ~/.bash_profile
export LANG=en_US.UTF8
export PS1="[`whoami`@`hostname`:""$PWD]$"
export PGPORT=5432
export PGDATA=/postgresql/pgdata
export PGHOME=/postgresql/pg12
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIBRARY_PATH
export PATH=$PGHOME/bin:$PATH:.
export MANPATH=$PGHOME/share/man:$MANPATH
su - pgsql
/postgresql/pg12/bin/initdb -U postgres -D /postgresql/pgdata -E UTF8 --locale=en_US.utf8
/postgresql/pgdata/postgresql.conf
/postgresql/pgdata/pg_hba.conf
su - pgsql
#pg服务启动
pg_ctl start
pg_ctl stop
#or或者命令启动
nohup /postgresql/pg12/bin/postgres -D /postgresql/pgdata > /postgresql/pg12/pglog.out 2>&1 &
#or或者写成服务配置开机启动
vi /etc/systemd/system/postgresql.service
[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)
[Service]
Type=notify
User=pgsql
ExecStart= /postgresql/pg12/bin/postgres -D /postgresql/pgdata
ExecReload=/bin/kill -HUP $MaiNPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target
#相关的开机启动命令
systemctl enable postgresql
systemctl start postgresql
systemctl status postgresql
su - pgsql
psql
passWord postgres
#or:
alter user postgres with password "123456";
create table tsetbs (name varchar(50));
insert into tsetbs values("百度");
insert into tsetbs values("阿里");
insert into tsetbs values("腾讯");
insert into tsetbs values("www.baidu.com");
insert into tsetbs values("wx");
insert into tsetbs values("yone-com");
insert into tsetbs values("wx-gzh");
insert into tsetbs values("yone_com");
insert into tsetbs values("oracle");
insert into tsetbs values("Mysql");
insert into tsetbs values("NoSQL");
insert into tsetbs values("pgsql");
insert into tsetbs values("深圳");
insert into tsetbs values("广州");
select * from tsetbs;
psql -U postgres -h127.0.0.1
--结束END--
本文标题: Linux上生产环境源码方式安装配置postgresql12
本文链接: https://lsjlt.com/news/8598.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0