Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install pg11.5 when compiling source code

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "source code compilation how to install pg11.5". In daily operation, I believe many people have doubts about how to install pg11.5 in source code compilation. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "source code compilation how to install pg11.5". Next, please follow the editor to study!

1. Environment preparation 1. Install dependency packages

Yum-y install gcc*

Yum-y install python python-devel

Yum-y install perl-ExtUtils-Embed

Yum-y install zlib-devel

Yum-y install readline*

2. Create user groups and directories

Groupadd-g 1001 postgres # add user groups

Useradd-g 1001-u 1001 postgres # New users

[root@pg11 ~] # id postgres

Uid=1001 (postgres) gid=1001 (postgres) groups=1001 (postgres)

Passwd postgres # set the password for the user

3. Create a directory

Mkdir-p / usr/local/pgsql11.5

Chown-R postgres:postgres / usr/local/pgsql11.5/

Mkdir-p / home/osdata/pgdata

Chown-R postgres:postgres / home/osdata/

Chmod 0700 / home/osdata/pgdata

4. Modify the environment variable (postgres user)

Export PATH=/usr/local/pgsql11.5/bin:$PATH

Export LD_LIBRARY_PATH=/usr/local/pgsql11.5/lib

Export PGDATA=/home/osdata/pgdata

5. Upload the software package and extract it (root)

[root@pg11 pgsql11.5] # ll

Total 19312

-rw-r--r--. 1 root root 19773087 Oct 30 20:05 postgresql-11.5.tar.bz2

[root@pg11 pgsql11.5] # chown-R postgres:postgres / usr/local/pgsql11.5/

[root@pg11 pgsql11.5] # ll

Total 19312

-rw-r--r--. 1 postgres postgres 19773087 Oct 30 20:05 postgresql-11.5.tar.bz2

Tar-xvf postgresql-11.5.tar.bz2

6. Generate links

Ln-sf / usr/local/pgsql11.5 / usr/local/pgsql

Second, install postgresql1 and compile

Cd postgresql-11.5/

. / configure-- prefix=/usr/local/pgsql11.5-- with-perl-- with-python

2. Installation

Compile and install all the documents and add-ons at one time

Gmake world

"PostgreSQL, contrib, and documentation successfully made. Ready to install." It indicates that the compilation is successful.

Gmake install-world

"PostgreSQL, contrib, and documentation installation complete." Indicates that the installation was successful

View version

[postgres@pg11 postgresql-11.5] $postgres-- version

Postgres (PostgreSQL) 11.5

3. Initialize the database

Initdb-D / home/osdata/pgdata/-W

4. Start the database

Pg_ctl-D $PGDATA-l logfile start

5. View the instance process

[postgres@pg ~] $ps-ef | grep postgres

Postgres 56625 1 0 Mar04? 00:00:03 / usr/local/pgsql11.5/bin/postgres-D / home/osdata/pgdata

Postgres 56627 56625 0 Mar04? 00:00:00 postgres: checkpointer

Postgres 56628 56625 0 Mar04? 00:00:01 postgres: background writer

Postgres 56629 56625 0 Mar04? 00:00:01 postgres: walwriter

Postgres 56630 56625 0 Mar04? 00:00:05 postgres: autovacuum launcher

Postgres 56631 56625 0 Mar04? 00:00:10 postgres: stats collector

Postgres 56632 56625 0 Mar04? 00:00:00 postgres: logical replication launcher

Root 76758 76699 0 11:01 pts/0 00:00:00 su-postgres

Postgres 76759 76758 0 11:01 pts/0 00:00:00-bash

Postgres 76797 76759 0 11:01 pts/0 00:00:00 psql

Postgres 76801 56625 0 11:01? 00:00:00 postgres: postgres test [local] idle

Root 77192 77145 0 11:21 pts/1 00:00:00 su-postgres

Postgres 77193 77192 0 11:21 pts/1 00:00:00-bash

Postgres 79582 77193 0 13:45 pts/1 00:00:00 ps-ef

Postgres 79583 77193 0 13:45 pts/1 00:00:00 grep-color=auto postgres

View database status

[postgres@pg11] $pg_ctl-D / home/osdata/pgdata/ status

Pg_ctl: server is running (PID: 23588)

/ usr/local/pgsql11.5/bin/postgres "- D"/ home/osdata/pgdata"

6. Set the boot self-startup

Configure scripting service

There are service scripts applicable to linux, freebsd and macos in the contrib directory of the source package.

[root@pg11 ~] # cd / usr/local/pgsql/postgresql-11.5/contrib/start-scripts

[root@pg11 start-scripts] # ll

Total 8

-rw-r--r--. 1 postgres postgres 1467 Aug 6 2019 freebsd

-rw-r--r--. 1 postgres postgres 3552 Aug 6 2019 linux

Drwxrwxr-x. 2 postgres postgres 84 Aug 6 2019 macos

Copy the script named linux to the / etc/init.d directory and rename it postgresql11

[root@pg11 ~] # cp / usr/local/pgsql/postgresql-11.5/contrib/start-scripts/linux / etc/init.d/postgresql11

[root@pg11 init.d] # chmod + x postgresql-11

[root@pg11 init.d] # chkconfig postgresql-11 on

[root@pg11 init.d] # chkconfig-- list | grep postgresql-11

Postgresql-11 0:off 1:off 2:on 3:on 4:on 5:on 6:off

7. Log in to the database

[postgres@pg ~] $psql

Psql (11.5)

Type "help" for help.

Postgres=#

At this point, on the "source code compilation how to install pg11.5" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report