安装全部过程:
首先电脑需要安装gcc编译器,作用是编译redis代码实现安装
linux电脑安装文件的下载的位置一般选择根目录下面的/opt文件
[root@localhost opt]# wget http://download.redis.io/releases/redis-3.2.11.tar.gz
--2017-12-28 07:28:03-- http://download.redis.io/releases/redis-3.2.11.tar.gz
Resolving download.redis.io (download.redis.io)... 109.74.203.151
Connecting to download.redis.io (download.redis.io)|109.74.203.151|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1550452 (1.5M) [application/x-gzip]
Saving to: ‘redis-3.2.11.tar.gz’
100%[=====================================================================================================================================================>] 1,550,452 180KB/s in 17s
2017-12-28 07:28:23 (91.7 KB/s) - ‘redis-3.2.11.tar.gz’ saved [1550452/1550452]
安装gcc: 安装执行过程中不要执行任何操作
[root@localhost opt]# yum install gcc
Dependencies Resolved
===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
gcc x86_64 4.8.5-16.el7_4.1 updates 16 M
Installing for dependencies:
cpp x86_64 4.8.5-16.el7_4.1 updates 5.9 M
glibc-devel x86_64 2.17-196.el7_4.2 updates 1.1 M
glibc-headers x86_64 2.17-196.el7_4.2 updates 676 k
kernel-headers x86_64 3.10.0-693.11.1.el7 updates 6.0 M
libmpc x86_64 1.0.1-3.el7 base 51 k
Updating for dependencies:
glibc x86_64 2.17-196.el7_4.2 updates 3.6 M
glibc-common x86_64 2.17-196.el7_4.2 updates 11 M
libgcc x86_64 4.8.5-16.el7_4.1 updates 98 k
libgomp x86_64 4.8.5-16.el7_4.1 updates 154 k
Transaction Summary
===============================================================================================================================================================================================
Install 1 Package (+5 Dependent packages)
Upgrade ( 4 Dependent packages)
Total size: 45 M
Total download size: 30 M
Is this ok [y/d/N]:
安装完成显示:
Installed:
gcc.x86_64 0:4.8.5-16.el7_4.1
Dependency Installed:
cpp.x86_64 0:4.8.5-16.el7_4.1 glibc-devel.x86_64 0:2.17-196.el7_4.2 glibc-headers.x86_64 0:2.17-196.el7_4.2 kernel-headers.x86_64 0:3.10.0-693.11.1.el7 libmpc.x86_64 0:1.0.1-3.el7
Dependency Updated:
glibc.x86_64 0:2.17-196.el7_4.2 glibc-common.x86_64 0:2.17-196.el7_4.2 libgcc.x86_64 0:4.8.5-16.el7_4.1 libgomp.x86_64 0:4.8.5-16.el7_4.1
Complete!
解压文件
tar -zxvf redis-3.2.11.tar.gz
安装文件并删除压缩包
rm -rf redis-3.2.11.tar.gz
[root@localhost opt]# cd redis-3.2.11/
[root@localhost redis-3.2.11]# ll
total 204
-rw-rw-r--. 1 root root 92766 Sep 21 10:20 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 Sep 21 10:20 BUGS
-rw-rw-r--. 1 root root 1805 Sep 21 10:20 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 Sep 21 10:20 COPYING
drwxrwxr-x. 7 root root 143 Sep 21 10:20 deps
-rw-rw-r--. 1 root root 11 Sep 21 10:20 INSTALL
-rw-rw-r--. 1 root root 151 Sep 21 10:20 Makefile
-rw-rw-r--. 1 root root 4223 Sep 21 10:20 MANIFESTO
-rw-rw-r--. 1 root root 6834 Sep 21 10:20 README.md
-rw-rw-r--. 1 root root 46695 Sep 21 10:20 redis.conf
-rwxrwxr-x. 1 root root 271 Sep 21 10:20 runtest
-rwxrwxr-x. 1 root root 280 Sep 21 10:20 runtest-cluster
-rwxrwxr-x. 1 root root 281 Sep 21 10:20 runtest-sentinel
-rw-rw-r--. 1 root root 7606 Sep 21 10:20 sentinel.conf
drwxrwxr-x. 2 root root 4096 Sep 21 10:20 src
drwxrwxr-x. 10 root root 167 Sep 21 10:20 tests
drwxrwxr-x. 7 root root 4096 Sep 21 10:20 utils
[root@localhost redis-3.2.11]#make
拷贝新的一份配置文件,执行redis-server时执修改的配置
[root@localhost redis-3.2.11]# cd /
[root@localhost /]# mkdir /myredis
[root@localhost /]# cp /opt/r
redis-3.2.11/ rh/
[root@localhost /]# cp /opt/redis-3.2.11/redis.conf /myredis/
[root@localhost /]#
修改属于自己的拷贝的配置文件
################################# GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
安装完成之后测试运行服务,运行客户端进行测试:
进入src目录下面运行服务命令
[root@localhost src]# redis-
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
[root@localhost src]# redis-se
redis-sentinel redis-server
[root@localhost src]# redis-se
redis-sentinel redis-server
[root@localhost src]# redis-server /myredis/redis.conf
[root@localhost src]# red
red redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
[root@localhost src]# redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
运行命令之后,使用自己配置的新的创建的文件
输入测试命令ping 收到pong回答安装成功
备注:直接修改原生位置的redis.config也是可以的,这里选择重新拷贝一份的原因是保证在自己开发过程中如果配置修改错误的话可以保留原生
安装过程中首先查看电脑上是否安装了gcc编译器
查看电脑是否安装了某个gcc的命令:
[root@localhost ~]# yum list gcc
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Installed Packages
gcc.x86_64 4.8.5-16.el7_4.1 @updates
[root@localhost ~]#