Compile and install every minute to get Redis

1. Installation dependencies

yum -y install cpp binutils glibc glibc-kernheaders glibc-common glibc-devel gcc make gcc-c++ libstdc++-devel tcl

2. Install the package ready

You can from the official website  https://redis.io download the latest version redis

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

3. Compile, install

cd redis- 4.0 . 14 
make  
make install

4. Create a directory, modify the configuration file, start redis

Consider creating a separate directory redis

# Create a directory
 mkdir -p / the Data / Redis / redis6379

# Copy profile
cp redis.conf  /data/redis/redis6379/

# Modify the configuration file
the redis.conf
Partially modified as follows
the bind   0.0 . 0.0      can specify that all addresses are accessible, if you specify the corresponding IP network or can be modified here
daemonize yes on the background of the implementation of the proposed changes to yes
the PidFile / the Data / Redis / redis6379 / redis_6379.pid specified pid file directory and file name
logfile " /data/redis/redis6379/redis6379.log " specified log file directory and file name 

# other parameters can be adjusted in a production environment

# start Redis
Redis-Server redis.conf

 

Note:

a) If the dependencies are not installed, the following error

Fake Fredis
cd hiredis && make static
make[3]: Entering directory `/usr/local/redis-4.0.14/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-4.0.14/deps/hiredis'
make[2]: *** [hiredis] Error 2
make[2]: Leaving directory `/usr/local/redis-4.0.14/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-4.0.14/src'
make: *** [all] Error 2

I.e. processing method according to the first step in the installation dependencies

When there are mistakes 2) make the process

cd src && make all
make[1]: Entering directory `/usr/local/redis-4.0.14/src'
    CC Makefile.dep
make[1]: Leaving directory `/usr/local/redis-4.0.14/src'
make[1]: Entering directory `/usr/local/redis-4.0.14/src'
    CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/usr/local/redis-4.0.14/src'
make: *** [all] Error 2

Approach:

deps cd /
  make hiredis jemalloc linenoise Lua geohash- int

After then you can make && make install

 

c) Important

Redis usually because no password, and the situation appeared to break through after the 6379 host port or mining and other malicious attacks, it is not recommended to use the root account to start redis

It is proposed to create a separate account and start redis redis with the general account

 

Guess you like

Origin www.cnblogs.com/gjc592/p/11098047.html