安裝postgreSQL出現configure:error:readline library not found解決方案

來源:互聯網
上載者:User

標籤:des   style   blog   http   color   使用   os   strong   

要安裝 readline , readline-dev 開發包,要麼使用 --without-readline 選項關閉 readline 功能。

#yum install readline;

#yum install readline-dev;


readline 也就是命令列編輯,關閉的話,你直接用psql 就不能編輯命令行,如果輸錯指令,不能復原命令記錄,只能手工重新輸入。

 

 

在安裝postgreSQL的過程中遇到一個問題,在執行 configure

過程中報以下錯誤,configure: error: readline library not found ,可是我在系統中安裝
readline 包了,

1 環境資訊

2 根據提示,測試了下 configre命令,果然報這個錯
[[email protected] postgresql-9.0.0]# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking which template to use... linux
checking whether to build with 64-bit integer date/time support... yes
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for WAL segment size... 16MB
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking if gcc supports -Wdeclaration-after-statement... yes
checking if gcc supports -Wendif-labels... yes
checking if gcc supports -fno-strict-aliasing... yes
checking if gcc supports -fwrapv... yes
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -E
checking allow thread-safe client libraries... yes
checking whether to build with Tcl... no
checking whether to build Perl modules... no
checking whether to build Python modules... no
checking whether to build with GSSAPI support... no
checking whether to build with Kerberos 5 support... no
checking whether to build with PAM support... no
checking whether to build with LDAP support... no
checking whether to build with Bonjour support... no
checking whether to build with OpenSSL support... no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for ranlib... ranlib
checking for strip... strip
checking whether it is possible to strip libraries... yes
checking for ar... ar
checking for tar... /bin/tar
checking whether ln -s works... yes
checking for gawk... gawk
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for bison... no
configure: WARNING:
*** Without Bison you will not be able to build PostgreSQL from CVS nor
*** change any of the parser definition files.  You can obtain Bison from
*** a GNU mirror site.  (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this, because the Bison
*** output is pre-generated.)
checking for flex... no
configure: WARNING:
*** Without Flex you will not be able to build PostgreSQL from CVS nor
*** change any of the scanner definition files.  You can obtain Flex from
*** a GNU mirror site.  (If you are using the official distribution of
*** PostgreSQL then you do not need to worry about this because the Flex
*** output is pre-generated.)
checking for perl... /usr/bin/perl
configure: using perl 5.8.8
checking for main in -lm... yes
checking for library containing setproctitle... no
checking for library containing dlopen... -ldl
checking for library containing socket... none required
checking for library containing shl_load... no
checking for library containing getopt_long... none required
checking for library containing crypt... -lcrypt
checking for library containing fdatasync... none required
checking for library containing gethostbyname_r... none required
checking for library containing shmget... none required
checking for -lreadline... no
checking for -ledit... no
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 isnt looking in the proper directory.
Use --without-readline to disable readline support.

     根據提示,應該是沒有安裝 readline包。

3 檢查系統是否安裝 readline 包
[[email protected] postgresql-9.0.0]# rpm -qa | grep readline
readline-5.1-3.el5

   說明系統已經安裝了 readline包。

4 通過 yum 搜尋相關的 readline 包
[[email protected] postgresql-9.0.0]# yum search readline
lftp.i386 : A sophisticated file transfer program
lftp.i386 : A sophisticated file transfer program
php-readline.i386 : Standard PHP module provides readline library support
lftp.i386 : A sophisticated file transfer program
readline.i386 : A library for editing typed command lines.
compat-readline43.i386 : The readline 4.3 library for compatibility with older software.
readline-devel.i386 : Files needed to develop programs which use the readline library.
readline.i386 : A library for editing typed command lines.

 根據提示,有一個包引起了注意 "readline-devel", 猜想可能與這個包有關。
 
5 安裝 readline-devel 包
[[email protected] postgresql-9.0.0]# yum -y install -y readline-devel
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package readline-devel.i386 0:5.1-3.el5 set to be updated
--> Processing Dependency: libtermcap-devel for package: readline-devel
--> Running transaction check
---> Package libtermcap-devel.i386 0:2.0.8-46.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 readline-devel          i386       5.1-3.el5        base              146 k
Installing for dependencies:
 libtermcap-devel        i386       2.0.8-46.1       base               56 k

Transaction Summary
=============================================================================
Install      2 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)        

Total download size: 201 k
Downloading Packages:
(1/2): libtermcap-devel-2 100% |=========================|  56 kB    00:00     
(2/2): readline-devel-5.1 100% |=========================| 146 kB    00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: libtermcap-devel             ######################### [1/2] 
  Installing: readline-devel               ######################### [2/2]

Installed: readline-devel.i386 0:5.1-3.el5
Dependency Installed: libtermcap-devel.i386 0:2.0.8-46.1
Complete!

6 再次執行 configure 成功。

7 還有一種解決方案:在configure 加上參數 --without-readline ,不過這樣就不可以在命令列裡面輸入了,所以不建議這樣。。。

8 configure 成功之後接著就是make了

9 make之後就是make install之後安裝成功的話就會出現如所示的介面

 10.修改postgreSQL安裝目錄的許可權,預設的安裝目錄在/usr/local/pgSQL下

修改許可權命令為chmod -R 777 /usr/local/pgSQL

運行之後pgSQL目錄下面的所有檔案都會有XWR(X:可執行,W:可寫,R:可讀)許可權。命令中的-R參數說明是遞迴的把檔案夾pgSQL目錄及其目錄下的所有檔案都修改為相應的許可權,777就是代表加上對本使用者,本使用者組的其他使用者和不是這個組的使用者增加XWR許可權。

 

11.

到此,PostgreSQL的安裝完成了,接下來可以試著用用這個開來源資料庫啦…

1):首先是初始化資料庫。進入剛剛安裝PG的檔案夾/home/pg/postgr(這是我安裝pg的目錄,預設的安裝目錄是在/usr/local/pgSQL下),輸入./bin/initdb –D ../data. 這裡的命令格式還需要查明白,特別是-D等參數的意義。這樣會在postgr下面產生一個data檔案夾。

2):啟動資料庫伺服器。./bin/postmaster –D ./data&. 其中&的意義需要弄明白,差這一個符號就會導致一定的問題,貌似啟動資料庫伺服器還可以使用另外的命令:/bin/postgres -D ./data 或者是 ./bin/pg_ctl -D ./data -l logfile start。這些命令的區別可以自己查查手冊或者諮詢一下助教。

 

 

3):在另外一個命令列下面,建立一個本機資料庫。./bin/createdb testdb,其中testdb是資料庫名。在data目錄下會產生一個檔案夾

 

 

4):連結資料庫伺服器。./bin/psql testdb. 此時,輸入help可以獲得協助。見

 

 

 

5):訪問資料庫。這裡就是輸入sql命令了,以後調試的入口就是這裡吧。結束後按\q退出。

 

6):最後是關閉資料庫伺服器。./bin/pg_ctl stop –D ./data.

12.That‘s all!

另外可能會報下面的問題:

./configure --prefix=/usr/local/pgsql

.....

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;

 

參考:

http://www.cnblogs.com/shuaixf/archive/2011/11/29/2268292.html

http://www.cnblogs.com/shuaixf/archive/2011/11/29/2268298.html

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.