Project

General

Profile

Support #553

Updated by Daniel Curtis about 9 years ago

This is a simple guide for setting up a standalone PostgreSQL database server on Debian. 

 * Use sudo to get a root shell 
 <pre> 
 sudo -s 
 </pre> 

 * Update the system: 
 <pre> 
 apt-get update && sudo apt-get upgrade 
 </pre> 

 h1. Install PostgreSQL 

 * Install PostgreSQL 
 <pre> 
 apt-get install postgresql postgresql-client 
 </pre> 

 h2. Create a database and user 

 * Create a regular system user account using adduser (skip this step to use an existing account): 
 <pre> 
 adduser somepguser 
 </pre> 

 * Connect to the default database: 
 <pre> 
 su - postgres 
 psql 
 </pre> 
 #* Set a password for the postgres user: 
 <pre> 
 \password postgres 
 </pre> 
 #* The postgres admin console will show @postgres=#@, create a new database user and a database: 
 <pre> 
 CREATE USER somepguser WITH PASSWORD 'somepguserpass'; 
 CREATE DATABASE somepgdatabase OWNER somepguser; 
 </pre> 
 #* Quit from the database 
 <pre> 
 \q 
 </pre> 

 * Exit from the postgres user 
 <pre> 
 exit 
 </pre> 

 * Connect as somepguser to the new database: 
 <pre> 
 su - somepguser 
 psql somepgdatabase 
 </pre> 

 h2. Resources 

 * https://wiki.debian.org/PostgreSql 

Back