If we don ' t already has PostgreSQL installed, we must install it.
$ sudo apt-get install PostgreSQL
This command installs the PostgreSQL server and various other packages.
$ sudo update-rc.d-f postgresql remove
removing any system startup links for/etc/init.d/postgresql ...
/etc/rc0.d/k21postgresql
/etc/rc1.d/k21postgresql
/etc/rc2.d/s19postgresql
/etc/rc3.d/s19postgresql
/etc/rc4.d/s19postgresql
/etc/rc5.d/s19postgresql
/etc/rc6.d/k21postgresql
If We install the PostgreSQL database from packages, it's automatically added to the start up scripts of the operating Sy Stem. If We are a learning to work with the database, it's unnecessary to start the database each time we boot the system. The above command removes any system startup links for the PostgreSQL database.
$/etc/init.d/postgresql Status
Running Clusters:9.1/main
$ service PostgreSQL status
Running Clusters:9.1/main
We Check if the PostgreSQL server is running. If not, we need to start the server.
$ sudo service PostgreSQL start
* Starting PostgreSQL 9.1 database server [OK]
On Ubuntu Linux We can start the server with the service PostgreSQL Start command.
$ sudo service PostgreSQL stop
* Stopping PostgreSQL 9.1 database server [OK]
We Use the service PostgreSQL Stop command to stop the PostgreSQL server.
$ sudo service PostgreSQL restart
Stopping postgresql-9.5 service: [OK]
Starting postgresql-9.5 service: [OK]
We Use the Service PostgreSQL Restart command to restart the PostgreSQL server.
PostgreSQL (Linux) Install, start, stop, restart