centos7.6 安装redis5.0.4 单机

centos7.6 安装redis5.0.4

查看列表
http://download.redis.io/releases/

目前最新版稳定版为5.0.6

[ ] redis-5.0.6.tar.gz

[[email protected]_147_31_centos src]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[[email protected]_147_31_centos src]# uname -a
Linux VM_147_31_centos 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[[email protected]_147_31_centos src]#

创建目录
mkdir /home/redis

进入目录
cd /home/redis/

下载redis
wget http://download.redis.io/releases/redis-5.0.4.tar.gz
编译

解压redis:
tar -xvf redis-5.0.4.tar.gz

编译redis(腾讯的试验环境已经安装了GCC所以可以直接编译):
进入redis解压目录
cd redis-5.0.4/

编译
make

安装

用 make 安装 redis
make install PREFIX=/usr/local/mysoft/redis

后面是你自己的安装路径。PREFIX参数指定redis的安装目录。一般软件安装到/usr目录下
[[email protected]_147_31_centos redis-5.0.4]# ll /usr/local/mysoft/redis/
total 4
drwxr-xr-x 2 root root 4096 Nov 13 17:53 bin
[[email protected]_147_31_centos redis-5.0.4]# ll /usr/local/mysoft/redis/bin/
total 32700
-rwxr-xr-x 1 root root 4366640 Nov 13 17:53 redis-benchmark
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-aof
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-rdb
-rwxr-xr-x 1 root root 4806872 Nov 13 17:53 redis-cli
lrwxrwxrwx 1 root root 12 Nov 13 17:53 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-server
[[email protected]_147_31_centos redis-5.0.4]#

修改配置
文件由于安装目录仅仅是二进制文件,不包含配置文件,这里我们要把编译目录的配置文件拷贝过来,我们先进入到安装目录, cd /usr/local/mysoft/redis 拷贝配置文件,顺便命名为 single.conf

cp /home/redis/redis-5.0.4/redis.conf single.conf
修改配置文件,把 redis 启动改成后台启动

编辑 /home/redis/redis-5.0.4/single.conf

键入 ctrl+F 进行搜索,找到 daemonize no,把 no 改为 yes ,键入 ctrl+S 保存即可。

[[email protected]_147_31_centos redis-5.0.4]# cp /home/redis/redis-5.0.4/redis.conf single.conf
[[email protected]_147_31_centos redis-5.0.4]# vi /home/redis/redis-5.0.4/single.conf
[[email protected]_147_31_centos redis-5.0.4]#
[[email protected]_147_31_centos redis-5.0.4]# grep daemonize /home/redis/redis-5.0.4/single.conf
#Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
#When the server runs non daemonized, no pid file is created if none is
#specified in the configuration. When the server is daemonized, the pid file
output for logging but daemonize, logs will be sent to /dev/null
[[email protected]_147_31_centos redis-5.0.4]# pwd
/home/redis/redis-5.0.4
[[email protected]_147_31_centos redis-5.0.4]#

启动 redis-server
cd src

./redis-server ../single.conf

查看redis是否正常启动
ps aux|grep redis

[[email protected]_147_31_centos redis-5.0.4]# cd src
[[email protected]_147_31_centos src]# ./redis-server ../single.conf
28677:C 13 Nov 2019 17:56:42.855 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28677:C 13 Nov 2019 17:56:42.855 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=28677, just started
28677:C 13 Nov 2019 17:56:42.855 # Configuration loaded
[[email protected]_147_31_centos src]# ps -ef | grep redis
root 28678 1 0 17:56 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 28700 22792 0 17:56 pts/0 00:00:00 grep --color=auto redis
[[email protected]_147_31_centos src]#

测试试验

使用 redis-cli 客户端连接本机 redis
./redis-cli -h 127.0.0.1 -p 6379
设值
set test 123456
获取值
get test

[[email protected]_147_31_centos src]# ./redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> set test 123456docker19.3
OK
127.0.0.1:6379> get test
"123456docker19.3"
127.0.0.1:6379> exit
[[email protected]_147_31_centos src]#

