linux安裝配置postgres及使用dblink
好久不寫東西,一直在看些開源的東西,下面貼下linux上安裝配置postgres及使用dblink的操作參考,以供讀者和自己今後參考:
1、下載原始碼:postgresql-9.3.2.tar.gz
2、建立postgres cluster組和使用者:
groupadd postgres
useradd postgres -d /home/postgres -g postgres
mkdir -p /usr/local/pgsql
mkdir -p /use/local/pgsql/data
chown -R postgres.postgres /usr/local/pgsql
passwd postgres
su -postgres
cd
vi bash_profile
export PGHOME=/usr/local/pgsql
export PGDATA=/usr/local/pgsql/data
export PATH=$PATH:/usr/local/pgsql/bin
. .bash_profile
3、將原始碼檔案傳至資料庫伺服器:
/usr/local/pgsql/postgresql-9.3.2.tar.gz
cd /usr/local/pgsql
tar zxf postgresql-9.3.2.tar.gz
4、配置及安裝資料庫:
cd /usr/local/plsql/postgresql-9.3.2
configure
或
configure --prefix=/usr/local/pgsql --with-perl --with-python
--注:
1)configure過程中,如報錯:configure:error:readline library not found,其實是readline-devel未被安裝,yum -y install readline-devel安裝即可。
2)configure過程中,如報錯:configure:error:zlib not installed,其實是zlib-delvel未被安裝,yum -y install zlib-delvel安裝即可。
3)configure過程中,如報錯:configure:error:header file is required,其實是pyhton-delvel未被安裝,yum -y install python-delvel安裝即可。
make
su -
make install
5、初始化資料庫:
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
6、配置引數檔案:
cd /usr/local/pgsql/data
vi postgresql.conf
--監聽和埠
7、配置登入安全規則:
vi pg_hba.conf
8、登入postgres並修改密碼:
psql postgres postgres
alter user postgres password 'test';
9、配置dblink:
cd /usr/local/pgsql/postgresql-9.3.2/contrib/dblink
make
su
make install
psql postgres postgres
create extension dblink;
select * from pg_extension;
10、建立和使用dblink
psql test test
select dblink_connect('test_dblink','dbname=postgres host=192.168.109.10 port=1921 user=postgres password=test');
select * from dblink('test_dblink','select c1,c3 from ttt') as t1 (c1 integer,c2 varchar);
select dblink_disconnect('test_dblink');
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8484829/viewspace-2118618/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Postgres-XL安裝與配置
- Linux環境Hive安裝配置及使用LinuxHive
- Linux環境Flume安裝配置及使用Linux
- Linux環境Spark安裝配置及使用LinuxSpark
- Linux環境Sqoop安裝配置及使用LinuxOOP
- Linux下安裝java及配置(yum安裝)LinuxJava
- linux安裝nginx及配置(一)LinuxNginx
- CentOS 7 安裝、配置、使用 PostgreSQL 10 安裝及基礎配置CentOSSQL
- postgres yum源安裝
- LINUX下JBOSS的安裝及配置Linux
- linux SVN安裝及配置圖解教程Linux圖解
- Linux的ftp安裝及使用LinuxFTP
- Docker的安裝配置及使用詳解Docker
- GRUB安裝,配置及使用匯總(轉)
- yii 安裝及配置
- mysql安裝及配置MySql
- nginx安裝及配置Nginx
- Greenplum安裝dblink模組
- Postgres-XC單機安裝
- git安裝及配置教程 windows windows上git的安裝和使用GitWindows
- Jenkins安裝及配置Jenkins
- Linux下安裝SVN 及 使用演示(PPT)Linux
- Kali Linux常用服務配置教程安裝及配置DHCP服務Linux
- sysbench工具手把手安裝配置及使用案例
- linux安裝配置kickstartLinux
- Linux安裝配置vncLinuxVNC
- Linux Nginx 安裝配置LinuxNginx
- SQL Server :DBLINK建立及使用SQLServer
- 【Linux】Linux軟體安裝管理2 使用安裝光碟配置本地yum倉庫Linux
- Linux環境下RPM方式JDK安裝及配置LinuxJDK
- SonarQube 安裝配置使用
- angular環境配置及安裝Angular
- scala安裝及環境配置
- GoLand安裝及環境配置GoLand
- Minix安裝及配置指南
- Mysql安裝及基礎配置MySql
- 【Hive一】Hive安裝及配置Hive
- eclipse安裝及配置pydevEclipsedev