Getting Started
- 
2. Making DirectoriesFirst, Make Needed Directories. sudo mkdir -p /home/postgres/data Set postgres as Owner with: sudo chown -R postgres:postgres /home/postgres 
- 
3. Setting up postgres PassSet the postgres User Password sudo passwd postgres Give a Password to the postgres User Account. 
 If Got “User is Not in Sudoers file” then see: How to Enable sudo
- 
4. Logging inLogin as the postgres User su postgres Change to the Home Directory: cd 
- 
5. Setting up PATHAnd Setup User’s Path. echo "export PATH=$PATH:/usr/lib/postgresql/[REL]/bin" >> ~/.bashrc Replace [REL] with your Current one in the above Command. So in this case is 14. Load the New PATH with: bash 
- 
6. Making PostgreSQL DB ClusterThen Setup First, PostgreSQL DB Cluster 
 Simply run:initdb -D /home/postgres/data This just for testing pourposes… 
- 
7. Starting PostgreSQL ServerNext to Start PostgreSQL Server 
 Play:pg_ctl -D /home/postgres/data -l logfile start In case of Issue then Check the logfile with: cat logfile 
- 
8. Making PostgreSQL Test DBCreate a PostgreSQL test Database 
 Issue:createdb test 
- 
9. Accessing PostgreSQL DatabaseAccess PostgreSQL Database CLI 
 First, Set the postgres Database’s Password:psql template1 And then on the template1# Prompt: password postgres And Exit with: \q Then to Access test Database: psql test 
- 
10. Creating TableThen to Create a Table. CREATE TABLE account(/nuser_id serial PRIMARY KEY,/nusername VARCHAR (50) UNIQUE NOT NULL ); 
- 
11. Listing TablesNext to List Tables 
 With:\dt 
- 
12. Listing DatabasesAgain Listing Databases 
 Use:\l ‘q’ to Quit. 
 For More See PostgreSQL 14 Online Documentation
- 
13. Dropping Test DBFinally, to Delete test Database 
 Issue:dropdb test 
- 
14. Installing PostgreSQL Admin UIFor PostgreSQL 14 GUI Administration Install PgAdmin 4 PgAdmin4 on Linux Install
Contents
