티스토리 뷰

[기타]

[redis] 리눅스에서 redis 설치

handr95 2021. 6. 28. 22:52
반응형

1. redis 사이트에서 필요한 버전 파일을 다운 받습니다(http://download.redis.io/releases/)

wget http://download.redis.io/releases/redis-3.2.0.tar.gz

 

2. 다음 압축을 풀고 폴더 내에 들어가 다음 명령어를 실행합니다.

cd ./redis-3.2.0
make
//make가 문제 없이 실행이 되었다면
make test

 

3. 실행이 완료되면 redis-server를 띄워줍니다. 설정을 변경하고 싶다면 설정 파일 위치를 입력해주면 되고 아니라면 엔터를 눌러주면 됩니다. 마지막Please select the redis executable path의 경우 default 값이 없으므로, 설치한 redis폴더경로/src/redis-server를 입력해줍니다.

[root@ngqagbksglqa01 utils]# sh ./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [] /usr/local/redis-3.2.0/src/redis-server
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/local/redis-3.2.0/src/redis-server
Cli Executable : /usr/local/redis-3.2.0/src/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!

 

4. 3번까지 완료됬다면 redis 설치와 실행 완료.

ps -aux | grep redis
root      1413  0.0  0.0 136988  7516 ?        Ssl  17:13   0:00 /usr/local/redis-3.2.0/src/redis-server 127.0.0.1:6379

 


 

[root@ngqagbksglqa01 redis-3.2.0]#make
.....
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

위 에러가 발생했다면 gcc가 설치가 안되어서 그런거니 gcc를 설치해주고 다시 make를 해주면 된다.

yum -y install gcc
make distclean
make

[root@ngqagbksglqa01 redis-3.2.0]# make
cd src && make all
make[1]: Entering directory `/usr/local/redis-3.2.0/src'
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
 #include <jemalloc/jemalloc.h>
                               ^
compilation terminated.
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-3.2.0/src'
make: *** [all] Error 2

위 에러가 발생했다면 컴파일/설정  정보를 초기화 하고 다시 컴파일 시도해주면 된다.

make distclean
make

그래도 동일한 에러가 나온다면 tcl시 설치후 다시 컴파일

yum -y install tcl
make distclean
make

 

 


참고

반응형
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함