Note the installation of PostgreSQL and Chinese word segmentation since the company uses PostgreSQL as its database and mysql as its previous database.

Installation environment

System: CentOS 8

PostgreSQL

  • websiteSelect the version and other information to generate the installation command:

  • Installation steps

  1. Example Add the RPM package of the PostgreSQL repository

DNF package manager overcomes some bottlenecks of YUM package manager, improving user experience, memory footprint, dependency analysis, speed, etc. DNF makes it easy to maintain package groups. And automatically resolve dependency issues).

dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

  1. View package details after installation (optional)

rpm -qi pgdg-redhat-repo

  1. Disable the built-in PostgreSQL module.

dnf -qy module disable postgresql

  1. Delete unwanted software packages from the cache

In the process of using DNF, there are various outdated files and incomplete compilation projects left in the system for various reasons. We can use this command to delete these useless junk files.

dnf clean all

  1. Install PostgreSQL

dnf install -y postgresql11-server

  1. Initializing the database

/usr/pgsql-11/bin/postgresql-11-setup initdb

  1. The database service is automatically started upon startup

“–now” indicates that the service is started at the same time as the activation. If it is added, step 8 is omitted.

systemctl enable (--now) postgresql-11

  1. Start the database

systemctl start(stop | restart | status) postgresql-11

  • The login

  1. Switch to user Postgres

After the installation is complete, the system automatically creates a postgres user (both the system user and the super administrator) to manage the PostgreSQL database. The password is empty.

su - postgres

  1. Logging In to the Database

psql

  1. Example Change the postgres login password

Alter user postgres with password

  1. exit

\q

  • Enabling Remote Access

  1. Example Modify the postgresql.conf configuration file

vim /var/lib/pgsql/11/data/postgresql.conf

Open the comments in the preceding figure, change listen_addresses to *, save the Settings, and exit.

  1. Example Modify the pg_hba.conf configuration file

vim /var/lib/pgsql/11/data/pg_hba.conf

As shown in the preceding figure, add host all all 0.0.0.0/0 MD5. Save the Settings and exit. Use DataGrip to test the connection

Installation of Chinese word segmentation:Install PostgresqL-11 and The Chinese word parser zhparser-2