Installing and configuring PostgreSQL
PostgreSQL is an open source relational database. It compares to Oracle or Microsoft SQL Server. PostgreSQL also has a plugin – postGIS – which allows spatial capabilities in PostgreSQL. In this book, it will be the relational database of choice. PostgreSQL can be installed on Linux as a package:
- For a Debian-based system, use
apt-get
, as shown:sudo apt-get install postgresql-11
- Once the packages have finished installing, you can start the database with the following:
sudo pg_ctlcluster 11 main start
- The default user,
postgres
, does not have a password. To add one, connect to the default database:sudo -u postgres psql
- Once connected, you can alter the user and assign a password:
ALTER USER postgres PASSWORD ‚postgres';
- To create a database, you can enter the following command:
sudo -u postgres createdb dataengineering
Using the command line is fast, but sometimes, a GUI makes life easier. PostgreSQL...