postgresql-9.2 install
[root@weblogic opt]# groupadd postgresql
[root@weblogic opt]# useradd -g postgresql postgres
[root@weblogic opt]# passwd postgres
[root@weblogic opt]# chmod +x postgresql-9.2.19-1-linux-x64.run
[root@weblogic opt]# ll postgresql-9.2.19-1-linux-x64.run
-rwxr-xr-x 1 root root 39523652 Sep 6 01:12 postgresql-9.2.19-1-linux-x64.run
安装
[root@weblogic opt]# ./postgresql-9.2.19-1-linux-x64.run
next---next
配置环境变量
/etc/profile
export LD_LIBRARY_PATH=/opt/PostgreSQL/9.2/lib:$LD_LIBRARY_PATH
export PATH=/opt/PostgreSQL/9.2/bin:$PATH
export PGDATA=/opt/PostgreSQL/9.2/data
source /etc/profile
su - postgres
cd /opt/PostgreSQL/9.2/bin
初始化数据库
[postgres@weblogic bin]$ ./initdb -D /opt/PostgreSQL/9.2/data
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
initdb: invalid locale name ""
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
fixing permissions on existing directory /opt/PostgreSQL/9.2/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /opt/PostgreSQL/9.2/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... locale: Cannot set LC_MESSAGES to default locale: No such file or directory
ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /opt/PostgreSQL/9.2/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... locale: Cannot set LC_MESSAGES to default locale: No such file or directory
ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
./postgres -D /opt/PostgreSQL/9.2/data
or
./pg_ctl -D /opt/PostgreSQL/9.2/data -l logfile start
or
./pg_ctl -D /opt/PostgreSQL/9.2/data -l logfile start
[postgres@weblogic bin]$
启动PG
[postgres@weblogic bin]$ ./postgres -i -D /opt/PostgreSQL/9.2/data &
[1] 18363
[postgres@weblogic bin]$ LOG: database system was shut down at 2019-09-06 01:59:02 PDT
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
[1] 18363
[postgres@weblogic bin]$ LOG: database system was shut down at 2019-09-06 01:59:02 PDT
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
[postgres@weblogic bin]$ lsof -i:5432
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 18363 postgres 3u IPv4 439718 0t0 TCP *:postgres (LISTEN)
postgres 18363 postgres 4u IPv6 439719 0t0 TCP *:postgres (LISTEN)
[postgres@weblogic bin]$
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 18363 postgres 3u IPv4 439718 0t0 TCP *:postgres (LISTEN)
postgres 18363 postgres 4u IPv6 439719 0t0 TCP *:postgres (LISTEN)
[postgres@weblogic bin]$
登录PG
[postgres@weblogic bin]$ psql
psql.bin (9.2.19)
Type "help" for help.
psql.bin (9.2.19)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}
postgres=#
PG 版本查看:
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------------
PostgreSQL 9.2.19 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55), 64-bit
(1 row)
version
----------------------------------------------------------------------------------------------------------------
PostgreSQL 9.2.19 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55), 64-bit
(1 row)
postgres=#
分类:
pg
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端