기본적으로 CentOS는 패키지관리자(yum)으로 프로그램을 설치하면 오래된 버전의 프로그램들이 설치되고,
When CentOS installs the program as a package manager (yum), older versions of the programs are installed.

최신 프로그램은 없는 경우가 있습니다. 그런 경우 EPEL, IUS, Remi 등의 저장소를 추가해주면 신버전의 프로그램을 설치할 수 있습니다.
And there is no latest program. In that case, you can install new versions of programs by adding repositories such as EPEL, IUS, and Remi.

하지만 별도로 설치하는 저장소의 패키지는 기존 시스템과 맞지 않을 수 있습니다. 제 경우엔 그런 문제는 없었지만.
However, the package of the repository that you install separately may not match the existing system. I did not have that problem in my case.

EPEL 저장소 설치 (Install the EPEL repository)


일반적으로 아래 명령을 실행하면 EPEL저장소를 사용하게 됩니다.

Generally, the following command will use the EPEL repository.

sudo yum install epel-release


하지만 설치가 안되는 경우 아래 명령을 참고하세요.
But if you can not install it please refer to the following command.


- CentOS and Red Hat Enterprise Linux 5.x

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm

- CentOS and Red Hat Enterprise Linux 6.x

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

- CentOS and Red Hat Enterprise Linux 7.x

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm



IUS 저장소 설치 (Install the IUS repository)


- CentOS 5.x

sudo rpm -Uvh https://centos5.iuscommunity.org/ius-release.rpm

- CentOS 6.x

sudo rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm

- CentOS 7.x

sudo rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm

- Redhat 5.x

sudo rpm -Uvh https://rhel5.iuscommunity.org/ius-release.rpm

- Redhat 6.x

sudo rpm -Uvh https://rhel6.iuscommunity.org/ius-release.rpm

- Redhat 7.x

sudo rpm -Uvh https://rhel7.iuscommunity.org/ius-release.rpm


Remi 저장소 추가 (Install the Remi repository)


- CentOS and Red Hat Enterprise Linux 5.x

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

- CentOS and Red Hat Enterprise Linux 6.x

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

- CentOS and Red Hat Enterprise Linux 7.x

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm


Remi 저장소 활성화 (Enable the Remi repository)

# 패키지 설치시 파라메터로 임시로 활성화
# Temporarily activate as a parameter when installing packages

sudo yum --enablerepo=remi install [패키지명]


# 저장소 파일을 수정하여 영구적으로 활성화
# Modify the repository file to permanently activate it

vi /etc/yum.repos.d/remi.repo

enabled 값을 1로 설정.
Set the enabled value to 1


보여주기만 할 휘발성 데이터를 바쁜 DB서버에서 그때그때 불러와 보여주는 건 낭비다.

그래서 그 정보들을 메모리에 넣어두고 보여주면 응답속도도 빠를 뿐 아니라 DB부하도 획기적으로 줄일 수 있다.


회사 서비스용 서버가 CentOS로 되어 있어 memcached를 설치해보았다.


1. libevent설치.

일단 memcached는 libevent라는 라이브러리를 이용한다. 먼저 설치해야 한다.

wget https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz --no-check-certificate

tar xvzf libevent-2.0.16-stable.tar.gz

cd libevent-2.0.16-stable

./configure --prefix=/usr

make; make install 

대충 이런 과정을 거쳤다.


2. memcached 설치.

이제 설치하려던 놈을 설치한다.

 wget http://memcached.googlecode.com/files/memcached-1.4.10.tar.gz

tar xvzf memcached-1.4.10.tar.gz

cd memcached-1.4.10

./configure

make; make install


3. php 모듈 설치

회사 서비스가 php로 만들어져 있다. php에서 memcache에 접근할 수 있는 php 모듈을 설치해준다.

 wget http://pecl.php.net/get/memcache-3.0.6.tgz

tar xvzf memcache-3.0.6.tgz

cd memcache-3.0.6

phpize

./configure

make; make install

phpize명령이 실행이 안된다면, yum install php-devel명령으로 개발도구를 설치하고 다시 해본다.


다 설치가 되면 /etc/php.ini 파일을 열어 적당한 위치에 다음 라인을 추가한다.

 extension=memcache.so


이제 아파치를 재시작하고, 사용해보면 된다.

+ Recent posts