Methods of domestic Godson install PostgreSQL database server source code

1. The company recently has demand for some of the localization project requires the installation of database server pg above domestic CPU and so on.

2 .. but poor check the next Kylin's official website, only postgreSQL 9.2 version of the operating system package rpm package source Godson MIPS inside, but require a minimum version 10.x there is no way to take the source code installed for installation .

3. the installation process. (Note arm of the CPU either soar or Huawei's process should all be exactly the same)

Download Source Package 3.1

Baidu search postgreslq official website, then you can download the source code.

HTTPS: // www.postgresql.org/ftp/source/v10.10/ 

specific download address is:
https://ftp.postgresql.org/pub/source/v10.10/postgresql-10.10.tar.gz

Interface effects:

 

 

3.2 linux folder created above

[root @ neoky01 ~] # mkdir / PG10 
[root @ neoky01 ~ ] # useradd Postgres 
[root @ neoky01 ~] # mkdir / PGDATA 
[root @ neoky01 ~] # chown Postgres: root / PGDATA 

first step in creating storage PG source folder
created in step 2 users to run postgreSQL database
create a directory database data files postgreSQL third step
is the main step to the fourth modification postgreSQL database storage directory data file

3.3 postgresql source code uploaded to the server / pg10 directory

3.4 unzip and install.

the tar - zxvf decompress compressed files 

cd .. into the file unzipped 

. Run the following command is executed 

. / Configure---without the readline --without-zlib 

perform make && make install installation

Godson 3 acridine 000 machine took about: 900s
15:01 to 15:16

and then into the contrib directory of the source files execute commands
make && make install
took about: 120s
15:19 to 15:21

3.5 modify environment variables

postgresql source installation to the default installation 
 / usr / local / pgSQL / bin 
this directory, for simplicity can modify the environment variable easy to use. 
Vim /etc/profile.d/ pg.sh 
increase on line contents to 
Export the PATH = the PATH $: / usr / local / pgSQL / bin 
and then bring it into force 
Source   /etc/profile.d/pg.sh

3.6 initialize the database

Users need to switch 
su - Postgres 
execute the command: 
 initdb -D / PGDATA 

to complete the process of creating the database.

The general message is:

[root@neoky01 bin]# su - postgres
[postgres@neoky01 ~]$ initdb -D /pgdata
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple".

Data page checksums are disabled.

fixing permissions on existing directory /pgdata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... PRC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /pgdata -l logfile start

3.7 systemd daemon service is set to start

Note that requires users to edit root 
Vim / etc / systemd / System / pg.service 

Inserts: 

[Unit] 
the Description = PG 

[-Service] 
the User = Postgres 

ExecStart = / usr / local / pgSQL / bin / the postmaster -D / PGDATA 
the Restart = Always 

[the Install] 
WantedBy = multi-user.target

Set the service to start automatically start the service as well

systemctl enable pg
systemctl restart pg

3.8 check the service status and modify the security profile

systemctl status pg

 

 You need to modify the security configuration, pay attention to database configuration files in / pgdata inside

3. Release monitor and modify the number of peer connections.

vim /pgdata/postgresql.conf

主要修改如下内容:
# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
port = 5432                             # (change requires restart)
max_connections = 2000                  # (change requires restart)

Modify the security profile

Vim / PGDATA / the pg_hba.conf 

increase in a row below ipv4 
Host All All              0.0 . 0.0 / 0               MD5

 

 Note that you must use md5 password trust can not use the password very unsafe so strongly do not recommend the use of trust ..

3.9 Setting postgres database user's password

Run the following linux 
SU - Postgres 
then Run
psql
enter postgreSQL database interface, such as a general message:

Then execute the command

alter role postgres with password 'Test6530';

Note that there must be a semicolon, and one lake to have a specific message can.

 

[root@neoky01 bin]# su - postgres
[postgres@neoky01 ~]$ psql
psql (10.10)
Type "help" for help.

postgres=# alter role postgres with password 'Test6530';
ALTER ROLE
postgres=#

 

alter role can occur.

 

3.10 postgresql restart a database, and can connect to verify

systemctl restart pg

Then use navicat connectivity test.

 

 The installation is complete. 

 

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11572671.html