홈페이지 접속(https://redis.io/download/)
아래 Download 7.0.4 클릭하여 tar.gz 확장자 파일 다운로드
리눅스에 tar.gz 압축 해제
$ tar -xzf redis-7.0.4.tar.gz
$ make install
make는 소스를 컴파일 하는 것, 컴파일이란 것은 소스파일을 사용자가 실행 가능한 파일로 만들어 주는 과정을 말한다.
make install은 make를 통해 만들어진 설치파일(setup)을 설치 하는 과정이다. 한마디로 build된 프로그램을 실행 할 수 있게 파일들을 알맞은 위치에다가 복사를 한다.
make 명령어가 존재하지 않는다면
$ yum install make -y
를 통해 Download 한다.
아래와 같은 에러가 발생한다면 gcc 또는 tcl 명령어가 존재하는지 확인 후 존재하지 않는다면 Download한다($ yum install gcc -y
, $ yum install tcl -y
)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/usr/local/redis-3.2.0/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
make[3]: gcc: Command not found
make[3]: *** [net.o] Error 127
make[3]: Leaving directory `/usr/local/redis-3.2.0/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/usr/local/redis-3.2.0/deps'
make[1]: [persist-settings] Error 2 (ignored)
CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/usr/local/redis-3.2.0/src'
make: *** [all] Error 2
make시 에러가 발생했다면 make distclean
을 통해 정보를 초기화 하고 다시 시도한다.
Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!
구문이 나오고 redis가 실행이 안된다면 redis디렉토리/utils로 이동하여 install_server.sh 파일을 수정해준다(아래 부분 주석처리)
#bail if this system is managed by systemd
#_pid_1_exe="$(readlink -f /proc/1/exe)"
#if [ "${_pid_1_exe##*/}" = systemd ]
#then
# echo "This systems seems to use systemd."
# echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!"
# exit 1
#fi
``
5. 인스턴스 생성
- tar.gz파일을 푼 디렉토리로 이동한 후
`$ ./utils/install_server.sh` 명령어로 인스턴스를 생성한다.
모두 Enter를 누르거나 port 지정 후 생성된 후 `/etc/redis` 폴더에 6379.conf라는 설정 파일이 생기고 `/etc/init.d` 폴더에 redis_6379 파일이 서비스에 등록된다.
그리고 자동으로 데몬 프로세스(백그라운드)로 실행된다.
6. redis server 시작 / 종료
$ systemctl start redis_6379 // redis 시작
$ systemctl stop redis_6379 // redis 종료