国产精品国产三级国产试看,香蕉人精品视频多人免费永久视频,宅男噜噜噜66一区二区,天天插天天射,女人体(1963)菠萝蜜视频,97在线视频人妻无码一区,精品久久久久精品色婷婷综合

網(wǎng)站首頁
手機(jī)版

為CentOS 為centos7配置一個(gè)本地yum安裝源

更新時(shí)間:2023-09-06 00:22:55作者:未知

為CentOS 為centos7配置一個(gè)本地yum安裝源

目前最新的CentOS 6.3中,仍然使用的是PostgreSQL 8.4版本。為了滿足另一應(yīng)用系統(tǒng)的需求,必須安裝PostgreSQL 9及以上版本。本文將敘述如何使用PostgreSQL官方軟件倉庫和YUM工具,實(shí)現(xiàn)自動(dòng)安裝PostgeSQL 9。我使用的CentOS版本為6.3,該操作方法同樣適用于使用CentOS 5, RedHat或者Fedora版本的朋友,只是需要注意下載文件時(shí)有對(duì)應(yīng)的版本選擇。

1、下載并安裝PostgreSQL官方軟件倉庫

訪問http://yum.pgrpms.org/repopackages.php,選擇對(duì)應(yīng)的操作系統(tǒng)版本,下載repo rpm文件。對(duì)應(yīng)我的操作系統(tǒng)CentOS 6.3 32位版本,使用wget命令下載,操作如下:

[root@wardking ~]# wget http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm –2012-10-11 02:52:40– http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpmResolving yum.pgrpms.org… 98.129.198.114Connecting to yum.pgrpms.org|98.129.198.114|:80… connected.HTTP request sent, awaiting response… 200 OKLength: 5328 (5.2K) [application/x-redhat-package-manager]Saving to: pgdg-centos92-9.2-6.noarch.rpm 100%[==============================================================================================================================>] 5,328 24.7K/s in 0.2s 2012-10-11 02:52:42 (24.7 KB/s) – a€?pgdg-centos92-9.2-6.noarch.rpma€

安裝軟件倉庫

[root@wardking ~]# rpm -ivh pgdg-centos92-9.2-6.noarch.rpmwarning: pgdg-centos92-9.2-6.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 442df0f8: NOKEYPreparing… ########################################### [100%] 1:pgdg-centos92 ########################################### [100%]

編輯CentOS-Base.repo,將目前的CentOS倉庫中的版本排除

[root@wardking ~]# vi /etc/yum.repos.d/CentOS-Base.repo# remarked out baseurl= line instead. [base]name=CentOS-$releasever – Basemirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6exclude=postgresql* #released updates[updates]name=CentOS-$releasever – Updatesmirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6exclude=postgresql*

試一下,應(yīng)該可以看到最新的PostgreSQL出現(xiàn)在可用軟件列表中:

[root@wardking ~]# yum list postgres*Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.btte.net * epel: mirrors.ustc.edu.cn * extras: mirrors.btte.net * rpmforge: mirror.fairway.ne.jp * updates: mirrors.btte.netbaseextraspgdg92pgdg92/primary_dbupdatesInstalled Packagespostgresql.i686 8.4.13-1.el6_3postgresql-contrib.i686 8.4.13-1.el6_3postgresql-devel.i686 8.4.13-1.el6_3postgresql-libs.i686 8.4.13-1.el6_3postgresql-plperl.i686 8.4.13-1.el6_3postgresql-server.i686 8.4.13-1.el6_3Available Packagespostgresql-ip4r.i686 1.05-1.el6postgresql-pgpool-II.i686 3.2.0-1.el6postgresql-pgpool-II-devel.i686 3.2.0-1.el6postgresql-pgpool-II-recovery.i686 3.2.0-1.el6postgresql-plparrot.i686 0.04-5.el6postgresql-plruby.i686 0.5.3-4.el6postgresql-plruby-doc.i686 0.5.3-4.el6postgresql-relay.i686 1.3-2.2.el6.rfpostgresql92.i686 9.2.1-1PGDG.rhel6postgresql92-contrib.i686 9.2.1-1PGDG.rhel6postgresql92-debuginfo.i686 9.2.1-1PGDG.rhel6postgresql92-devel.i686 9.2.1-1PGDG.rhel6postgresql92-docs.i686 9.2.1-1PGDG.rhel6postgresql92-jdbc.i686 9.2.1000-1PGDG.rhel6postgresql92-jdbc-debuginfo.i686 9.2.1000-1PGDG.rhel6postgresql92-libs.i686 9.2.1-1PGDG.rhel6postgresql92-odbc.i686 09.01.0200-1PGDG.rhel6postgresql92-odbc-debuginfo.i686 09.01.0200-1PGDG.rhel6postgresql92-plperl.i686 9.2.1-1PGDG.rhel6postgresql92-plpython.i686 9.2.1-1PGDG.rhel6postgresql92-pltcl.i686 9.2.1-1PGDG.rhel6postgresql92-server.i686 9.2.1-1PGDG.rhel6postgresql92-tcl.i686 2.0.0-1.rhel6postgresql92-tcl-debuginfo.i686 2.0.0-1.rhel6postgresql92-test.i686 9.2.1-1PGDG.rhel6

