1. centos默认的安装源在官方centos.org上,而Redis在第三方的yum源里,所以无法安装,非官方的yum推荐用fedora的epel仓库
[root@localhost install]# yum install redis
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
* base: mirrors.skyshe.cn
* extras: mirrors.163.com
* updates: mirrors.pubyun.com
base | 3.7 kB 00:00
extras | 2.9 kB 00:00
updates | 3.4 kB 00:00
No package redis available.
Error: Nothing to do
首先为yum添加epel源:yum install epel-release回车
yum install epel-release
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.skyshe.cn
* extras: mirrors.163.com
* updates: mirrors.pubyun.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
service redis start 启动
chkconfig redis on 设置开机执行redis脚本
将这个文件设置成可执行文件
chmod 755 redis
chown root:root redis
开启端口
/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT 写入修改
/etc/init.d/iptables save 保存修改
service iptables restart 重启防火墙,修改生效
测试redis
[root@Architect redis-1.2.6]# redis-cli
redis> set name songbin
OK
redis> get name
"songbin"
telnet不能用!!!提示:-bash: telnet: command not found
1、[root@localhost ~]# telnet
bash: telnet: command not found
2、 查询了是否安装Telnet包,结果如下:
[root@localhost ~]# rpm -qa telnet*
telnet-server-0.17-47.el6.i686
3、又查询了xinetd的状态:
[root@localhost ~]# service xinetd status
xinetd (pid 2967) 正在运行...
4、使用ntsysv命令,开启了Telnet服务;同时,也查看 /etc/xinetd.d/telnet 文件,将将“disable = yes” 改为“disable = no”;也重启了服务 [root@CentOS5 /]#service xinetd restart
在系统服务里面,也查看过,telnet服务和xinetd也都是工作状态。
解决方式,重装一下telnet客户端。
centos、ubuntu
yum list telnet* 查看telnet相关的安装包
yum install telnet-server 安装telnet服务
yum install telnet.* 安装telnet客户端
安装telnet 后,root登录时总是提示 login incorrect
方法:使用mv备份的方式删除“/etc/securetty”文件
[root@secDB ~]# mv /etc/securetty /etc/securetty.bak
JedisConnectionException: Java.NET.ConnectException: Connection refused: connect
解决如下:Redis的配置文件redis.conf里bind 127.0.0.1 注释掉。
band localhost 只能本机访问,局域网内计算机不能访问
自定义安装方法
Tar zxvf redis-2.8.18.tar.gz
cd redis-2.8.18
yum install gcc tcl –y
make
mkdir –p /usr/local/redis
make PREFIX= /usr/local/redis install
cd redis-2.8.18/src
cp redis-sentinel /usr/local/redis/bin
vim ~/.base_profile
export REDIS_HOME=/usr/local/redis
export PATH=$PATH:$REDIS_HOME/bin
source ~/.bash_profile
redis-server –help
file redis-sentienl
二进制可执行文件
做成后台daemon
cd redis-2.8.18/utils/
./install server.sh
把编译好的redis作为一个服务,把6379.conf放到/etc/init.d/redis_6379
cd /etc/init.d
mv redis_6379 redisd
(chkconfig --add redisd)
service redisd start
ss –tanl
redis-cli --help
vim /etc/redis/6379.conf
redis-cli
redis-cli -n 0
set mykey 123
get mykey
卸载一个软件时
yum -y remove httpd