Linux安装redis tar.gz

下载 redis wget https://download.redis.io/releases/redis-6.0.16.tar.gz

解压 sudo tar xvf redis-6.0.16.tar.gz

编译安装redis

  sudo make PREFIX=/home/redis/redis6.0/ all

  sudo make PREFIX=/home/redis/redis6.0/ install 

  安装失败可尝试make distclean 清除安装残留文件

systemctl添加redis.service

sudo vi /lib/systemd/system/redis.service

[Unit]

Description=redis

After=network.target

[Service]

Type=forking

ExecStart=/home/redis/redis6.0/bin/redis-server /home/redis/redis6.0/conf/redis.conf

ExecReload=/home/redis/redis6.0/bin/redis-server -s reload

ExecStop=/home/redis/redis6.0/bin/redis-server -s stop

PrivateTmp=true

[Install]

WantedBy=multi-user.target

刷新配置

  systemctl daemon-reload

设置开机启用

  systemctl enable redis.service

 

添加环境变量

sudo gedit /etc/environment

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:$JAVA_HOME/bin:$MAVEN_HOME/bin:$MYSQL_HOME/bin:$GIT_HOME/bin:$REDIS_HOME/bin"

export JAVA_HOME=/home/java/jdk1.8.0_251
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export MAVEN_HOME=/home/maven/apache-maven-3.6.3
export MYSQL_HOME=/home/mysql/mysql-8.0.20
export GIT_HOME=/home/git/app/git-2.34.0
export REDIS_HOME=/home/redis/redis6.0

source /etc/environment

posted @ 2021-11-23 23:01  xing柠檬  阅读(417)  评论(0编辑  收藏  举报