postgresql.kurulum 962 B

12345678910111213141516171819202122232425
  1. install -v -dm700 /srv/pgsql/data &&
  2. install -v -dm755 /run/postgresql &&
  3. groupadd -g 41 postgres &&
  4. useradd -c "PostgreSQL Server" -g postgres -d /srv/pgsql/data \
  5. -u 41 postgres &&
  6. chown -Rv postgres:postgres /srv/pgsql /run/postgresql
  7. su - postgres -c '/usr/bin/initdb -D /srv/pgsql/data'
  8. su - postgres -c '/usr/bin/postgres -D /srv/pgsql/data > \
  9. /srv/pgsql/data/logfile 2>&1 &'
  10. su - postgres -c '/usr/bin/createdb test' &&
  11. echo "create table t1 ( name varchar(20), state_province varchar(20) );" \
  12. | (su - postgres -c '/usr/bin/psql test ') &&
  13. echo "insert into t1 values ('Billy', 'NewYork');" \
  14. | (su - postgres -c '/usr/bin/psql test ') &&
  15. echo "insert into t1 values ('Evanidus', 'Quebec');" \
  16. | (su - postgres -c '/usr/bin/psql test ') &&
  17. echo "insert into t1 values ('Jesse', 'Ontario');" \
  18. | (su - postgres -c '/usr/bin/psql test ') &&
  19. echo "select * from t1;" | (su - postgres -c '/usr/bin/psql test')