当前位置:网站首页>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 .
边栏推荐
- leetcode-560:和为 K 的子数组
- How to successfully pass the senior system architecture designer in the second half of the year?
- IO model review
- 2021 summary and 2022 outlook
- 使用 load_decathlon_datalist (MONAI)快速加载JSON数据
- Opencv installation and environment configuration - vs2017
- 想考中级软考,一般需要多少复习时间?
- 深入理解Apache Hudi异步索引机制
- 路由器开发知识汇总
- 施努卡:机器视觉定位技术 机器视觉定位原理
猜你喜欢
![[recommendation system 01] rechub](/img/92/c14c867247d3a042c69b5ed0091fbe.png)
[recommendation system 01] rechub

2021 summary and 2022 outlook

使用 load_decathlon_datalist (MONAI)快速加载JSON数据

openinstall与虎扑达成合作,挖掘体育文化产业数据价值

使用U2-Net深层网络实现——证件照生成程序

优雅的 Controller 层代码

Mendeley -- a free document management tool that automatically inserts references into papers

CSAPP bomb lab parsing
![[daiy5] jz77 print binary tree in zigzag order](/img/ba/b2dfbf121798757c7b9fba4811221b.png)
[daiy5] jz77 print binary tree in zigzag order

Opencv installation and environment configuration - vs2017
随机推荐
[OneNote] can't connect to the network and can't sync the problem
Records on the use of easyflash v3.3
书签整理-程序员常用网站导航
Using tansformer to segment three-dimensional abdominal multiple organs -- actual battle of unetr
【PyTorch 07】 动手学深度学习——chapter_preliminaries/ndarray 习题动手版
【STM32】实战3.1—用STM32与TB6600驱动器驱动42步进电机(一)
[detailed explanation of Huawei machine test] tall and short people queue up
How embedded engineers improve work efficiency
leetcode-303:区域和检索 - 数组不可变
打算参加安全方面工作,信息安全工程师怎么样,软考考试需要怎么准备?
[actual combat] transformer architecture of the major medical segmentation challenges on the list --nnformer
【推薦系統 01】Rechub
“梦想杯”2017 年江苏省信息与未来小学生夏令营 IT 小能手 PK 之程序设计试题
[homework] 2022.7.6 write your own cal function
单调性约束与反单调性约束的区别 monotonicity and anti-monotonicity constraint
Monai version has been updated to 0.9. See what new functions it has
2022.7.5DAY597
Multithreaded asynchronous orchestration
使用 load_decathlon_datalist (MONAI)快速加载JSON数据
[daiy5] jz77 print binary tree in zigzag order