PostgreSQL - Set Up
- apt-get install posgresql
- passwd postgres
- sudo -i -u postgres
- mkdir data
- initdb -D /var/lib/postgresql/data
- postgres -D /var/lib/postgresql/data
nano /var/lib/postgresql/data/pg_hba.conf
- host all all 0.0.0.0/0 trust
nano /var/lib/postgresql/data/postgresql.conf
- listen_addresses='*'
- pg_ctl -D /var/lib/postgresql/data start
- \list or \l: list all databases
- \dt: list all tables in the current database
- ctrl+d to exit
- locale -a
createdb db1 --encoding='utf-8' --locale=C.UTF-8
--template=template0;
- psql
- CREATE USER dan WITH PASSWORD 'passwordhere';
- GRANT ALL PRIVILEGES ON DATABASE db1 TO dan;
- CREATE SCHEMA scoreboard;
- GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA scoreboard TO dan;
- ctrl+d
- sudo apt-get install phpmyadmin apache2-utils
- https://company_name_here.com:12321/
- In Webmin, Servers -> Apache Webserver
Set port 12322 for access. Alternatively, dan.wiki/phppgadmin per
the below.
- cd /usr/share/mediawiki
- ln -s /usr/share/phppgadmin phppgadmin
<!-- -->
- To stop:
- pg_ctl -D /var/lib/postgresql/9.1/main stop
- To start:
- pg_ctl -D /var/lib/postgresql/data start
- Ctrl+c when you see Autovacuum started
- Possibly to just use:
- postgres -D /var/lib/postgresql/data
This post is licensed under CC BY 4.0 by the author.