亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 4551 | 回復(fù): 5
打印 上一主題 下一主題

通過(guò)PostgreSQL的源代碼安裝數(shù)據(jù)庫(kù) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2010-11-10 11:06 |只看該作者 |倒序?yàn)g覽
準(zhǔn)備步驟:

操作系統(tǒng)-Ubuntu10.04

第一步:下載源碼
到官網(wǎng)www.postgresql.org去下載8.4.4版本的源碼,我的下載地址是 ftp://ftp2.cn.postgresql.org/pos ... gresql-8.4.4.tar.gz
我的保存路徑為:/home/jiwan/postgresql/postgresql-tar/postgresql-8.4.4.tar.gz
你可以存放到任意想存放的地方。

第二步:解壓源碼
cd /home/jiwan/postgresql
tar -xvf postgresql-tar/postgresql-8.4.4.tar.gz
mv postgresql-8.4.4 postgresql-source
處理后的文件目錄截圖:

                     
解釋一下:
postgresql-8.4.4.tar.gz中有個(gè)叫postgresql-8.4.4的文件夾;
第二行會(huì)postgresql-8.4.4.tar中的postgresql-8.4.4文件夾解壓到/home/jiwan/postgresql/目 錄下面;
第三行將postgresql-8.4.4文件夾改名為postgresql-source。

第三步:配置
cd /home/jiwan/postgresql/postgresql-source
sudo ./configure –prefix=/home/jiwan/postgresql/postgresql-bin
執(zhí)行成功的情況下,系統(tǒng)會(huì)有如下輸出:
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
…這里省略N行輸出信息…
config.status: linking ./src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking ./src/makefiles/Makefile.linux to src/Makefile.port

很不幸,一般情況下都不會(huì)成功執(zhí)行, 因?yàn)閏onfigure執(zhí)行的時(shí)候會(huì)檢查依賴的庫(kù)文件是否存在。有錯(cuò)誤的系統(tǒng)輸出是:
./configure –prefix=/home/jiwan/postgresql/postgresql-bin
checking build system type… i686-pc-linux-gnu
…這里省略N行輸出信息…
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.
事實(shí)是,一個(gè)干凈的Ubuntu10.04還需要安裝下列庫(kù):
libreadline5-dev: 產(chǎn)生error(readline library not found)
zlib1g-dev: 產(chǎn)生error(readline library not found)
bison: 產(chǎn)生warning,可選,用于cvs支持等等
flex: 產(chǎn)生warning,可選,用于cvs支持等等
解決方法是:安裝之前執(zhí)行如下命令(也可以逐個(gè)安裝以上四個(gè) 庫(kù))
sudo apt-get install libreadline5-dev zlib1g-dev bison flex
其實(shí)這條命令還會(huì)自動(dòng)安裝libncurses5-dev, libreadline5和m4三個(gè)庫(kù)

解釋一下:
./configure是一個(gè)批處理文件,它會(huì)檢查編譯安裝需要的各種文件并配置各個(gè)參數(shù)。
通過(guò)–prefix指定數(shù)據(jù)庫(kù)系統(tǒng)的安裝位置:后面的安裝步驟會(huì)把運(yùn)行數(shù)據(jù)庫(kù)系統(tǒng)需要的文件(二進(jìn)制,配置文件等等)拷貝到/home/jiwan/postgresql/postgresql-bin目 錄下面。
可以用./configure –help來(lái)查看可用的參數(shù)。
configure執(zhí)行之后的屏幕輸出有三種:
以cheking開頭的輸出:庫(kù)依賴的結(jié)果;
以configure開頭的輸出:修改了配置選項(xiàng)
以config.status開頭的輸出:產(chǎn)生的配置文件;
如果安裝了bison和flex,執(zhí)行configure批處理文件之后,下一步編譯的時(shí)候,就會(huì)使編譯好后的數(shù)據(jù)庫(kù)系統(tǒng)支持bison和flex。

第四步:編譯并安裝
cd /home/jiwan/postgresql/postgresql-source
make
make install
解釋一下:
這一步的目的是:把源碼編譯成可執(zhí)行文件和共享庫(kù)文件,并復(fù)制到指定的”/home/jiwan/postgresql/postgresql-bin” 目錄下面。值得注意的是,這樣做以后數(shù)據(jù)庫(kù)系統(tǒng)還需要一些初始化的操作才可以使用。
make會(huì)默認(rèn)調(diào)用Makefile文件,然后把源碼全部編譯;
make install會(huì)把PostgreSQL數(shù)據(jù)庫(kù)安裝到”/home/jiwan/postgresql /postgresql-bin”目錄下面(這個(gè)目錄是上一步中設(shè)置的),成功的標(biāo)志就是:”/home/jiwan/postgresql /postgresql-bin”目錄下面會(huì)有四個(gè)文件夾:
bin: 存放可執(zhí)行文件
include: 存放源代碼的頭文件
lib: 存放共享庫(kù)文件
share: 存放數(shù)據(jù)庫(kù)系統(tǒng)的公共配置,文檔等等

第五步:創(chuàng)建linux帳號(hào)”postgres”并設(shè)置密碼為”postgres”
sudo adduser postgres

第六步:創(chuàng)建數(shù)據(jù)庫(kù)初始化需要的文件夾并更改所有者
cd /home/jiwan/postgresql/postgresql-bin
mkdir data
sudo chown -R postgres /home/jiwan/postgresql/postgresql-bin

第七步:初始化數(shù)據(jù)庫(kù)
su – postgres
cd /home/jiwan/postgresql/postgresql-bin
bin/initdb -D data
最后一行命令的屏幕輸出是:
The files belonging to this database system will be owned by user “postgres”.
…這里省略N行輸出信息…
Success. You can now start the database server using:
bin/postgres -D data
or
bin/pg_ctl -D data -l logfile start

