Linux-05安装Postgres
来源:互联网 发布:网络共享打不开 编辑:程序博客网 时间:2024/06/06 17:46
1 准备工作
系统:CentOS 5.7软件:postgressql-9.2.21-1-linux-x64.run
2 安装Postgresql
2.1 下载安装包地址:
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
2.2 上传软件至/var/lib上
[root@db1 lib]# ls alternatives dovecot mlocate random-seed stateless bluetooth games multipath rhsm tpm dav hal news rpm webalizer dbus iscsi nfs scrollkeeper yum dhclient logrotate.status php sepolgen dhcpv6 misc postgresql-9.2.21-1-linux-x64.run spamassassin
2.3 授予该安装文件有执行权限
[root@db1 lib]# chmod 755 postgresql-9.2.21-1-linux-x64.run
2.4 安装数据库
2.4.1 执行安装程序
[root@db1 lib]# ./postgresql-9.2.21-1-linux-x64.run
2.4.2 设置数据库安装目录
Please specify the directory where PostgreSQL will be installed. Installation Directory [/var/lib/pgd]: /var/lib/pgsql/
2.4.3 设置数据库保存路径
Please select a directory under which to store your data. Data Directory [/var/lib/pgsql/data]: /var/lib/pgsql/9.2/data
2.4.4 设置postgres账户密码
记住,之后需要使用
2.4.5 设置数据库的编码格式
选择zh_CN.utf8
2.4.6 验证
执行命令ps -e | grep postgres,查看进程是否存在。 [root@db1 lib]# ps -e | grep postgres 5014 ? 00:00:00 postgres 5019 ? 00:00:00 postgres 5021 ? 00:00:00 postgres 5022 ? 00:00:00 postgres 5023 ? 00:00:00 postgres 5024 ? 00:00:00 postgres 5025 ? 00:00:00 postgres 执行命令lsof -i:5432,查看数据库端口是否启用。 [root@db1 lib]# lsof -i :5432 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME postgres 5014 postgres 6u IPv4 37355 TCP *:postgres (LISTEN)
2.4.7 初始化数据库
使用postges用户进行初始化,但是报权限不够 bash-3.2$ ./initdb -D /var/lib/data/ 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 "zh_CN.UTF-8". The default database encoding has accordingly been set to "UTF8". initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8" The default text search configuration will be set to "simple". creating directory /var/lib/data ... initdb: could not create directory "/var/lib/data": 权限不够 将/var/lib/pgsql的拥有者该为postgres,再执行 [root@db1 lib]# chown postgres /var/lib/pgsql/ bash-3.2$ pwd /var/lib/pgsql/bin bash-3.2$ ./initdb -D /var/lib/pgsql/data/ 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 "zh_CN.UTF-8". The default database encoding has accordingly been set to "UTF8". initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8" The default text search configuration will be set to "simple". creating directory /var/lib/pgsql/data ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 32MB creating configuration files ... ok creating template1 database in /var/lib/pgsql/data/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... 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. Success. You can now start the database server using: ./postgres -D /var/lib/pgsql/data or ./pg_ctl -D /var/lib/pgsql/data -l logfile start
2.4.8 进入数据库
bash-3.2$ ./psql Password: psql.bin (9.2.21) Type "help" for help. No entry for terminal type "xterm"; using dumb terminal settings. postgres=#
2.4.9 增加环境变量
export PGHOME=/var/lib/pgsql/9.2 export PGDATA=$PGHOME/data PATH=$PATH:$HOME/bin:$PGHOME/bin
阅读全文
0 0
- Linux-05安装Postgres
- Postgres Linux下安装
- Linux 下安装postgres 安装教程
- 在LINUX下安装postgres数据库
- linux 安装python的postgres库
- linux安装配置postgres及使用dblink
- Linux下安装PPAS(Postgres Plus Advanced Server)
- 在linux (CentOs7)上安装Postgres-xc
- Postgres数据库安装
- 源码安装postgres
- postgres-9.3 beta2安装
- postgres-x2 编译安装
- postgres简易安装
- postgres 编译配置安装
- Postgres 10.1 安装步骤
- Postgres + Postgis Windows安装
- linux进入postgres
- debian下安装Postgres数据库
- 解决java compiler level does not match the version of the installed java project facet
- POJ2112: Optimal Milking 题解
- 异常检测的方法整理
- 【项目管理和构建】十分钟教程,eclipse配置maven + 创建maven项目(三)
- poj3461 Oulipo(KMP)
- Linux-05安装Postgres
- JSON 和 XML优缺点的比较
- LeetCode Weekly Contest 42解题思路
- 经典二叉树面试题
- POJ 3281 Dining (最大流)
- Android入门学习笔记整理(四)
- STL中的map容器的一点总结
- Hinton Neural Networks课程笔记2a:三种主要的神经网络框架之前向网络、循环神经网络和对称网络
- hide handkerchief HDU