ubuntu22.04 arrch64版在线安装redis

脚本

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
echo  "deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get install sysv-rc-conf

sudo apt-get install -y gcc  pkg-config build-essential 


if type -p redis-server; then
        echo "redis has been installed."
    else
        #安装依赖
        yum install cpp binutils glibc-kernheaders glibc-common glibc-devel gcc make wget -y
        #解压并安装
        wget http://download.redis.io/releases/redis-7.0.5.tar.gz
        tar zxvf redis-7.0.5.tar.gz
        rm -rf /usr/local/redis-7.0.5
        cp -r redis-7.0.5 /usr/local/
        cd /usr/local/redis-7.0.5 && make && make install
        #修改配置文件
        sed -i '309s/daemonize no/daemonize yes/' /usr/local/redis-7.0.5/redis.conf 
        sed -i '87s/bind 127.0.0.1 -::1/#bind 127.0.0.1 -::1/' /usr/local/redis-7.0.5/redis.conf 
        sed -i '111s/protected-mode yes/protected-mode no/' /usr/local/redis-7.0.5/redis.conf
        #设置密码
        sed -i '1036s/# requirepass foobared/requirepass Zenglg2012!@#/' /usr/local/redis-7.0.5/redis.conf
        #创建文件
        mkdir -p /etc/redis
        chmod -R 777 /etc/redis
        #(在默认的配置文件路劲中放置配置文件)
        rm -rf /etc/redis/6379.conf 
        cp -r /usr/local/redis-7.0.5/redis.conf /etc/redis/
        chmod -R 777 /etc/redis/redis.conf
        #修改文件名
        mv /etc/redis/redis.conf /etc/redis/6379.conf
        rm -rf /etc/init.d/redisd
        #添加配置密码验证,解决无法关闭redis服务问题
        sed -i 17c'\$CLIEXEC -a "Zenglg2012!@#" -p \$REDISPORT shutdown' /usr/local/redis-7.0.5/utils/redis_init_script
        cp -r /usr/local/redis-7.0.5/utils/redis_init_script /etc/init.d/
        #修改文件名
        mv /etc/init.d/redis_init_script /etc/init.d/redisd
        #设置开机自启,linux下需要使用这个命令
        sudo update-rc.d redisd defaults
        echo "Redis 部署完成!"
    fi


rm -rf ./tmp.log
systemctl status redisd  > ./tmp.log
if cat tmp.log |grep "running"
then
    echo -e "\033[32m redisd服务已经启动! \033[0m"
else
    echo -e "\033[31m redisd服务未安装! \033[0m"
fi

编译过程

ubuntu22.04 arrch64版在线安装redis_第1张图片

出现下图说明安装成功

ubuntu22.04 arrch64版在线安装redis_第2张图片

针对该服务器系统的说明

参考链接

https://www.cnblogs.com/juanxincai/p/16480501.html

ubuntu22.04 arrch64版在线安装redis_第3张图片

你可能感兴趣的:(bootstrap,前端,html)