将Centos的yum源更换为国内的163源redis
备份你的原镜像文件,保证出错后能够恢复:vim
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup缓存
下载新的CentOS-Base.repo
到/etc/yum.repos.d/
ui
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/...code
生成缓存server
yum clean all
yum makecache进程
yum install redisip
systemctl start redis.serviceget
systemctl enable redis.servicerequire
vim /etc/redis.conf
//开启守护进程
将daemonize yes 改成daemonize yes
//将运行的ip设置为全部
将bind 127.0.0.1 改成bind 0.0.0.0
//运行公网访问redis
将protected-mode yes 改成protected-mode yes
注: 可使用?直接进行搜索关键字
打开文件/etc/redis.conf
,找到其中的# requirepass foobared
,去掉前面的#
,并把foobared
改为你的密码。
redis.conf
文件默认在/etc
目录下,你能够更改它的位置和名字,更改后,注意在文件/usr/lib/systemd/system/redis.service
中,把ExecStart=/usr/bin/redis-server /etc/redis/6379.conf --daemonize no
中的redis.conf
的路径改为的新的路径。