当前位置:网站首页>[install PG]
[install PG]
2022-07-24 20:59:00 【xyywendy】
linux install PG
There are three ways to install , The first binary installation package installation , The second way is through yum install , The third kind of . Compile and install through source code
Be careful :
1. The binary package includes the compiled , Programs that can run directly . By downloading and unpacking ( install ), After executing this instruction, you can use it immediately . Simple and quick , Suitable for relatively fixed , Procedures that do not need to be changed .
2. The source code package contains the original code of the program , It must be compiled on your computer , Generated executable binary files , To run . Some personal developed programs , The third-party modification or the program you want to modify should be compiled and installed through the source code package .
In fact, the first kind and the second kind can be divided into one kind , Here is a defect if the prompt has dependencies , You need to install dependencies .
Compile and install through source code
This installation method is relatively free , Installation can be minimized , It can also be fully installed .
Dependent packages before compilation , With RedHat/CentOS For example :
Minimum dependence :gcc,gcc-c++,zlib-devdl,readline-devel
Other dependence :perl-ExtUtils-Embed,pam-devel,libxslt-devel,openldap-devel,python-devel,openssl-devel,cmake
The installation of source code generally consists of three steps :
Download source package :https://www.postgresql.org/ftp/source/
# decompression tar.gz command
tar -xzvf file.tar.gz
Download the suffix .tar.gz My bag , You can also download the latest version . After decompression , use cd Command to this directory , Use ll perhaps ls You can see all the extensions below . Next, enter the three steps of installation .
- 1. To configure (configure)
configure Configuration instructions :./configure -help You can output a detailed list of options
Main options :
prefix: Specify installation path
with-openssl: Yes openssl Extended support
with-python: Yes python Extended support
with-perl: Yes perl Extended support
with-libxml: Yes xml Extended support
./configure --prefix=/usr/local/pg122 --with-pgport=1923 --with-openssl --with-perl --with-tcl --with-python --with-pam --without-ldap --with-libxslt --enable-thread-safty --with-wal-blocaksize=16 --with-blocksize=8 --enable-dtrace --enable-debug
./configure --prefix=/usr/local/pg141 --with-pgport=1923 -with-openssl --with-python --with-pam --with-libxml --with-libxslt --enable-tread-safety
Be careful :
–with-blocksize
If the database needs to be inserted frequently , The amount of data is growing very fast , Try to set this parameter larger ; Often do small data query , When updating and the memory is not very large, you can set it smaller . Default 8k that will do .
–enable-dtrace --enble-debug Do not add
- 2. compile (make)
gmake world -- Including all compilation of third-party plug-ins
gmake check-world -- This needs to be executed by ordinary users , Optional , Longer time consuming
Note that if the dependent dynamic library is missing , You need to install it in advance ,gmake world The installation includes documentation , be-all contirb
- 3. install (make install)
gmake install-world -- Including the installation of all third-party plug-ins
- 4. To configure
Create a normal user startup database , Super user cannot start database , If you use super user to start , Need to modify the source code , Yes root Some things detected by users , And modify its profile
useradd postgres
su - postgres
gedit/vim ~/.bashrc(bash_profile)
#add
export PGPORT=1923
export PG_HOME=/usr/local/pg122
export PATH=$PG_HOME/data
export LD_LIBRARY_PATH=$PG_HOME/lib
export LANG=en_US.utf8
# Save the document , Then activate
source ~/.bashrc
After the software is installed , To initialize
initialization (initdb)
- 1. Database cluster “cluster”, Is a file containing all the data 、 Profile's “data” Catalog
- 2. A physical server can have multiple cluster, adopt data Path and port Distinguish between port numbers .
- 3. Compile the installed database , need initdb Command to manually initialize the data Catalog , Common parameters are as follows :-D:data Path to directory -U: Database super user name -E: Configure regional language 、 Character set
initdb -D $PGDATA -E UTF8 --locale=C -U postgres -W
Pay attention to add -W The parameter will prompt for the password of the super user of the database , The password is blank by default
Modify the configuration file before starting the database
pg_hba.conf Used to configure the source of controlling access to the database
postgresql.conf Is the main configuration file of the database , You'd better adjust it, too linux Kernel parameters .
The installation is completed and ready to start the authentication service .
How to uninstall the compilation software installation
Compile and install how to uninstall : Three unloading methods
- 1. Remove installation directory : Check whether it is used when installing the software –prefix This command , If so, delete the file you specified ;
- 2. Execute the uninstall program : If it doesn't work –prefix This directory specifies , Enter the directory after software decompression , perform sudo make uninstall See if you can make it ;
- 3. Search and delete relevant directories : The last resort is to use whereis postgresql Locate the software installation directory ,rm -rf dir Delete these directories
边栏推荐
- Summary of communication with customers
- How to set appium script startup parameters
- [basic data mining technology] KNN simple clustering
- [msp430g2553] graphical development notes (1) configuration environment
- whistle ERR_ CERT_ AUTHORITY_ INVALID
- [training Day10] point [enumeration] [bidirectional linked list]
- Top 10 in China's HCI software market: Huawei, Xinhua, Shenxin, VMware, Lenovo, smartx, Inspur, Qingyun, lutanli, dawn
- Leetcode 15. sum of three numbers
- [feature construction] construction method of features
- Do you want to verify and use the database in the interface test
猜你喜欢

Summary of yarn capacity scheduler

Baidu PaddlePaddle easydl helps improve the inspection efficiency of high-altitude photovoltaic power stations by 98%

A simple method of converting SVG to PDF

The difference between map and flatmap in stream

Opengl rendering pipeline

How to use named slots
![[training Day8] tent [mathematics] [DP]](/img/d3/42869ed5bb7c9148d9fa7367a9af02.png)
[training Day8] tent [mathematics] [DP]

Pychart tutorial: 5 very useful tips

Go language error handling

Generate self signed certificate: generate certificate and secret key
随机推荐
Evaluation of four operation expressions
What should Ali pay attention to during the interview? Personal account of Alibaba interns who passed five rounds of interviews
Experience of using dump file to reverse locate crash location
Baidu PaddlePaddle easydl helps improve the inspection efficiency of high-altitude photovoltaic power stations by 98%
Lecun proposed that mask strategy can also be applied to twin networks based on vit for self supervised learning!
Let's make a nice monthly temperature map of China with ArcGIS
Luogu - p1616 crazy herb picking
Intranet penetration learning (I) introduction to Intranet
[training Day6] game [mathematics]
Teach you five ways to crack the computer boot password
Go language pack management
[training Day8] series [matrix multiplication]
Five digital transformation strategies of B2B Enterprises
Pychart tutorial: 5 very useful tips
Delete remote and local branches
A simple method of converting SVG to PDF
Acwing 94. recursive implementation of permutation enumeration
Detailed explanation of ThreadLocal
Intel internship mentor layout problem 1
Merge sort