![]() You can also connect to Postgres using GUI tools such as PgAdmin, DBeaver, Azure Data Studio (using its PostgreSQL extension). When you connect using the postgres user, by default, you’re connected to the postgres database. Running that command should return something like this: You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".īy default, PostgreSQL creates a postgres user and a corresponding postgres database. You can now create databases, run queries, run psql commands, etc.įor example, you could run the following psql backslash command to get information about your current connection: \conninfo That means you’ve successfully connected to PostgreSQL with the psql utility. That command uses the postgres user to connect via the psql command-line utility.Īfter running that command, you should see something like this: psql (13.1 (Ubuntu 13.1-1.pgdg18.04+1)) You can connect to PostgreSQL by running the following command: sudo -u postgres psql That’s all there is to installing your local version of PostgreSQL on your Ubuntu 18.04 machine. If you prefer to install your local version of PostgreSQL, you can do so with the following command: sudo apt install postgresql postgresql-contrib How to Install the Local PostgreSQL Version (Option 2) The PostgreSQL Apt Repository integrates with your normal systems and patch management, and provides automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL. If you want to install a specific version, append postgresql with a hyphen, followed by the version number, like this: postgresql-13. The above command installs the latest version of PostgreSQL. You’ll see things like version, port, the data and log directories, etc Once it has been installed, the details of your PostgreSQL installation is displayed. The latest version of PostgreSQL is now installed on Ubuntu 18.04. ![]() Install PostgreSQL: sudo apt-get -y install postgresql ![]() Update the package lists: sudo apt-get update Import the repository signing key: wget -quiet -O - | sudo apt-key add. ![]() You can do that by following the steps below.Ĭreate the file repository configuration: sudo sh -c 'echo "deb $(lsb_release -cs)-pgdg main" > /etc/apt//pgdg.list' To install the latest version of PostgreSQL, use the PostgreSQL Apt Repository. So I’m going to go ahead and install the latest version. At the time of running this example, PostgreSQL 13 is available (Postgres 13.1 to be precise). Here, my local Ubuntu install has the Postgres version 10 package. Open up your Terminal and run the following command: apt show postgresql It doesn’t hurt to check your current Postgres version before you go installing anything. So one option is to go right ahead and use the version that’s already included with Ubuntu.īut unless you have reason not to, you will probably want to run the latest version of PostgreSQL, in which case you’ll want to download and install the latest version. There are a couple of ways to go about installing Postgres on Ubuntu.īut before we start jumping in and installing it, did you know that by default, PostgreSQL is already available in Ubuntu 18.04? The following steps demonstrate how to install PostgresSQL on Ubuntu 18.04.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |