当前位置:网站首页>Use Yum or up2date to install the postgresql13.3 database
Use Yum or up2date to install the postgresql13.3 database
2022-07-06 23:53:00 【Hua Weiyun】

1、 Installation Overview
PG There are many ways to install , and MySQL similar , Give users a lot of choice . Such as :RPM Package installation ( On-line 、 offline )、 Source code compilation and installation 、 System comes with 、 Binary system 、NDB Installation, etc .
https://yum.postgresql.org/rpmchart.php
https://yum.postgresql.org/11/redhat/rhel-6-x86_64/repoview/postgresqldbserver11.group.html
https://www.postgresql.org/ftp/source/
open PostgreSQL Official website https://www.postgresql.org/, Click... On the menu bar Download , As you can see, there are many installation packages for the platform , Include Linux、Windows、Mac OS etc. .
Each installation package :https://www.postgresql.org/ftp/source/
Linux We can see support Ubuntu and Red Hat And so on , Click on the specific platform link , You can see the installation method :

Click on the image above file browser, We can also download PostgreSQL The latest source code .

Download address :
https://www.postgresql.org/download
https://yum.postgresql.org/repopackages.php
file :https://www.postgresql.org/download/linux/redhat/
rpm download :https://yum.postgresql.org/rpmchart/
2、yum Online installation
-- Some dependency packages yum install -y cmake make gcc zlib gcc-c++ perl readline readline-devel zlib zlib-devel \perl python36 tcl openssl ncurses-devel openldap pam-- Delete existing PGyum remove -y postgresql* && rm -rf /var/lib/pgsql && rm -rf /usr/pgsql* && userdel -r postgres && groupdel postgresyum install -y sysbench-- install yum Source yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpmyum repolist all | grep pgdgyum repolist enabled | grep pgdg-- install pgyum install -y postgresql13 postgresql13-server postgresql13-contrib postgresql13-libs# yum install -y postgresql9.6 postgresql9.6-server# yum install postgresql10-server postgresql10-contrib postgresql10 postgresql10.x86_64-- verification [root@lhrpg /]# rpm -aq| grep postgrespostgresql13-server-13.3-1PGDG.rhel7.x86_64postgresql13-13.3-1PGDG.rhel7.x86_64postgresql13-libs-13.3-1PGDG.rhel7.x86_64postgresql13-contrib-13.3-1PGDG.rhel7.x86_64-- environment variable echo "export PATH=/usr/pgsql-13/bin:$PATH" >> /etc/profile3、 initialization PG, And start the PG
/usr/pgsql-13/bin/postgresql-13-setup initdbsystemctl enable postgresql-13systemctl start postgresql-13systemctl status postgresql-134、 Change Password
-- Local landing su - postgrespsql-- Installing a plug-in create extension pageinspect;create extension pg_stat_statements;select * from pg_extension ;select * from pg_available_extensions order by name;-- modify postgres password alter user postgres with encrypted password 'lhr'; or \passwordselect * from pg_tables;select version();5、 Open the firewall
-- Open the firewall firewall-cmd --add-port=5432/tcp --permanentfirewall-cmd --reloadfirewall-cmd --list-port6、 Configuration allowed PG Remote login
-- Configuration allowed PG Remote login , Note that version :cat >> /var/lib/pgsql/13/data/postgresql.conf <<"EOF"listen_addresses = '*'port=5432unix_socket_directories='/var/lib/pgsql/13/data'logging_collector = onlog_directory = 'pg_log'log_filename = 'postgresql-%a.log'log_truncate_on_rotation = onEOFcat << EOF > /var/lib/pgsql/13/data/pg_hba.conf# TYPE DATABASE USER ADDRESS METHODlocal all all trusthost all all ::1/128 trusthost all all 127.0.0.1/32 trusthost all all 0.0.0.0/0 md5host replication all 0.0.0.0/0 md5EOFsystemctl restart postgresql-137、 Login test
-- Remote login psql -U postgres -h 192.168.66.35 -d postgres -p54327-- from Postgresql 9.2 Start , You can also use URI Format for remote connection :psql postgresql://myuser:[email protected]:5432/mydbpsql postgresql://postgres:[email protected]:54327/postgresamong -h Parameter specifies the server address , The default is 127.0.0.1, It is not specified by default ,-d Specify the database selected after connection , The default is postgres,-U Designated user , The default is the current user ,-p Specify port number , The default is "5432", More parameter options are available : ./bin/psql --help see .
C:\Users\lhrxxt>psql -U postgres -h 192.168.66.35 -d postgres -p54327Password for user postgres:psql (13.3)Type "help" for help.postgres=# select version(); version------------------------------------------------------------------------------------------------------------------ PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit(1 row)postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges-----------+----------+----------+-------------------+-------------------+----------------------- postgres | postgres | UTF8 | Chinese_China.936 | Chinese_China.936 | template0 | postgres | UTF8 | Chinese_China.936 | Chinese_China.936 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | Chinese_China.936 | Chinese_China.936 | =c/postgres + | | | | | postgres=CTc/postgres(3 rows)postgres=# CREATE DATABASE lhrdb WITH OWNER=postgres ENCODING='UTF-8';CREATE DATABASEpostgres=# \c lhrdbYou are now connected to database "lhrdb" as user "postgres".lhrdb=#lhrdb=# create table student (lhrdb(# id integer not null,lhrdb(# name character(32),lhrdb(# number char(5),lhrdb(# constraint student_pkey primary key (id)lhrdb(# );CREATE TABLElhrdb=#lhrdb=# \d student Table "public.student" Column | Type | Collation | Nullable | Default--------+---------------+-----------+----------+--------- id | integer | | not null | name | character(32) | | | number | character(5) | | |Indexes: "student_pkey" PRIMARY KEY, btree (id)lhrdb=#lhrdb=# INSERT INTO student (id, name, number) VALUES (1, ' Zhang San ', '1023');INSERT 0 1lhrdb=# SELECT * FROM student WHERE id=1; id | name | number----+------------------------------------+-------- 1 | Zhang San | 1023(1 row)8、 Configure environment variables
mkdir -p /home/postgreschown postgres.postgres /home/postgres -Rsed -i 's|/var/lib/pgsql|/home/postgres|' /etc/passwdecho "lhr" |passwd --stdin postgrescat > /home/postgres/.bash_profile <<"EOF"export PGPORT=5432export PGHOME=/usr/pgsql-13export PGDATA=/var/lib/pgsql/13/dataexport PATH=$PGHOME/bin:$PATHexport MANPATH=$PGHOME/share/man:$MANPATHexport LANG=en_US.UTF-8export DATE='date +"%Y%m%d%H%M"'export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATHexport PGHOST=$PGDATAexport PGUSER=postgresexport PGPASSWORD=lhrexport PGDATABASE=postgresexport PS1="[\[email protected]\h \W]\$ "alias psql='rlwrap psql' EOFchown postgres.postgres /home/postgres/.bash_profileInstallation configuration completed , If you don't understand , You can chat with Mr. Mai privately .
边栏推荐
- 零代码高回报,如何用40套模板,能满足工作中95%的报表需求
- Unity color palette | color palette | stepless color change function
- How about the order management of okcc call center
- MIT 6.824 - Raft学生指南
- [unmanned aerial vehicle] multi unmanned cooperative task allocation program platform, including Matlab code
- 【自动化测试框架】关于unittest你需要知道的事
- leetcode:236. The nearest common ancestor of binary tree
- Talking about the current malpractice and future development
- The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
- 自动化测试工具Katalon(Web)测试操作说明
猜你喜欢

人均瑞数系列,瑞数 4 代 JS 逆向分析

Close unregistering application XXX with Eureka with status down after Eureka client starts

MATLIB从excel表中读取数据并画出函数图像

Gold three silver four, don't change jobs

Hydrogen future industry accelerates | the registration channel of 2022 hydrogen energy specialty special new entrepreneurship competition is opened!

Knowledge * review

B 站弹幕 protobuf 协议还原分析

DAY TWO

Please help xampp to do sqlilab is a black

Today, I met a senior test developer from Tencent and saw the ceiling of the foundation
随机推荐
Master binary tree in one article
设计一个抢红包系统
Without CD, I'll teach you a trick to restore the factory settings of win10 system
Gold three silver four, don't change jobs
Wind chime card issuing network source code latest version - commercially available
基于SSM框架实现的房屋租赁管理系统
The best sister won the big factory offer of 8 test posts at one go, which made me very proud
在Docker中分分钟拥有Oracle EMCC 13.5环境
Daily question brushing record (XV)
传统企业要为 Web3 和去中心化做的 11 个准备
Hydrogen future industry accelerates | the registration channel of 2022 hydrogen energy specialty special new entrepreneurship competition is opened!
Example code of MySQL split string as query condition
Local deployment Zeppelin 0.10.1
How does win11 restore the traditional right-click menu? Win11 right click to change back to traditional mode
MATLIB reads data from excel table and draws function image
DAY THREE
PostgreSQL使用Pgpool-II实现读写分离+负载均衡
Knowledge * review
微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
Wasserstein slim gain with gradient poverty (wsgain-gp) introduction and code implementation -- missing data filling based on generated countermeasure network