/ home / computer / postgresql / postgresql-for-mysql-admins / .
apt/dnf install postgresql
systemctl stop/start/status postgresjournalctl -xeu postgresPostgreSQL runs under O/S user postgres.
$ grep postgre /etc/passwd postgres:x:130:142:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash
Process is called postgres mysql@chef:~ [mariadb-114, 3358]> ps -ef | grep postgres postgres 2085 1 0 11:08 ? 00:00:00 /usr/lib/postgresql/16/bin/postgres -D /var/lib/postgresql/16/main -c config_file=/etc/postgresql/16/main/postgresql.conf postgres 2100 2085 0 11:08 ? 00:00:00 postgres: 16/main: checkpointer postgres 2101 2085 0 11:08 ? 00:00:00 postgres: 16/main: background writer postgres 2103 2085 0 11:08 ? 00:00:00 postgres: 16/main: walwriter postgres 2104 2085 0 11:08 ? 00:00:00 postgres: 16/main: autovacuum launcher postgres 2105 2085 0 11:08 ? 00:00:00 postgres: 16/main: logical replication launcher
reload vs. restart
postgres@chef:~$ ss -tlpn State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 200 127.0.0.1:5432 0.0.0.0:* users:((“postgres”,pid=2085,fd=7)) LISTEN 0 200 [::1]:5432 [::]:* users:((“postgres”,pid=2085,fd=6))
postgres@chef:~$ lsof -p 2085 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME postgres 2085 postgres cwd DIR 8,17 4096 805617 /var/lib/postgresql/16/main postgres 2085 postgres rtd DIR 8,17 4096 2 / postgres 2085 postgres txt REG 8,17 10482400 7734049 /usr/lib/postgresql/16/bin/postgres postgres 2085 postgres DEL REG 0,1 3089 /dev/zero postgres 2085 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816 postgres 2085 postgres DEL REG 0,1 1 /SYSV000c4af1 postgres 2085 postgres 0r CHR 1,3 0t0 5 /dev/null postgres 2085 postgres 1w REG 8,17 1781 805648 /var/log/postgresql/postgresql-16-main.log postgres 2085 postgres 2w REG 8,17 1781 805648 /var/log/postgresql/postgresql-16-main.log postgres 2085 postgres 3u a_inode 0,15 0 1074 [signalfd] postgres 2085 postgres 4r FIFO 0,14 0t0 13515 pipe postgres 2085 postgres 5w FIFO 0,14 0t0 13515 pipe postgres 2085 postgres 6u IPv6 13521 0t0 TCP localhost:postgresql (LISTEN) postgres 2085 postgres 7u IPv4 13522 0t0 TCP localhost:postgresql (LISTEN) postgres 2085 postgres 8u unix 0x0000000000000000 0t0 13542 /var/run/postgresql/.s.PGSQL.5432 type=STREAM (LISTEN) postgres 2085 postgres 9u a_inode 0,15 0 1074 [eventpoll:3,6,7,8]
$ ipcs -m
—— Shared Memory Segments ——– key shmid owner perms bytes nattch status 0x000c4af1 1 postgres 600 56 6
$ ipcs -mp
—— Shared Memory Creator/Last-op PIDs ——– shmid owner cpid lpid 1 postgres 2085 20053
$ ipcs -m -i 1
Shared memory Segment shmid=1 uid=130 gid=142 cuid=130 cgid=142 mode=0600 access_perms=0600 bytes=56 lpid=20183 cpid=2085 nattch=6 att_time=Tue Jul 1 14:35:42 2025 det_time=Tue Jul 1 14:35:42 2025 change_time=Tue Jul 1 11:08:36 2025
$ lsof | egrep ‘shm|COMM’ COMMAND PID TID TASKCMD USER FD TYPE DEVICE SIZE/OFF NODE NAME postgres 2085 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816 postgres 2100 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816 postgres 2101 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816 postgres 2103 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816 postgres 2104 postgres mem REG 0,27 1048576 3 /dev/shm/PostgreSQL.2124806318 postgres 2104 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816 postgres 2105 postgres mem REG 0,27 1048576 3 /dev/shm/PostgreSQL.2124806318 postgres 2105 postgres mem REG 0,27 26976 2 /dev/shm/PostgreSQL.3070043816
$ ls -l /dev/shm/PostgreSQL.* -rw——- 1 postgres postgres 1048576 Jul 1 11:08 /dev/shm/PostgreSQL.2124806318 -rw——- 1 postgres postgres 26976 Jul 1 11:08 /dev/shm/PostgreSQL.3070043816
$ free -m total used free shared buff/cache available Mem: 15674 6488 3923 906 6654 9186 Swap: 0 0 0
$ mkdir postgresql
$ git clone git://git.postgresql.org/git/postgresql.git
$ git clone http://git.postgresql.org/git/postgresql.git
$ cd postgresql/
https://www.postgresql.org/docs/current/install-getsource.html
https://www.postgresql.org/ftp/source/v18.1/
https://www.postgresql.org/download/linux/
https://www.postgresql.org/docs/current/git.html
https://wiki.postgresql.org/wiki/Working_with_Git
$ cd postgresql
$ ./configure
$ make -j 4
$ su
$ make install
$ adduser postgres
$ mkdir -p /usr/local/pgsql/data
$ chown postgres /usr/local/pgsql/data
$ su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
$ /usr/local/pgsql/bin/createdb test
$ /usr/local/pgsql/bin/psql test
.tar.gz)This could be interesting in combination with myEnv.
$ cd postgresql
$ ./configure --prefix=/tmp/postgresql-19.dev-x86_64
$ make -j 4
$ make install
$ tar -C /tmp -czf /tmp/postgresql-19.dev-x86_64.tar.gz postgresql-19.dev-x86_64
$ cp /tmp/postgresql-19.dev-x86_64.tar.gz /download
.tar.gz)This could be interesting in combination with myEnv.
$ cd product
$ tar xf /download/postgresql-19.dev-x86_64.tar.gz
$ mkdir -p /home/mysql/database/postgres-19/data
$ cd /home/mysql/product/postgresql-19
$ ./bin/initdb --pgdata=/home/mysql/database/postgres-19/data
$ ./bin/pg_ctl --pgdata=/home/mysql/database/postgres-19/data --log=/home/mysql/database/postgres-19/log/error.log --options='-p 5432' start
$ ./bin/psql --host=/tmp --port=5432 postgres
$ ./bin/createdb --host=/tmp --port=5432 test
$ ./bin/psql --host=/tmp --port=5432 test
https://www.postgresql.org/docs/current/install-make.html#INSTALL-PROCEDURE-MAKE