postgresqlHow can I set up and configure a PostgreSQL server?
- Install PostgreSQL using a package manager:
sudo apt-get install postgresql
- Create a database user:
sudo -u postgres createuser -s <username>
- Create a new database:
sudo -u postgres createdb <dbname>
- Configure authentication for the user:
sudo -u postgres psql
\password <username>
- Allow remote connections (optional):
Edit the file
/etc/postgresql/<version>/main/pg_hba.conf
and add the line:
host <dbname> <username> <IP address> md5
-
Edit the PostgreSQL configuration file
postgresql.conf
to allow remote connections: Change the linelisten_addresses = 'localhost'
tolisten_addresses = '*'
-
Restart the PostgreSQL service:
sudo service postgresql restart
Helpful links
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I use PostgreSQL with YAML?
- How can I retrieve data from PostgreSQL for yesterday's date?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I use PostgreSQL's "zero if null" feature?
- How do I install PostgreSQL and Zabbix on my system?
- How do I use PostgreSQL with Qt?
- How can I monitor PostgreSQL performance using Zabbix?
- How can I set a PostgreSQL interval to zero?
See more codes...