当前位置:网站首页>Galaxy Kirin desktop operating system installation postgresql13 (source code installation)
Galaxy Kirin desktop operating system installation postgresql13 (source code installation)
2022-07-07 10:50:00 【Taylor lance】
1、 First download the source code postgres
wget http://ftp.postgresql.org/pub/source/v13.1/postgresql-13.1.tar.bz2
2、 decompression
tar xjvf postgresql-13.1.tar.bz2
3、 Enter folder
cd postgresql-13.1/
4、 Create installation path , Generally, we install it in /opt/ Under the folder
You have to use it here root Users to create
sudo su
mkdir -p /opt/pgsql-13.1
After creation, it must be root:root user : User group
5、 To configure
./configure --prefix=/opt/pgsql-13.1 --without-readline
6、 compile
make -j8
7、 install
make install
Next is the point :
We're going to create a linux user postgres, To start postgres service , As follows :
1、 establish postgres user
# Sign in root user
sudo su
# Add users
useradd postgres
# Add password
passwd postgres
2、 After the user is created, you can set just /opt/pgsql-13.1 User attribute of
# First, create a folder , As the data storage point of the database
sudo su
mkdir /opt/pgsql-13.1/data
chown -R postgres /opt/pgsql-13.1
3、 Set the environment variable
sudo su
vim /etc/profile
Add... After opening at the end
PATH=$PATH:/opt/pgsql-13.1/bin
export PATH
LD_LIBRARY_PATH=/opt/pgsql-13.1/lib
export LD_LIBRARY_PATH
export PGDATA=/opt/pgsql-13.1/data
4、 After adding source once
source /etc/profile
5、 Get into postgres
su - postgres
Be careful , At this time, there is only one command line $ Symbol , We just need to type bash After that, we can
bash
ls -l
postgres --version
initdb
pg_ctl start
psql -h 127.0.0.1
Login as follows
[email protected]-D2000:/opt/pgsql-13.1$ psql -h 127.0.0.1
psql (12.9 (Ubuntu 12.9-0kylin0.20.04.1k1), The server 13.1)
Warning :psql Main version 12, The main version of the server is 13.
some psql The function may not work properly .
Input "help" For help .
postgres=#
You can create database users and database 了 .
Create user
postgres=# create user username with password '****';
CREATE ROLE
postgres=#
Create database
postgres=# create database dbtest owner username; -- Create the database and specify the owner
CREATE DATABASE
postgres=#
Set the permissions of the database , All assigned to a user
postgres=# grant all on database dbtest to username; -- take dbtest All permissions are assigned to username
GRANT
postgres=#
After creation, you can exit
postgres=#\q
So much work ahead is mainly to prepare for the next , other linux User login database
psql -h 10.10.10.10 -U user -d postgres -p 5432
-h: database IP
-U: The logged in user
-d: Login database
-p: Login port
So you can be in Linux Use your usual Linux Log in to the database
[email protected]:~$ psql -U shenyan -d shenyan_f -h 127.0.0.1
psql (12.9 (Ubuntu 12.9-0kylin0.20.04.1k1), The server 13.1)
Warning :psql Main version 12, The main version of the server is 13.
some psql The function may not work properly .
Input "help" For help .
shenyan_f=>
Be careful :
It is worth noting that posgres The database service must be Linux postgres user , This is a postgres Database default , So you don't create this user ,postgres The service itself will also be created , After he created it, the password was randomly generated , We can't know , So I can't log in postgres, So let's create it manually .
If you feel troublesome, just adopt docker
[[email protected] ~]# docker pull postgres # Load image
[[email protected] ~]# docker run \
--name demo \
--privileged=true \
-e TZ='Asia/Shanghai' \
-e POSTGRES_USER=koji \
-e POSTGRES_DB=koji \
-e POSTGRES_PASSWORD=123456 \
-e PGDATA=/tmp/ \
-v /root/data:/tmp/ \
-p 5432:5432 \
-v /root/pem/psql-run:/docker-entrypoint-initdb.d \
-d \
postgres
Then you can log in to the database , After logging in, you can create your own database user and database .
Because we have mapped data, So as long as /root/data stay , Even if the database docker Deleted , After next startup , There are still data .
边栏推荐
- 无法打开内核设备“\\.\VMCIDev\VMX”: 操作成功完成。是否在安装 VMware Workstation 后重新引导? 模块“DevicePowerOn”启动失败。 未能启动虚拟机。
- ThreadLocal会用可不够
- Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
- 一些线上学术报告网站与机器学习视频
- 软考中级,软件设计师考试那些内容,考试大纲什么的?
- 宁愿把简单的问题说一百遍,也不把复杂的问题做一遍
- TypeScript 接口继承
- 2022.7.5DAY597
- seata 1.3.0 四种模式解决分布式事务(AT、TCC、SAGA、XA)
- Network engineer test questions and answers in May of the first half of 2022
猜你喜欢
MySQL insert data create trigger fill UUID field value
【安装系统】U盘安装系统教程,使用UltraISO制作U盘启动盘
The gun startles the dragon, and the crowd "locks" Zhou Zhi
简单易修改的弹框组件
使用U2-Net深层网络实现——证件照生成程序
China Southern Airlines pa3.1
香橙派OrangePi 4 LTS开发板通过Mini PCIE连接SATA硬盘的操作方法
What are the test preparation materials and methods for soft exam information processing technicians?
MONAI版本更新到 0.9 啦,看看有什么新功能
Cluster task scheduling system lsf/sge/slurm/pbs based on HPC scenario
随机推荐
ADB utility commands (network package, log, tuning related)
Schnuka: machine vision positioning technology machine vision positioning principle
Use of dotween
SQL Server 知识汇集9 : 修改数据
1321: [example 6.3] deletion problem (noip1994)
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
Use load_ decathlon_ Datalist (Monai) fast loading JSON data
I plan to take part in security work. How about information security engineers and how to prepare for the soft exam?
How to play video on unityui
Leetcode-303: region and retrieval - array immutable
ThreadLocal is not enough
Multithreaded asynchronous orchestration
What are the test preparation materials and methods for soft exam information processing technicians?
Multisim -- software related skills
Long list performance optimization scheme memo
About hzero resource error (groovy.lang.missingpropertyexception: no such property: weight for class)
Summary of router development knowledge
Deep understanding of Apache Hudi asynchronous indexing mechanism
ArrayList thread insecurity and Solutions
String formatting