2.5 Linux (Ubuntu18.04) install database PostgreSQL

2.5 Linux (Ubuntu18.04) install database PostgreSQL

"卜算子·大数据" is an open source and systematic big data learning tutorial. ——Updated every Sunday

Main content of this section:

2.5.1 Create Database server Ubuntu18.04server

For detailed steps to create a server, see Chapter 2 Linux. The key steps are as follows.

2.5.1 Install PostgreSQL

 sudo vim /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main

< div class="se-preview-section-delimiter"></div>
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install postgresql-10

2.5.3 Log in to Postgresql, change password, create new user, new database##

Log in to Postgresql

sudo -u postgres psql postgres

change Password

ALTER ROLE postgres PASSWORD 'wxl1234';

Create new user, new database

ALTER ROLE postgres PASSWORD 'wxl1234';

Create new user, new database

CREATE ROLE busuanzi WITH PASSWORD 'wxl123' LOGIN ;
CREATE DATABASE busuanzidb OWNER 'busuanzi';

drop out

2.5.4 Allow remote login##

Modify postgresql.conf

2.5.4 Allow remote login##

Modify postgresql.conf

sudo vim /etc/postgresql/10/main/postgresql.conf

The revised content is as follows

listen_addresses ='*'

Modify pg_hba.conf

sudo vim /etc/postgresql/10/main/pg_hba.conf

The revised content is as follows

local   all             postgres                                md5

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# " local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
host    all             all             192.168.56.0/0          md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

Restart postgresql service

sudo service postgresql restart

2.5.5 After postgres is installed and configured, you can use the client to connect to the database.

Recommended Posts

2.5 Linux (Ubuntu18.04) install database PostgreSQL
Install postgresql-10 on Ubuntu 18.04
CentOS (linux) install PostgreSQL
Windows 10 install Linux subsystem Ubuntu
Linux (ubuntu 12.04)
How to install PostgreSQL on Ubuntu 16.04
​Install Oracle database on CentOS Linux
How to install PostgreSQL on Ubuntu 20.04
ubuntu18.04 install python2
ubuntu18.04 install docker
ubuntu12.04 install python3
Ubuntu install guide
Install linux (ubuntu) dual system under windows system
ubuntu install nodejs
ubuntu 16 install asp.net
How to install MySQL on Ubuntu 18.04 (linux)
ubuntu install leanote
ubuntu install Jenkins
Linux01 install centOS6.5mini
docker install ubuntu
ubuntu install elasticsearch
Windows 10 subsystem linux install pagoda panel Ubuntu
CentOS install PostgreSQL 9.1
Centos 7 install PostgreSQL
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
Linux install Docker and run Ubuntu system
ubuntu 18.04 install teamviewer
ubuntu install sendmail
How to install vim editor under Linux (Ubuntu 18.04)
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
Install and use Git and GitHub on Ubuntu Linux
Detailed steps to install Anaconda on Linux (Ubuntu 18.04)
Win10 install Linux ubuntu-18.04 dual system (installation guide)
How to install and use PostgreSQL on Ubuntu 16.04
How to install Oracle Java 14 on Ubuntu Linux
Install apache+PHP under Ubuntu
install vscode on ubuntu18
Install node.js under Ubuntu
Install mysql-pytho in Ubuntu
ubuntu install zsh terminal
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install python3.6 under Ubuntu 16.04
Install docker on Ubuntu
Ubuntu18.04 install opencv 3.2.0 solution
Install mysql under Ubuntu 16.04
Install Caffe under Ubuntu 14.04
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
Install PostgreSQL12 under CentOS7
ubuntu install harbor warehouse
linux install snmp service-ubuntu
Install mysql on Ubuntu 14.04
Ubuntu16.04 install Mongodb tutorial
Install Django on ubuntu
Linux Centos7 install jdk1.8
Install Pytorch+CUDA on Ubuntu 16.04
2018-09-11 Install arduino under Ubuntu
Install Python3 on Ubuntu 14.04