**1.install_server.sh脚本** 安装完Redis后,在utils目录下会生成一个install_server.sh的脚本 编辑该文件,将下面内容注释: ![](https://img.kancloud.cn/2b/52/2b528c6b82a7c7dd2af592cd106ff0df_805x171.png) 搜索systemd,找到下面内容,将if判断注释: ```asp #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 ``` **2.运行install_server.sh脚本**: ```asp sudo ./install_server.sh ``` 注意运行后的提示,各个路径是否正确,如果路径没问题,每条提示输入回车确认,最终输出类似如下: ```asp 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/bin/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/bin/redis-server Cli Executable : /usr/local/bin/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... Success! Starting Redis server... Installation successful! ``` **3.测试命令** 启动Redis: ```asp service redis start ``` 查看redis进程: ```asp ps -ef | grep redis ``` 停止Redis: ```asp service redis stop ```