yum install postgresql-server # initialize database service postgresql initdb # comment out ident config sed -i 's,^host,#host,' /var/lib/pgsql/data/pg_hba.conf # configure access via md5 from 127.0.0.1 echo 'host all all 127.0.0.1/32 md5' >>/var/lib/pgsql/data/pg_hba.conf # start postgresql service postgresql start adduser -m chorn passwd chown su - postgres psql template1 CREATE USER chorn WITH PASSWORD 'chorn'; CREATE DATABASE chorn; GRANT ALL PRIVILEGES ON DATABASE chorn to chorn; \q # connect via network psql -h 127.0.0.1 -d chorn -U chorn # list databases \l # list tables \d # example filling yum -y install postgresql-docs less /usr/lib64/pgsql/tutorial/basics.sql
yum install postgresql-server # less /usr/share/doc/postgresql-9*/README.rpm-dist postgresql-setup initdb # comment out ident config sed -i 's,^host,#host,' /var/lib/pgsql/data/pg_hba.conf # configure access via md5 from 127.0.0.1 echo 'host all all 127.0.0.1/32 md5' >>/var/lib/pgsql/data/pg_hba.conf # start postgresql systemctl start postgresql adduser -m chorn passwd chorn su - postgres psql template1 CREATE USER chorn WITH PASSWORD 'chorn'; CREATE DATABASE chorn; GRANT ALL PRIVILEGES ON DATABASE chorn to chorn; \q # connect via network psql -h 127.0.0.1 -d chorn -U chorn # list databases \l # list tables \d # example filling yum -y install postgresql-docs less /usr/lib64/pgsql/tutorial/basics.sql
dnf install -y postgresql-contrib [root@Гага́рин ~]# su - postgres -bash-4.3$ psql template1 psql (9.5.6) Type "help" for help. template1=# CREATE DATABASE root; CREATE DATABASE template1=# GRANT ALL PRIVILEGES ON DATABASE root to root; GRANT template1=# \q -bash-4.3$ [root@Гага́рин ~]# pgbench -i NOTICE: table "pgbench_history" does not exist, skipping NOTICE: table "pgbench_tellers" does not exist, skipping NOTICE: table "pgbench_accounts" does not exist, skipping NOTICE: table "pgbench_branches" does not exist, skipping creating tables... 100000 of 100000 tuples (100%) done (elapsed 0.07 s, remaining 0.00 s) vacuum... set primary keys... done. [root@Гага́рин ~]# pgbench -i creating tables... 100000 of 100000 tuples (100%) done (elapsed 0.05 s, remaining 0.00 s) vacuum... set primary keys... done. [root@Гага́рин ~]# pgbench -c 4 -j 2 -T 600 -N root starting vacuum...end.