[[email protected]_147_31_centos bin]# pwd
/usr/local/mysoft/redis/bin
[[email protected]_147_31_centos bin]# ll
total 32700
-rwxr-xr-x 1 root root 4366640 Nov 13 17:53 redis-benchmark
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-aof
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-rdb
-rwxr-xr-x 1 root root 4806872 Nov 13 17:53 redis-cli
lrwxrwxrwx 1 root root 12 Nov 13 17:53 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-server
[[email protected]_147_31_centos bin]# ./redis-cli -v
redis-cli 5.0.4
[[email protected]_147_31_centos bin]#

原文地址:https://blog.51cto.com/guanhaizhan/2450086

时间: 2024-11-08 06:39:33

centos7.6 安装redis5.0.4 单机的相关文章

CentOS7中安装redis5.0

1. 环境介绍 CentOS7 (未安装Development Tools) 2. 下载Redis5.0-rc3 wget -O redis-5.0-rc3.tar.gz https://github.com/antirez/redis/archive/5.0-rc3.tar.gz 3. 解压redis tar -zxvf redis-5.0-rc3.tar.gz -C /usr/local 4. 编译并安装 cd /usr/local/redis-5.0-rc3 make 此时会出错: com

centos7抢先安装docker1.0

1.关闭selinux [[email protected] ~]#setenforce 0 2.安装 Fedora EPEL [[email protected] ~]#yum install -y http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm 3.安装docker [[email protected] ~]#yum install -y docker-io [[email protecte

Centos7.2安装zabbix3.0

Centos7.2YUM安装zabbix3.0 防火墙和selinux关闭,这个我就不说了. 1.启动apache yum -y install httpd systemctl start httpd.service systemctl enable httpd.service systemctl status httpd.service 2. 启动mariadb yum install mariadb mariadb-server -y systemctl start mariadb syst

CentOS6.10安装redis5.0

1.以安装redis5.0.0为例 下载安装包:http://redis.io 安装非常简单! [[email protected] ~]#yum install gcc #需要先安装GCC,如果已安装请忽略 [root@centos6 ~]tar zxvf redis-5.0.0.tar.gz -C /usr/local #解压 [[email protected] ~]cd /usr/local/redis-5.0.0 #进入解压后的文件夹 [[email protected] redis5

centos7安装redis-5.0

wget http://download.redis.io/releases/redis-5.0.5.tar.gztar -xf redis-5.0.5.tar.gzcd redis-5.0.5make installlINSTALL installINSTALL installINSTALL installINSTALL installINSTALL installmake[1]: Leaving directory `/usr/local/src/redis-5.0.5/src'将redis

centos7.3安装php7.0

需求:在Centos7.3下搭建LNMP环境 文章转载自:http://blog.csdn.net/wszll_alex/article/details/76285324 作者:狂热森林 1. 关闭防火墙和selinux 打开文件selinux vim /etc/sysconfig/selinux 将文件中SELINUX=enforcing改为disabled,然后执行"setenforce 0″不用重启地关闭selinux. SELINUX=disabled 关闭放火墙 systemctl s

centos7.3 安装redis-4.0.7

centos7安装redis-4.0.7 解压 tar xvf redis-4.0.7.tar.gz -C /usr/local/src 编译 cd /usr/local/src/redis-4.0.7/ make PREFIX=/usr/local/redis install 准备 mkdir /usr/local/redis/{log,data,conf} cat /usr/local/redis/conf/redis.conf daemonize yes bind 0.0.0.0 #log

【Zabbix】在CentOS7上安装Zabbix3.0

Zabbix安装 首先说明一下,本文主要参考了[http://www.linuxidc.com/Linux/2016-11/137030.htm]和[http://www.cnblogs.com/XYJK1002/p/5324293.html]两篇文章.在两者的基础上做了些小总结和小错误的修正(当然也可能不是错误,只是因为一些环境或其他原因而不同的操作而已). 一直想给测试环境也装一套Zabbix用来监控,这次刚好为了修复之前的SQL注入的漏洞,首先在自己的虚拟机上练一练手.令人高兴的是,安装过

Centos7.6安装mysql8.0

一. yum安装步骤1.Centos7.6 默认安装了mariadb数据库,这里把他移除:rpm -qa | grep mariadbrpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64 2.添加MySQL Yum存储库wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpmrpm -Uvh mysql80-community-release-el7-3.noarch.