Linux Postgresql安装

1、选择系统对应的版本

https://www.postgresql.org/download/linux/redhat/

image.png

添加RPM

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

安装PostgreSQL 9.5

yum install postgresql96-server postgresql96-contrib

初始化数据库

/usr/pgsql-9.6/bin/postgresql96-setup initdb

开机自启动

systemctl enable postgresql-9.6

启动数据库

systemctl start postgresql-9.6

创建用户

#添加用户和数据库
sudo -u postgres psql 

#-- set up the users and the passwords
#-- (note that it is important to use single quotes and a semicolon at the end!)
create role chirpstack_as with login password 'dbpassword';
create role chirpstack_ns with login password 'dbpassword';

#-- create the database for the servers
create database chirpstack_as with owner chirpstack_as;
create database chirpstack_ns with owner chirpstack_ns;

#-- change to the ChirpStack Application Server database
\c chirpstack_as

#-- enable the pq_trgm and hstore extensions
#-- (this is needed to facilitate the search feature)
create extension pg_trgm;
#-- (this is needed to store additional k/v meta-data)
create extension hstore;

#-- exit psql
\q
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容