2015년 6월 3일 수요일

TIP :: CentOS 지난 버전 사용하기 (iso, yum repository 등)

경험상 우리나라에서 제일 빠른 CentOS mirror는 다음카카오(http://ftp.daumkakao.com/centos)인 듯 하다. 만약 어떠한 이유 때문에 지난 버전의 CentOS가 필요해서 아무 미러나 가서 해당 버전 디렉토리로 가면 딸랑 readme파일 하나만 있다. 내용은...

This directory (and version of CentOS) is deprecated.  For normal users,
you should use /6/ and not /6.5/ in your path. Please see this FAQ
concerning the CentOS release scheme:

https://wiki.centos.org/FAQ/General

If you know what you are doing, and absolutely want to remain at the 6.5
level, go to http://vault.centos.org/ for packages. 

Please keep in mind that 6.0, 6.1, 6.2, 6.3, 6.4 and 6.5 no longer gets any updates, nor
any security fix's.

대략 지난 버전이 꼭 필요하다면 http://vault.centos.org를 이용하라는 소리다.
http://vault.centos.org에 가보면 지난 디렉토리들이 보이고, 디렉토리에 들어가면 다른 미러와 다르게 여러 디렉토리들이 보인다.


DVD를 만들기 위해 iso 파일이 필요하다면 isos/(i386 or x86_64) 디렉토리로 가서 iso파일을 직접 받거나 torrent 파일을 받아서 torrent client로 다운 받으면 된다. 해당 서버가 한국에서 좀 느리므로 torrent를 이용하는 것을 추천한다.

iso를 받아서 설치하는 것만 중요한 것이 아니라 yum으로 패키지를 설치할 때 최신 업데이트된 패키지를 설치하지 않도록 해야 한다. 방법은 OS만 설치한 상태에서 /etc/yum.repos.d/아래의 .repo 파일들을 수정하는 것이다.

/etc/yum.repos.d 디렉토리에 가면 기본적으로 아래와 같이 .repo 파일들이 있다.

. CentOS-Base.repo
. CentOS-Debuginfo.repo
. CentOS-Media.repo
. CentOS-Vault.repo

CentOS-Base-repo 파일을 해당 버전에 맞게 수정해주어야 한다. CentOS-Base.repo파일을 삭제하거나 내용을 모두 comment처리하고, CentOS-Valut.repo파일을 사용하면 되지 않을 까 해서 열어 봤는데 6.5에서는 6.3까지밖에 안들어 있어서 CentOS-Base.repo 파일을 수정하는 편이 더 좋을 것 같다.

# CentOS-Base.repo
#
# 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/
baseurl=http://vault.centos.org/6.5/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://vault.centos.org/6.5/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
baseurl=http://vault.centos.org/6.5/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://vault.centos.org/6.5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#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/
baseurl=http://mirror.centos.org/centos/6.5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

위 파일을 보면 [base]와 같이 []로 둘러싸인 값이 repository 이름이다. 기본적으로 base, updates, extras 3개만 사용하고, 나머지 2개는 enable이 0으로 이용되지 않는다. (enable라인이 없으면 1이 default) enable이 표시되어 있지 않은 부분에 mirrorlist로 시작하는 라인을 "#"로 comment 처리한다. 그리고 baseurl로 시작하는 부분에 해당 repository의 url을 적어주면 된다. CentOS 6버전이라면 위에서 빨갛게 표시된 6.5부분에 사용하려는 버전 번호를 넣으면 된다. 위에서는 기존 baseurl은 그대로 놔두고, 한 라인 추가해서 넣어줬다.

저장하고
>yum clean all
>yum repolist
해서 제대로 동작하는지 확인한다.

위와 같이 하고, yum으로 패키지들을 설치하면 6.5 버전에 해당하는 패키지 버전으로 설치된다. CentOS 5나 7도 같은 방법으로 한정된 버전에서 사용 가능하다.

FIX :: ssh 접속이 느리고, /var/log/messages에 systemd-logind.service failed. 메시지가 남을 때

ssh 접속이 느릴 때가 있습니다. 보통은DNS가 제대로 설정되지 않았는데 /etc/ssh/sshd_config에 UseDNS가 yes로 되어 있을 때 발생합니다. 위와 같을 경우 /etc/ssh/sshd_config파일에서 아래와 같이 수정 후 ...