Installation remember once linux redis, set redis service, and add environment variables

A. Redis installation

  cd / opt # opt to switch to the directory

  wget http://download.redis.io/releases/redis-3.2.9.tar.gz # specified version Download redis

  tar xzf redis-3.2.9.tar.gz # decompress, get a redis-3.2.9 directory

  cd redis-3.2.9 directory after the files are decompressed in #

  make # compile

  src / redis-server redis.conf # After compilation perform this command to start the redis

  As given above can be solved using the following command at make, depending on the type of error, Package install the following:

  yum install -y gcc
  yum install -y tcl

II. Adding Environment Variables

  vim ~ / .bash_profile # .bash_profile is a hidden file, custom environment variables in the file

  The following is the .bash_profile last two lines: 

  The PATH = $ the PATH: $ the HOME / bin : /opt/redis-3.2.9/src   # src directory path to add here

  export PATH

  : Wq # editing is complete save and exit

  source ~ / .bash_profile # configure the environment variables take effect immediately

  -h-cli Redis 127.0. 0. 1 -p 6378 # specified ip and port links redis, default 6379

  Thus, to use redis-server command, and redis-cli to operate in any position of redis

  If you need to specify the configuration file to start the switch to the directory where the file to execute redis.conf

Three settings redis service:

  cd after redis unpack directory /opt/redis-3.2.9 # in, redis.conf files in this directory

  cp redis.conf redis.conf.back # redis.conf backup file, this step may not be performed

  vim redis.conf # edit redis.conf file

  The following is redis.conf file contents:

  daemonize yes # modify the original value no to yes, as a daemon to configure redis

  # Bind 127.0.0.1 # comment out this line so that redis remote link

  

  

Guess you like

Origin www.cnblogs.com/quzq/p/11078203.html