wilson's story

CentOS4 에서 PHP5 인스톨 하기 : yum을 통한 패키지 인스톨 방법 본문

Linux

CentOS4 에서 PHP5 인스톨 하기 : yum을 통한 패키지 인스톨 방법

wilson 2008. 5. 9. 20:45
반응형
CentOS4.6에서 표준 인스톨 되어지는 PHP는 4.x대로서
yum 으로 아무리 업데이트를 해봐야 버전이 올라가지 않는다.
PHP5을 인스톨하고 싶은 경우에는,
기존의 yum 리포지터리(저장소:repository) 설정파일을 변경함으로서
가능하게 된다.
웹에서 검색한 결과
PHP5의 64bit OS에서의 컴파일 시,
종종 에러가 발생하는 경우가 있다고 한다.

여기서 본인의 경우
아무리 PHP5 소스를 컴파일을 해도
MySQL과 기타 환경 설정에서의 궁합이 맞지 않아
쌓이는 것은 스트레스이며 흘러가는건 시간 뿐인
무수한 시행착오를 겪게 될 뿐이었다.
미치고 환X할 노릇...

이에 지금가지 패키지 설치를 꺼려 하던 본인은
yum 으로 서버를 무장하기로 결론을 내리고 말았다.
컴파일 인스톨의 매력이 있겠지만,
더 이상 무한 스트레스는 받고 싶지 않았던 것이다. ^^;;
# vi /etc/yum.repos.d/CentOS-Base.repo

다음에 주목하자.
본인의 yum 리포지터리 설정 내용이다.
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#


[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1

#released updates
[update]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
protect=1

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
#priority=1
#protect=1

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=2
protect=1

#아래를 추가한다.
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

여기서 주목해야 할 것은, centosplus와 dag 리포지터리인데,
특히 CentOS4의 경우, centosplus를 활성화 시켜줌으로서
PHP5패키지군을 yum으로 설정하게 할 수 있다.
dag 또한 수많은 패키지가 있다.

여기서 yum을 실행하기 전에 다운로드한 데이터의 정확성을 확인하기 위한
gpg체크에 필요한 gpg-key를 인스톨하도록 한다.

# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

그 후, 시스템 자체를 최신 패키지로 변경하고 싶은 경우에는 yum 자체를 업데이트를 하면 끝.

# yum -y update

PHP만 최신 버전으로 교체하고 싶은 경우에는,
(물론 위의 yum 설정 변경으로, 이후에 설치되는 기타 패키지들은 리포지터리에 있는 최신 버전로 설치되게 된다.)
# yum update php

이제 CentOS4는 최신 버전 패키지의 상태로 되었다.
처음 업데이트를 한경우에는 커널도 업데이트가 되므로,
서버를 재기동해서 최신 패키지가 원활하게 돌아갈 수 있도록한다.


출처 : http://lifeij.tistory.com/entry/CentOS4-%EC%97%90%EC%84%9C-PHP5-%EC%9D%B8%EC%8A%A4%ED%86%A8-%ED%95%98%EA%B8%B0-yum%EC%9D%84-%ED%86%B5%ED%95%9C-%ED%8C%A8%ED%82%A4%EC%A7%80-%EC%9D%B8%EC%8A%A4%ED%86%A8-%EB%B0%A9%EB%B2%95
반응형