解釋一下:
這一步創(chuàng)建了數(shù)據(jù)庫(kù)運(yùn)行所需的數(shù)據(jù)文件和配置文件

第八步:?jiǎn)?dòng)數(shù)據(jù)庫(kù)服務(wù)
su – postgres
cd /home/jiwan/postgresql/postgresql-bin
bin/postmaster -D data>logfile 2>&1 &
數(shù)據(jù)庫(kù)成功啟動(dòng)服務(wù)之后,默認(rèn)會(huì)在本機(jī)地址127.0.0.1的5432端口偵聽(tīng)連接請(qǐng)求,通過(guò)顯示本機(jī)正在偵聽(tīng)的進(jìn)程可以檢查數(shù)據(jù)庫(kù)服務(wù)是否成功運(yùn)行:
su root -c “netstat -lnpt|grep post”
應(yīng)該輸出如下結(jié)果(postmaster是指向postgres程序的一個(gè)鏈接):
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 21288/postmaster
tcp6 0 0 ::1:5432 :::* LISTEN 21288/postmaster

第九步:創(chuàng)建數(shù)據(jù)庫(kù)
su – postgres
/home/jiwan/postgresql/postgresql-bin/bin/createdb jiwan

第十步:連接數(shù)據(jù)庫(kù)
su – postgres
/home/jiwan/postgresql/postgresql-bin/bin/psql
這條命令會(huì)自動(dòng)以postgres命令連接到postgres數(shù)據(jù)庫(kù),連接后系統(tǒng)的輸出為:
———————————
psql (8.4.4)
Type “help” for help.
postgres=#
———————————
可以在提示符”postgres=#”后面輸入”\l”檢查之前創(chuàng)建的數(shù)據(jù)庫(kù)”jiwan”是否存在,存在的標(biāo)志就是,執(zhí)行之后屏幕輸出包含以下一行:
jiwan | postgres | UTF8 | zh_CN.UTF-8 | zh_CN.UTF-8 |

第十一步:修改配置文件,使得其他主機(jī)可以訪問(wèn)數(shù)據(jù)庫(kù)
需要修改的文件在”/home/jiwan/postgresql/postgresql-bin/data”目錄之下,文件為:
postgresql.conf
pg_hba.conf.

論壇徽章:
59
2015七夕節(jié)徽章
日期:2015-08-24 11:17:25ChinaUnix專家徽章
日期:2015-07-20 09:19:30每周論壇發(fā)貼之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38榮譽(yù)版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年紀(jì)念徽章
日期:2015-07-20 11:05:27IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-07-20 11:05:34操作系統(tǒng)版塊每日發(fā)帖之星
日期:2015-07-20 11:05:36程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-07-20 11:05:40數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-07-20 11:05:432015年辭舊歲徽章
日期:2015-07-20 11:05:44
2 [報(bào)告]
發(fā)表于 2010-11-10 12:12 |只看該作者
原來(lái)以為PG安裝很難。后來(lái)做項(xiàng)目的時(shí)候用到安裝了一下。也不是太難的。

論壇徽章:
4
丑牛
日期:2014-09-15 09:28:12雙子座
日期:2014-12-19 17:01:192015年辭舊歲徽章
日期:2015-03-03 16:54:15數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2016-06-28 06:20:00
3 [報(bào)告]
發(fā)表于 2010-11-16 15:59 |只看該作者
相比,ORACLE數(shù)據(jù)庫(kù),postgresql安裝,建庫(kù)是相當(dāng)簡(jiǎn)單的
Oracle dbca建個(gè)庫(kù)差不多快1小時(shí)了,postgresql 建庫(kù)簡(jiǎn)潔的只需要一個(gè) create database ....命令,1分鐘都不需要。

論壇徽章:
1
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-06-20 22:20:00
4 [報(bào)告]
發(fā)表于 2010-11-17 15:57 |只看該作者
可以把樓主的安裝過(guò)程寫個(gè)shell,比如pginstall.sh,源碼解開后,把它復(fù)制到postgresql-8.4.4目錄里,然后./pginstall.sh, 全自動(dòng),多省事啊。

喝點(diǎn)水吧,休息一會(huì)兒,自動(dòng)安裝好了。

要注意的事,比如gmake事先要裝好等,不然編譯不了。

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2010-11-20 11:39 |只看該作者
有個(gè)windows下的pginstall開源項(xiàng)目,國(guó)內(nèi)有人參與維護(hù)
http://bbs.pgsqldb.com/index.php ... 15bea9f5e39b43ea9cc
http://pginstaller.googlecode.com/svn/trunk/pginst/README

linux平臺(tái)下的圖形界面安裝enterpriseDB已經(jīng)打包的比較完善了,從pg的官網(wǎng)上下載的圖形安裝都是enterpriseDB打包的
Note: The one click installers do not integrate with platform-specific packaging systems. If you want operating system integration, please use the packages listed below.
The one click installers are maintained by Dave Page at EnterpriseDB.

論壇徽章:
59
2015七夕節(jié)徽章
日期:2015-08-24 11:17:25ChinaUnix專家徽章
日期:2015-07-20 09:19:30每周論壇發(fā)貼之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38榮譽(yù)版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年紀(jì)念徽章
日期:2015-07-20 11:05:27IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-07-20 11:05:34操作系統(tǒng)版塊每日發(fā)帖之星
日期:2015-07-20 11:05:36程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-07-20 11:05:40數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-07-20 11:05:432015年辭舊歲徽章
日期:2015-07-20 11:05:44
6 [報(bào)告]
發(fā)表于 2010-11-20 15:40 |只看該作者
回復(fù) 3# tanfeng3


    沒(méi)有這么慢。要看你機(jī)器的配置情況。
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP