'CentOS'에 해당되는 글 3건

  1. 2009.12.23 28. CentOS 에서 yum 수행시 repo 사이트 추가
  2. 2009.11.24 27. CentOS 에서의 한글 설정 3
  3. 2009.03.31 7. sed 란? 2
2009. 12. 23. 22:37

28. CentOS 에서 yum 수행시 repo 사이트 추가

CentOS 에서는 yum 이라는 명령어로 rpm 을 관리해준다.

연관성이 있는 rpm 들을 체크해서 같이 설치를 해주기 때문에
rpm 이 설치되고 나서 실행이 안되는 경우를 방지해준다.

수행 방법은 rpm 의 이름으로 yum 명령어를 치면 된다.

예를 들어 ethereal 을 설치할려고 한다면

리눅스 터미널상에서 다음과 같이 입력한다 .

yum -y install ethereal*

그러면 ethereal 로 시작하는 rpm 들을 연관성 체크해서 같이 설치를 진행하게 된다.

여기서 문제는 잘 사용하지 않거나 rpmforge 에 있는 rpm 들도 같이 yum 을 통해서 설치 가능하도록 하려면

repo  파일을 수정하거나 추가로 설치해야 한다.
아래는 기본적인 repo 의 정보가 들어있는 파일들이다.
[root@localhost yum.repos.d]# ls -l
total 20
-rw-r--r-- 1 root root 2389 Dec 23 22:29 CentOS-Base.repo
-rw-r--r-- 1 root root  626 Mar 17  2009 CentOS-Media.repo

CentOS wiki 사이트에서 자세한 방법을 설명하고 있으니 다음 링크 클릭해서 그대로 따라 하면 되겠다.

http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

쉽게 CentOS 설치하고 나서 터미널에서 다음과 같이 치면 된다.
(1) yum install yum-priorities


(2) vi /etc/yum/pluginconf.d/priorities.conf
여기서

[main]
enabled=1
라고 되어 있는지 확인

(3) cd
/etc/yum.repos.d/

두개 파일에서 CentOS-Base.repo 과 CentOS-Media.repo 을 열어서 마지막 라인에

다음과 같이 추가

priority=1

(4) wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm

(5) rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

(6) rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm

(7) yum check-update

하고 나서 테스트로 mplayer 를 한번 설치 전 단계까지 해본다.

yum install mplayer

그럼 중간에 설치할 것인지 말 것인지 [y/n] 를 물어보고 n 를 입력하면 설치 취소가 된다.


2009. 11. 24. 13:21

27. CentOS 에서의 한글 설정

일단 기본적으로 CentOS 를 설치하게 되면
기본 언어를 영어로 설정했다면 쉘 역시 영어로 설정이 된다.

이것을 아예 한글로 변경하거나 또는 로그인쉘에서만 따로 한글로 사용하도록 설정하는 방법이 있다.

1. 시스템 전체의 언어를 한글로 변경

root 로 로그인 이후  /etc/sysconfig/i18n 파일을 아래와 같이 수정한다.
만약을 위해 다른 이름으로 백업을 해둔다음에 진행하자.

[root@localhost ~]# more /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
SUPPORTED="en_US.UTF-8:en_US.en:ko_KR.UTF-8:ko_KR.eucKR:ko_KR:ko"


2. 로그인쉘 상에서의 특정 유저만 한글로 표현 ( 나머지 유저는 영어로 그대로 )

일단 그 유저의 특정유저로 로그인하고 나서 hidden file ( 숨김파일은 파일이름 앞에 점하나가 붙는다 ) 인
.bash_profile 안에 다음과 같은 라인을 추가시킨다.
( 숨김파일의 리스트를 보기 위해서는 ls -al 로 확인한다 )

그러면 그 유저로 로그인했을 때는 터미널 상에서 한글이 제대로 표현된다.
파일명이 한글인 경우 잘 표현되는지 확인하면 되겠다.

export LANG=ko_KR.eucKR


3. 파일질라 ( Filezilla ) 로 접속시 한글이 보이지 않거나 깨지는 현상

사이트관리자에서 <문자셋> 탭에서
<사용자정의문자셋 사용>을 클릭하고
아래 칸에 CP949 로 설정을 하고 다시 접속하면 한글이 잘 보이게 된다.

참고 : 파일질라 다운받는 곳은 www.filezilla-project.org
2009. 3. 31. 17:01

7. sed 란?


첫번째 라인 출력

sed -n '1p' filename

마지막 라인 출력

sed -n '$p' filename

두번째 라인 출력

sed -n '2p' filename

첫번째부터 세번째 라인까지 출력 ( 1번 라인 부터 3번 라인까지 포함 )

sed -n '1,3p' filename

첫번째라인 부터 세번째 라인까지 삭제하고 출력
sed '1,3d' filename

특수한 문자열(예를들어 root)을 검색해서 그 라인만 출력

sed -n '/root/p' filename

love가 나오는 행과 peace가 나오는 행 사이의 모든 행들이 출력된다. love가 peace 다음에 나오면 love가 나오는 행부터 마지막 행까지 출력된다.

sed -n ‘/love/,/peace/p’ datafile


파일 안의 빈줄들만 모조리 삭제하고자 할때 .

sed '/^$d' 파일명 > 새파일명

특정 단어를 찾아서 변환하고자 할때
sed 's/TEST/test/g' > 새파일명

특정 단어를 찾아서 지우고자 할때
sed 's/TEST//g' > 새파일명



sed 에 관한 도움말

# sed --help
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
  -i[SUFFIX], --in-place[=SUFFIX]
                 edit files in place (makes backup if extension supplied)
  -c, --copy
                 use copy instead of rename when shuffling files in -i mode
                 (avoids change of input file ownership)
  -l N, --line-length=N
                 specify the desired line-wrap length for the `l' command
  --posix
                 disable all GNU extensions.
  -r, --regexp-extended
                 use extended regular expressions in the script.
  -s, --separate
                 consider files as separate rather than as a single continuous
                 long stream.
  -u, --unbuffered
                 load minimal amounts of data from the input files and flush
                 the output buffers more often
      --help     display this help and exit
      --version  output version information and exit