將舊版本中的postgresql軟件包全部刪除

[root@wardking ~]# yum remove postgresql postgresql-contrib postgresql-libs postgresql-devel postgresql-plperl postgrLoaded plugins: fastestmirrorSetting up Remove ProcessResolving Dependencies–> Running transaction check—> Package postgresql.i686 0:8.4.13-1.el6_3 will be erased—> Package postgresql-contrib.i686 0:8.4.13-1.el6_3 will be erased—> Package postgresql-devel.i686 0:8.4.13-1.el6_3 will be erased—> Package postgresql-libs.i686 0:8.4.13-1.el6_3 will be erased–> Processing Dependency: libpq.so.5 for package: libdbi-dbd-pgsql-0.8.3-5.1.el6.i686–> Processing Dependency: postgresql-libs for package: libdbi-dbd-pgsql-0.8.3-5.1.el6.i686—> Package postgresql-plperl.i686 0:8.4.13-1.el6_3 will be erased—> Package postgresql-server.i686 0:8.4.13-1.el6_3 will be erased–> Running transaction check—> Package libdbi-dbd-pgsql.i686 0:0.8.3-5.1.el6 will be erased–> Finished Dependency ResolutionDependencies Resolved====================================================================================================================== Package Arch Version======================================================================================================================Removing: postgresql i686 8.4.13-1.el6_3 postgresql-contrib i686 8.4.13-1.el6_3 postgresql-devel i686 8.4.13-1.el6_3 postgresql-libs i686 8.4.13-1.el6_3 postgresql-plperl i686 8.4.13-1.el6_3 postgresql-server i686 8.4.13-1.el6_3Removing for dependencies: libdbi-dbd-pgsql i686 0.8.3-5.1.el6Transaction Summary======================================================================================================================Remove 7 Package(s)Installed size: 34 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionWarning: RPMDB altered outside of yum. Erasing : postgresql-devel-8.4.13-1.el6_3.i686 Erasing : postgresql-contrib-8.4.13-1.el6_3.i686 Erasing : postgresql-plperl-8.4.13-1.el6_3.i686 Erasing : postgresql-server-8.4.13-1.el6_3.i686 Erasing : postgresql-8.4.13-1.el6_3.i686 Erasing : libdbi-dbd-pgsql-0.8.3-5.1.el6.i686 Erasing : postgresql-libs-8.4.13-1.el6_3.i686 Verifying : postgresql-8.4.13-1.el6_3.i686 Verifying : postgresql-server-8.4.13-1.el6_3.i686 Verifying : postgresql-contrib-8.4.13-1.el6_3.i686 Verifying : libdbi-dbd-pgsql-0.8.3-5.1.el6.i686 Verifying : postgresql-devel-8.4.13-1.el6_3.i686 Verifying : postgresql-plperl-8.4.13-1.el6_3.i686 Verifying : postgresql-libs-8.4.13-1.el6_3.i686Removed: postgresql.i686 0:8.4.13-1.el6_3 postgresql-contrib.i686 0:8.4.13-1.el6_3 postgresql-devel.i686 0:8.4.13- postgresql-plperl.i686 0:8.4.13-1.el6_3 postgresql-server.i686 0:8.4.13-1.el6_3Dependency Removed: libdbi-dbd-pgsql.i686 0:0.8.3-5.1.el6Complete!

2、 開始安裝最新版PostgreSQL

現(xiàn)在已經(jīng)可以使用yum直接安裝

yum -y install postgresql postgresql-contrib postgresql-libs postgresql-plperl postgresql-serverLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * epel: ftp.jaist.ac.jp * extras: centos.ustc.edu.cn * rpmforge: mirror.hmc.edu * updates: ftp.iij.ad.jpSetting up Install ProcessResolving Dependencies–> Running transaction check—> Package postgresql92.i686 0:9.2.1-1PGDG.rhel6 will be installed—> Package postgresql92-contrib.i686 0:9.2.1-1PGDG.rhel6 will be installed—> Package postgresql92-libs.i686 0:9.2.1-1PGDG.rhel6 will be installed—> Package postgresql92-plperl.i686 0:9.2.1-1PGDG.rhel6 will be installed—> Package postgresql92-server.i686 0:9.2.1-1PGDG.rhel6 will be installed–> Finished Dependency ResolutionDependencies Resolved====================================================================================================================== Package Arch Version======================================================================================================================Installing: postgresql92 i686 9.2.1-1PGDG.rhel6 postgresql92-contrib i686 9.2.1-1PGDG.rhel6 postgresql92-libs i686 9.2.1-1PGDG.rhel6 postgresql92-plperl i686 9.2.1-1PGDG.rhel6 postgresql92-server i686 9.2.1-1PGDG.rhel6Transaction Summary======================================================================================================================Install 5 Package(s)Total download size: 5.3 MInstalled size: 21 MDownloading Packages:(1/5): postgresql92-9.2.1-1PGDG.rhel6.i686.rpm(2/5): postgresql92-contrib-9.2.1-1PGDG.rhel6.i686.rpm(3/5): postgresql92-libs-9.2.1-1PGDG.rhel6.i686.rpm(4/5): postgresql92-plperl-9.2.1-1PGDG.rhel6.i686.rpm(5/5): postgresql92-server-9.2.1-1PGDG.rhel6.i686.rpm———————————————————————————————————————-TotalRunning rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : postgresql92-libs-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-server-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-plperl-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-contrib-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-plperl-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-server-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-libs-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-contrib-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-9.2.1-1PGDG.rhel6.i686Installed: postgresql92.i686 0:9.2.1-1PGDG.rhel6 postgresql92-contrib.i686 0:9.2.1-1PGDG.rhel6 pos postgresql92-plperl.i686 0:9.2.1-1PGDG.rhel6 postgresql92-server.i686 0:9.2.1-1PGDG.rhel6Complete!

3、初始化數(shù)據(jù)庫并啟動(dòng)

安裝操作順利完成后,對(duì)數(shù)據(jù)庫進(jìn)行初始化,然后啟動(dòng)服務(wù)

[root@wardking ~]# service postgresql-9.2 initdbInitializing database: [ OK ][root@wardking ~]# service postgresql-9.2 startStarting postgresql-9.2 service: [ OK ]

如果有錯(cuò)誤信息出現(xiàn),檢查日志文件 /var/lib/pgsql/9.2/data/pg_log,查找線索

4、 配置工作環(huán)境

PostgreSQL數(shù)據(jù)庫操作的默認(rèn)賬戶為postgres,其操作目錄為/var/lib/pgsql,配置文件.bash_profile中的默認(rèn)內(nèi)容為

[ -f /etc/profile ] && source /etc/profilePGDATA=/var/lib/pgsql/9.1/dataexport PGDATA

以上配置中包括了數(shù)據(jù)庫所在的路徑,但是沒有可執(zhí)行命令文件所在的目錄,為操作便利,更正如下:

[ -f /etc/profile ] && source /etc/profilePGDATA=/var/lib/pgsql/9.1/dataexport PGDATAPATH=$PATH:$HOME/bin:/usr/pgsql-9.1/binexport PATH

5、設(shè)置默認(rèn)賬戶postgres的操作密碼

[root@wardking ~]# su – postgres-bash-4.1$ psql postgres postgrespsql (9.2.1)Type “help” for help.postgres=# alter user postgres with password ‘postgres’;ALTER ROLEpostgres=#

6、 提升postgreSQL安全

默認(rèn)配置中,postgreSQL使用明文存儲(chǔ)密碼,非常不安全,需要修改配置文件,更改密碼驗(yàn)證方式為md5

[root@wardking ~]# vi /var/lib/pgsql/9.1/data/pg_hba.conf# Put your actual configuration here# ———————————-## If you want to allow non-local connections, you need to add more# “host” records. In that case you will also need to make PostgreSQL# listen on a non-local interface via the listen_addresses# configuration parameter, or via the -i or -h command line switches.# TYPE DATABASE USER ADDRESS METHOD# “l(fā)ocal” is for Unix domain socket connections onlylocal all all md5# IPv4 local connections:host all all 127.0.0.1/32 md5# IPv6 local connections:host all all ::1/128 md5# Allow replication connections from localhost, by a user with the# replication privilege.#local replication postgres peer#host replication postgres 127.0.0.1/32 ident#host replication postgres ::1/128 ident

為了使配置文件生效,必須讓postgreSQL重新載入配置,有多種方式可以實(shí)現(xiàn):

第一種方式: 直接使用命令操作

[root@wardking ~]# su – postgres-bash-4.1$ pg_ctl reloadserver signaled-bash-4.1$

第二種方式:切換到postgres用戶,通過psql命令,調(diào)用pg_reload_conf();

-bash-4.1$ psql postgres postgrespsql (9.1.1)Type “help” for help.postgres=# select pg_reload_conf(); pg_reload_conf—————- t(1 row)postgres=#

第三種方式:切換到postgres用戶,同樣使用psql命令,但無須登錄PostgreSQL控制臺(tái)

-bash-4.1$ psql postgres postgres -c “select pg_reload_conf();”Password for user postgres: pg_reload_conf—————- t(1 row)-bash-4.1$

允許遠(yuǎn)程連接PostgreSQL數(shù)據(jù)庫

PostgreSQL的主配置文件postgresql.conf位于目錄/var/lib/pgsql/9.2/data,其中CONNECTIONS AND AUTHENTICATION段中的配置如下

#——————————————————————————# CONNECTIONS AND AUTHENTICATION#—————————————————————————— # – Connection Settings - #listen_addresses = ‘localhost’ # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to ‘localhost’, ‘*’ = all # (change requires restart)#port = 5432 # (change requires restart)

以上默認(rèn)設(shè)置僅接受來自本地(Localhost)的連接,如果需要允許遠(yuǎn)程主機(jī)連接,需要將listen_addresses注釋取消,并將localhost更改為*或者指定的網(wǎng)卡IP地址。此處還可以更改默認(rèn)的監(jiān)聽端口5432

修改完成后,需要重新啟動(dòng)postgresql-9.2系統(tǒng)服務(wù),重新載入配置文件后方可生效。

如果修改該文件導(dǎo)致服務(wù)無法啟動(dòng),可以查看/var/lib/pgsql/9.2/pg_log文件,查找線索進(jìn)行排錯(cuò)。

重新啟動(dòng)完成后,進(jìn)入postgres用戶控制臺(tái),登錄數(shù)據(jù)庫操作界面,可以驗(yàn)證更改結(jié)果

-bash-4.1$ psqlPassword:psql (9.1.1)Type “help” for help. postgres=# show listen_addresses; listen_addresses—————— *(1 row) postgres=# show port; port—— 5432(1 row) postgres=#

原文地址:http://www.wardking.com/2012/10/%e4%b8%bacentos%e5%ae%89%e8%a3%85%e6%9c%80%e6%96%b0%e7%89%88postgresql/

本文標(biāo)簽: 版本  操作  配置文件  

為您推薦

CentOS下自動(dòng)備份網(wǎng)站和數(shù)據(jù)庫的腳本

CentOS下自動(dòng)備份網(wǎng)站和數(shù)據(jù)庫的腳本 接觸CentOS已經(jīng)有幾個(gè)月的時(shí)間了,使用了太久的windows在剛接觸linux命令行界面的時(shí)候還真有點(diǎn)不太適應(yīng),但

2023-09-06 00:22

為CentOS 為centos7配置一個(gè)本地yum安裝源

為CentOS v6.3 安裝最新版PostgreSQL 目前最新的CentOS 6.3中,仍然使用的是PostgreSQL 8.4版本。為了滿足另一應(yīng)用系統(tǒng)的

2023-09-06 00:22

centos6.4安裝CloudStack centos6.2安裝

centos6.4安裝CloudStack 4.2(開源云計(jì)算平臺(tái))詳解 CloudStack 的前身是 Cloud.com 家的一款商業(yè)云計(jì)算產(chǎn)品(也有開源版

2023-09-06 00:22

CentOS常用基礎(chǔ)命令匯總 centos操作指令

CentOS常用基礎(chǔ)命令匯總 1.關(guān)機(jī) (系統(tǒng)的關(guān)機(jī).重啟以及登出 ) 的命令 shutdown -h now 關(guān)閉系統(tǒng)(1) init 0 關(guān)閉系統(tǒng)(2) t

2023-09-06 00:22

CentOS 5.10 服務(wù)器系統(tǒng)安裝配置圖解教程

CentOS 5.10 服務(wù)器系統(tǒng)安裝配置圖解教程 說明: 在實(shí)際生產(chǎn)環(huán)境中,CentOS 5.x系列仍然是很多服務(wù)器裝機(jī)者的首選系統(tǒng) 截止目前CentOS 5

2023-09-06 00:22

CentOS 6.5系統(tǒng)安裝配置圖解教程(詳細(xì)圖文)

CentOS 6.5系統(tǒng)安裝配置圖解教程(詳細(xì)圖文) 說明: 截止目前CentOS 6.x最新版本為CentOS 6.5,下面介紹CentOS 6.5的具體安裝

2023-09-06 00:22