Type \q or Press Ctrl + D to exit from the psql interactive terminal. Log in to the psql interactive terminal using the psql command: psql With sudo, When prompted for the password, you should type the sudo password of the current user. Therefore, you need to execute the su postgres command as root (or with sudo). The postgres user does not have a password. First, we must switch to the postgres user: sudo su - postgres We can connect to the Ubuntu PostgreSQL Server using this user. When the PostgreSQL server is installed, a new Linux user and a database user, called postgres is created. To check the installation, you can run the systemctl command, as follows: sudo systemctl status rvice You have now successfully installed PostgreSQL on Ubuntu Linux. To set up the Postgres apt repository on Ubuntu, execute the following commands in the terminal: sudo sh -c 'echo "deb $(lsb_release -cs)-pgdg main" > /etc/apt//pgdg.list'Īfter that, install PostgreSQL with the following command: sudo apt-get -y install postgresql To Install the Latest Version, We Must First Set Up the Postgres Repository However, it is recommended that you install the latest stable version, that is, PostgreSQL 13. And you can install it by running the apt-get install postgresql command. After installing the latest version of PostgreSQL, we will also learn how to connect to the database server using the psql command-line client.īefore we begin, First, you must decide what version of PostgreSQL to install.Īs for Ubuntu 20.04 LTS, PostgreSQL 12 is available in the Ubuntu default software repository. In this tutorial, we will learn how to install PostgreSQL on Ubuntu Server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |