Install only Redis Redis automatic installation scripts

Source: Internet
Author: User
Tags exit echo info gz file redis install redis egrep

Redis Automatic Installation Deployment

This article is divided into 4 parts:

Redis automatic Installation script directory structure description;

Redis automatically install script content;

Redis Operating system service script description;

The data link address referenced in this article.

Note: This article does not cover the contents of the Redis memory allocator section.

First part

Redis automatic Installation script directory structure Description:

# ls View the current directory contains the following 3 files

--install_redis.sh # Redis Automatic installation script

--Redis-2.8.9.tar.gz # Redis installation package (required Make,make test,make install)

--Redis_service_script # Redis Operating system service script (for configuring the Redis service to boot from, and Redis Service management commands)

Part II

########################## #redis自动安装脚本内容开始 (install_redis.sh) ######################

#!/bin/bash # version:v1.0 by Jiangyanguo in 2014-05-14 # Desc:auto make, make install and configure Redis Redis_conf= "/etc/redis.conf" # Check if the Redis installation package exists if [' ls redis-*.tar.gz >/dev/null 2>&1;
    echo $? ' "-ne 0] then echo" error:redis*.tar.gz file doesn ' t exists. " Exit Else redis_package= "' Ls-ltr redis-*.tar.gz | head-1 |
    
awk ' {print $NF} ' "Fi # Install Redis,make,make test,make Install # Install Redis echo info:install redis ..." Tar zxf ${redis_package} redis_dir= "' ls-ltr | Egrep ' ^d ' | awk ' {print $NF} ' ' CD ${redis_dir} pwd make to test if [$?-nt 0];then Echo Some depend
  ENT packages are needed. "
    
Exit fi make install echo "Info:set ${redis_conf} ..." CD ...  # Set Redis configuration file, the data directory is/home/redis # set/etc/redis.conf CP redis.conf/etc/sed-i ' s/^daemonize (. *)/#daemonize \1/g ' ${redis_conf} sed-i ' 2 adaemonize yes ' ${redis_conf} sed-i ' S/^dir (. *)/#dir \1/g ' ${redis_conf} sed-i ' 2 Adir \/home\/redis\/' ${redis_conf} # Set memory allocate method [' Egrep ' Vm.overcommit_memory=1 '/etc/sysctl.conf | Wc-l ' "-eq 0] && echo" Vm.overcommit_memory=1 ">>/etc/sysctl.conf/sbin/sysctl-p # Add Redis user U Seradd Redis # Set Redis data dir mkdir-p/home/redis/chown-r Redis.redis/home/redis #设置redis服务开机自启动, is also Redis Management Services # Set Redis service echo "Info:set Redis service ..." CP Redis_service_script/etc/init.d/redis chmod +x/etc/init. D/redis chkconfig--add Redis chkconfig redis on # echo Info:finish installing. "Echo"

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.