当前位置:网站首页>Linux下Redis的安装
Linux下Redis的安装
2022-06-27 08:06:00 【小月亮6】
一、安装gcc环境
由于redis是由C语言编写的,它的运行需要C环境,因此我们需要先安装gcc。安装命令如下:
[[email protected]_SW_5748F_1 local]# yum install gcc-c++
查看是否安装成功
[[email protected]_SW_5748F_1 local]# gcc -v
二、下载Redis安装包
用wget直接在linux环境下下载, // wget 是一个从网络上自动下载文件的自由工具
[[email protected]_SW_5748F_1 lhl]# wget http://download.redis.io/releases/redis-4.0.1.tar.gz
[[email protected]_SW_5748F_1 lhl]# pwd
/lhl
[[email protected]_SW_5748F_1 lhl]# ls
redis-4.0.1.tar.gz
三、解压安装
[[email protected]_SW_5748F_1 lhl]# tar -zvxf redis-4.0.1.tar.gz //进行解压
[[email protected]_SW_5748F_1 lhl]# ls
redis-4.0.1 redis-4.0.1.tar.gz
[[email protected]_SW_5748F_1 lhl]# cd redis-4.0.1
[[email protected]_SW_5748F_1 redis-4.0.1]# ls
00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-sentinel sentinel.conf src tests utils
[[email protected]_SW_5748F_1 redis-4.0.1]# make //对解压后的文件进行编译
[[email protected]_SW_5748F_1 redis-4.0.1]# make install //对Redis进行安装
安装成功如下
[[email protected]_SW_5748F_1 redis-4.0.1]# make install
cd src && make install
make[1]: 进入目录“/lhl/redis-4.0.1/src”
CC Makefile.dep
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: 离开目录“/lhl/redis-4.0.1/src”
四、启动Redis
[[email protected]_SW_5748F_1 redis-4.0.1]# cd src
[[email protected]_SW_5748F_1 src]# ls
redis-cli redis-server //会看到redis一些配置启动文件,这里只复制了两个
[[email protected]_SW_5748F_1 src]# redis-server
[[email protected]_SW_5748F_1 src]# redis-server
11981:C 30 Mar 22:08:43.224 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
11981:C 30 Mar 22:08:43.224 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=11981, just started
11981:C 30 Mar 22:08:43.224 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
11981:M 30 Mar 22:08:43.225 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.1 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 11981
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
11981:M 30 Mar 22:08:43.227 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
11981:M 30 Mar 22:08:43.227 # Server initialized
五、连接Redis
因为不是在后台运行,所以需要重新创建一个窗口连接
[[email protected]_SW_5748F_1 src]# redis-cli -p 6379
[[email protected]_SW_5748F_1 src]# redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> get k1
"v1"
127.0.0.1:6379> shutdown //退出
not connected> exit
[[email protected]_SW_5748F_1 src]# 六、配置Redis(让Redis在后台运行,其实是守护线程)
[[email protected]_SW_5748F_1 redis-4.0.1]# mkdir /usr/config //创建config文件夹
[[email protected]_SW_5748F_1 redis-4.0.1]# cp redis.conf /usr/config //复制redis.conf到 /usr/config文件夹
[[email protected]_SW_5748F_1 redis-4.0.1]# cd /usr/config
修改redis.conf文件
[[email protected]_SW_5748F_1 config]# vim redis.conf //daemonize no改成yes

七、再次启动redis
[[email protected]_SW_5748F_1 src]# redis-server /usr/config/redis.conf //启动redis并且指定配置文件 回到redis-server所在的目录
[[email protected]_SW_5748F_1 src]# ps -ef|grep redis //查看redis进程是否存在
[[email protected]_SW_5748F_1 src]# redis-server /usr/config/redis.conf
12367:C 30 Mar 22:41:27.556 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
12367:C 30 Mar 22:41:27.556 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=12367, just started
12367:C 30 Mar 22:41:27.556 # Configuration loaded
[[email protected]_SW_5748F_1 src]# ps -ef|grep redis
root 12368 1 0 22:41 ? 00:00:00 redis-server 127.0.0.1:6379
root 12373 7913 0 22:41 pts/0 00:00:00 grep --color=auto redis
[[email protected]_SW_5748F_1 src]#
成功完成,有问题可以问我
边栏推荐
- PayPal account has been massively frozen! How can cross-border sellers help themselves?
- 淘宝虚拟产品开店教程之作图篇
- All tutor information on one page
- Implementation of game hexagon map
- SPARQL basic introductory exercise
- [10. difference]
- (原创)自定义Drawable
- (笔记)Anaconda-Navigator闪退解决方法
- Programming life - what do you think of the 35 year old bottleneck of programmers?
- lvgl 说明3关于lvgl guider的使用
猜你喜欢

Preliminary understanding of C #

无论LCD和OLED显示技术有多好,都无法替代这个古老的显示数码管

JS use switch to output whether the result is qualified

淘宝虚拟产品开店教程之作图篇

js判断用户输入的数是否为质数(多种方法)

洛谷刷题心得记录

2. QT components used in the project

What is a magnetic separator?

Game asset reuse: a new way to find required game assets faster

JS print 99 multiplication table
随机推荐
JS print 99 multiplication table
游戏六边形地图的实现
Online text digit recognition list summation tool
JS EventListener
[notes on c++ primer] Chapter 3 string, vector and array
Zabbix部署说明(Server+Win客户端+交换机(H3C))
PayPal account has been massively frozen! How can cross-border sellers help themselves?
js中输入三个值,并且由小到大输出
游戏资产复用:更快找到所需游戏资产的新方法
闭包问题
Import and export database related tables from the win command line
[12. maximum continuous non repeating subsequence]
Error in idea connection database
Ready to migrate to the cloud? Please accept this list of migration steps
(笔记)Anaconda-Navigator闪退解决方法
Remote connection raspberry pie in VNC Viewer Mode
Ue5 magic power - POI solution
Mobile security tools -jad
八大误区,逐个击破(终篇):云难以扩展、定制性差,还会让管理员失去控制权?
Programming life - what do you think of the 35 year old bottleneck of programmers?