configure readline error 安装
在centos里安装postgres
./configure --with-libraries=/usr/local/lib --with-includes=/usr/local/include
.....
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure.? It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.
?
要安装 readline , readline-dev 开发包,要么使用 --without-readline 选项关闭 readline 功能。
?
yum install readline;
yum install readline-dev;
readline 也就是命令行编辑,关闭的话,你直接用psql 就不能编辑命令行,如果输错指令,不能回滚命令历史记录,只能手工重新输入。
?
./configure --with-libraries=/usr/local/lib --with-includes=/usr/local/include
.....
configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure.? It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.
?
解决方法
yum install zlib-devel;
?
make
make install
chown -R postgres.postgres /usr/local/pgsql
vi /etc/passwd 更改postgres的home 为/usr/local/pgsql
?
su -postgres
mkdir data
export PATH=$PATH:$HOME/bin
export PGDATA=$PATH:$HOME/data
initdb? 初始化数据库
postgres -D /usr/local/pgsql/data 或者pg_ctl -D /usr/local/pgsql/data -l logfile start 启动数据库
启动后,可以用pg_ctl stop/start 进行控制
?
/usr/local/pgsql/data/postgresql.conf 可以更改listener和port,
pg_hda.conf 更改允许连接的机器
?
建立数据库
$createdb mydb
PostgreSQL 会返回 “ CREATED DATABASE”的信息,表明数据库建立完成。
$psql mydb
进入交互 psql 工具,建立表:
CREATE TABLE mytable (
id varchar(20),
name varchar(30));
建立完成后,会得到一条 “CREATED” 的信息,表示建立成功。现在插入一条数据:
INSERT INTO mytable values('1', 'abc');
psql 返回 INSERT 18732 1,查询插入是否成功:
SELECT * FROM MYTABLE;
退出 psql ,用 \q 命令。
?