# postgreSQL **Repository Path**: wangqiyuejava63/postgre-sql ## Basic Information - **Project Name**: postgreSQL - **Description**: UNSW COMP9315 25T1 postgreSQL 数据库作业 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-15 - **Last Updated**: 2025-12-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # build and install postgreSQL from source code https://cgi.cse.unsw.edu.au/~cs9315/25T1/pracs/p01/ ## make clean `make distclean` `make clean` must clean all the rest of last make or it will mislead you!!! ## configure ```sh cd /home/$USER/postgre-sql/postgresql-15.11 ./configure --prefix=/home/$USER/pgsql ``` ## make `make` and you may encounter with some compile errors like this: > initdb.c:64:10: fatal error: catalog/pg_class_d.h: No such file or directory > 64 | #include "catalog/pg_class_d.h" /* pgrminclude ignore */ | ^~~~~~~~~~~~~~~~~~~~~~ > compilation terminated. these are because of hard links of files just `find -name pg_class_d.h` you will find there is an other pg_class_d.h in another directory that is the real file copy that file to the directory ## make install `make install` you may encounter with the above errors, just try to solve it as the above. after install you will find there is a `pgsql` directory at /home/$USER what's why we type `./configure --prefix=/home/$USER/pgsql` before. ## edit an env script ```sh # Set up environment for running PostgreSQL # Must be "source"d from a bash-compatible shell PGHOME=/home/$USER/pgsql export PGDATA=$PGHOME/data export PGHOST=$PGDATA export PGPORT=5432 export LD_LIBRARY_PATH=$PGHOME/lib export PATH=$PGHOME/bin:$PATH alias p0="$PGHOME/bin/pg_ctl stop" alias p1="$PGHOME/bin/pg_ctl -l $PGDATA/log start" ``` and `source env` it will set some environment variables ## test ```sh echo $PGDATA YOUR_PGDATA ... i.e. whatever value you set it to ... which initdb /$PGHOME/bin/initdb which pg_ctl /$PGHOME/bin/pg_ctl ``` ## todo other steps just refer to https://cgi.cse.unsw.edu.au/~cs9315/25T1/pracs/p01/