赞
踩
yum install wget
Linux下载wget 命令wget https://download.redis.io/releases/redis-6.2.6.tar.gz
解压之后进入redis…, 一般现在软件安装什么,可以直接看 readme
比如可以告诉你可以如何编译
如果编译出错了也可以使用make distclean
也可以告诉你如何启动redis
默认redis 配置文件安装路径
报错gcc, 可以安装
yum install gcc
在使用make distclean
清除安装失败
安装成功可以看到 make test
make install PREFIX=/opt/redis6
这一步的目的是将可执行程序迁出,不在和源码混在一起
install_server.sh
vim /etc/profile
source /etc/profile
刷新配置文件,看下配置路径是否正确echo $PATH
./install_server.sh
提示报错,这个程序似乎使用systemd This systems seems to use systemd.
修改 install_server.sh 文件,找到下列并注释掉该提示
#bail if this system is managed by systemd
_pid_1_exe="$(readlink -f /proc/1/exe)"
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
注释之后重新运行,一直回车就行,该默认并会添加到开机启动
stackoverflow
解决地址:ttps://stackoverflow.com/questions/61694459/installing-redis-use-install-server-sh
Welcome to the redis service installer # 这句话意思是一台物理既可以跑多台redis 靠端口号区分 This script will help you easily set up a running redis server #选择端口号 16379 Please select the redis port for this instance: [6379] 16379 # 16379配置文件放在哪里 Please select the redis config file name [/etc/redis/16379.conf] Selected default - /etc/redis/16379.conf # redis_16379 日志文件放在哪里 Please select the redis log file name [/var/log/redis_16379.log] Selected default - /var/log/redis_16379.log # redis_16379 数据存放在哪里,磁盘目录存储数据,持久化问题 Please select the data directory for this instance [/var/lib/redis/16379] Selected default - /var/lib/redis/16379 # 可执行程序路径,因为上面在config里面配置,所以知道该路径 Please select the redis executable path [/opt/redis6/bin/redis-server] Selected config: Port : 16379 Config file : /etc/redis/16379.conf Log file : /var/log/redis_16379.log Data dir : /var/lib/redis/16379 Executable : /opt/redis6/bin/redis-server Cli Executable : /opt/redis6/bin/redis-cli Is this ok? Then press ENTER to go on or Ctrl-C to abort. # 拷贝临时目录到系统文件中 Copied /tmp/16379.conf => /etc/init.d/redis_16379 # 装机到服务 Installing service... # 开机启动 Successfully added to chkconfig! Successfully added to runlevels 345! Starting Redis server... Installation successful!
可以看到目录下有个 redis_16379 脚本
redis-cli -p 16379
默认 redis-cli 启动进入639
config set requirepass XXXX
#进入redis 设置
config set requirepass 123456
# 获取密码
config get requirepass
# 登录
auth 123456
找到安装cofing /etc/redis/16379.conf
设置完密码之后,每次重启redis 都需要redis -a 123456 stop
可以设置init.d
下面我们安装的redis6379
vi /etc/init.d/redis
$CLIEXEC -a "youpassword" -p $REDISPORT shutdown
也可以使用
vim /etc/init.d/redis_6379
RESDISPASSWORD=“123456”
在下面stop 下加-a
$CLIEXEC -a $RESDISPASSWORD -p $REDISPORT shutdown
将bind 注释 找到安装cofing /etc/redis/16379.conf
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。