PostgreSQL RPM 安装笔记
测试环境:REHL 5.3 1. 首先检查下是否已经有PostgreSQL安装程序(俺的机器有pg-libs 8.1,无视之) shell> rpm -qa | grep postgres 2. 下载最新的8.4.2RPM安装包,这个FTP速度挺快的。:) shell> wget http://ftp.easynet.be/postgresql/binary/v8.4.2/linux/rpms/redhat/rhel-5-x86_64/postgresql-server-8.4.2-1PGDG.rhel5.x86_64.rpm shell> wget http://ftp.easynet.be/postgresql/binary/v8.4.2/linux/rpms/redhat/rhel-5-x86_64/postgresql-contrib-8.4.2-1PGDG.rhel5.x86_64.rpm shell> wget http://ftp.easynet.be/postgresql/binary/v8.4.2/linux/rpms/redhat/rhel-5-x86_64/postgresql-libs-8.4.2-1PGDG.rhel5.x86_64.rpm shell> wget http://ftp.easynet.be/postgresql/binary/v8.4.2/linux/rpms/redhat/rhel-5-x86_64/postgresql-devel-8.4.2-1PGDG.rhel5.x86_64.rpm shell> wget http://ftp.easynet.be/postgresql/binary/v8.4.2/linux/rpms/redhat/rhel-5-x86_64/postgresql-8.4.2-1PGDG.rhel5.x86_64.rpm shell> wget http://ftp.easynet.be/postgresql/binary/v8.4.2/linux/rpms/redhat/rhel-5-x86_64/postgresql-plpython-8.4.2-1PGDG.rhel5.x86_64.rpm 3. 安装PostgreSQL(要注意下顺序),首先需要更新pg-libs版本。 shell> rpm -ivh postgresql-libs-8.4.2-1PGDG.rhel5.x86_64.rpm shell> rpm -ivh postgresql-8.4.2-1PGDG.rhel5.x86_64.rpm shell> rpm -ivh postgresql-server-8.4.2-1PGDG.rhel5.x86_64.rpm shell> rpm -ivh postgresql-contrib-8.4.2-1PGDG.rhel5.x86_64.rpm shell> rpm -ivh postgresql-devel-8.4.2-1PGDG.rhel5.x86_64.rpm shell> rpm -ivh postgresql-plpython-8.4.2-1PGDG.rhel5.x86_64.rpm 4. RPM安装完后,需要初始化PostgreSQL库。service初次启动会提示。 shell> service postgresql initdb 5. service启动PostgreSQL shell> service postgresql start 到上面这一步基本是安装完成了。下面的是修改数据库用户密码和登陆相关。 6. 切换到postgres用户,修改数据库密码。(注意系统用户和数据库用户密码是两个概念,虽然名字都叫postgres) shell> su - postgres shell> psql postgres=# ALTER USER postgres WITH PASSWORD '123456'; postgres=# /q 7. 修改认证文件/var/lib/pgsql/data/pg_hba.conf,登陆使用密码。md5格式。 shell> vi /var/lib/pgsql/data/pg_hba.conf 修改ident为md5 (local,host) 8. service重启PostgreSQL shell> service postgresql restart 9. 再次进入测试,应该会提示输入密码鸟 :) shell>psql -U postgres (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |