自学内容网 自学内容网

、Redis 安装

Redis 安装

Redis 下载链接

[root@iZhp3i77hpofuqqxvoc790Z ~]# mkdir redis
[root@iZhp3i77hpofuqqxvoc790Z ~]# ll
总用量 4
drwxr-xr-x 2 root root 4096 108 15:23 redis
[root@iZhp3i77hpofuqqxvoc790Z ~]# cd redis/
# 将 redis 安装包上传至当前目录下
# 解压当前文件夹 
[root@iZhp3i77hpofuqqxvoc790Z redis]# tar xzvf redis-5.0.4.tar.gz 
redis-5.0.4/
redis-5.0.4/.gitignore
redis-5.0.4/00-RELEASENOTES
redis-5.0.4/BUGS
# ....... 中间就省略了
redis-5.0.4/utils/releasetools/02_upload_tarball.sh
redis-5.0.4/utils/releasetools/03_test_release.sh
redis-5.0.4/utils/releasetools/04_release_hash.sh
redis-5.0.4/utils/releasetools/changelog.tcl
redis-5.0.4/utils/speed-regression.tcl
redis-5.0.4/utils/whatisdoing.sh
[root@iZhp3i77hpofuqqxvoc790Z redis]# ll
总用量 1928
drwxrwxr-x 6 root root    4096 319 2019 redis-5.0.4
-rw-r--r-- 1 root root 1966337 108 15:23 redis-5.0.4.tar.gz

# 由于redis 是c语言开发的,因此需要安装gcc编译器来编译代码
# 安装 最新版本的 gcc 最新版本
[root@iZhp3i77hpofuqqxvoc790Z redis]# yum install gcc-c++
已加载插件:fastestmirror
Determining fastest mirrors
# .....中间省略了     
extras                                                                                                                             | 2.9 kB  00:00:00     
updates                                                                                                                            | 2.9 kB  00:00:00     
软件包 gcc-c++-4.8.5-44.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@iZhp3i77hpofuqqxvoc790Z local]# mv /root/redis /usr/local/
[root@iZhp3i77hpofuqqxvoc790Z local]# ll
总用量 48
drwxr-xr-x  8 root root 4096 912 13:58 aegis
drwxr-xr-x. 2 root root 4096 628 12:35 bin
drwxr-xr-x. 2 root root 4096 411 2018 etc
drwxr-xr-x. 2 root root 4096 411 2018 games
drwxr-xr-x. 2 root root 4096 411 2018 include
drwxr-xr-x. 3 root root 4096 628 12:35 lib
drwxr-xr-x. 3 root root 4096 628 12:35 lib64
drwxr-xr-x. 2 root root 4096 411 2018 libexec
drwxr-xr-x  3 root root 4096 108 15:24 redis
drwxr-xr-x. 2 root root 4096 411 2018 sbin
drwxr-xr-x. 7 root root 4096 920 14:43 share
drwxr-xr-x. 2 root root 4096 411 2018 src
[root@iZhp3i77hpofuqqxvoc790Z local]# cd redis/
[root@iZhp3i77hpofuqqxvoc790Z redis]# ll
总用量 1928
drwxrwxr-x 6 root root    4096 319 2019 redis-5.0.4
-rw-r--r-- 1 root root 1966337 108 15:23 redis-5.0.4.tar.gz
[root@iZhp3i77hpofuqqxvoc790Z redis]# cd redis-5.0.4/
[root@iZhp3i77hpofuqqxvoc790Z redis-5.0.4]# ll
总用量 256
-rw-rw-r--  1 root root 99445 319 2019 00-RELEASENOTES
-rw-rw-r--  1 root root    53 319 2019 BUGS
-rw-rw-r--  1 root root  1894 319 2019 CONTRIBUTING
-rw-rw-r--  1 root root  1487 319 2019 COPYING
drwxrwxr-x  6 root root  4096 319 2019 deps
-rw-rw-r--  1 root root    11 319 2019 INSTALL
-rw-rw-r--  1 root root   151 319 2019 Makefile
-rw-rw-r--  1 root root  4223 319 2019 MANIFESTO
-rw-rw-r--  1 root root 20555 319 2019 README.md
-rw-rw-r--  1 root root 62155 319 2019 redis.conf
-rwxrwxr-x  1 root root   275 319 2019 runtest
-rwxrwxr-x  1 root root   280 319 2019 runtest-cluster
-rwxrwxr-x  1 root root   281 319 2019 runtest-sentinel
-rw-rw-r--  1 root root  9710 319 2019 sentinel.conf
drwxrwxr-x  3 root root  4096 319 2019 src
drwxrwxr-x 10 root root  4096 319 2019 tests
drwxrwxr-x  8 root root  4096 319 2019 utils
[root@iZhp3i77hpofuqqxvoc790Z redis-5.0.4]# make
cd src && make all
make[1]: 进入目录“/usr/local/redis/redis-5.0.4/src”
    CC Makefile.dep
make[1]: 离开目录“/usr/local/redis/redis-5.0.4/src”
make[1]: 进入目录“/usr/local/redis/redis-5.0.4/src”
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
# ..... 中间省略了
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

Hint: It's a good idea to run 'make test' ;)

make[1]: 离开目录“/usr/local/redis/redis-5.0.4/src”
[root@iZhp3i77hpofuqqxvoc790Z redis-5.0.4]# cd /usr/local/redis/redis-5.0.4
[root@iZhp3i77hpofuqqxvoc790Z redis-5.0.4]# vi redis.conf

修改守护进程
修改监听IP
修改连接密码

# 将配置文件 放置启动目录下
[root@iZhp3i77hpofuqqxvoc790Z redis-5.0.4]# cp redis.conf /usr/local/bin/
# 启动 redis
[root@iZhp3i77hpofuqqxvoc790Z bin]# ./redis-server redis.conf
22240:C 08 Oct 2024 15:53:03.834 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
22240:C 08 Oct 2024 15:53:03.834 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=22240, just started
22240:C 08 Oct 2024 15:53:03.834 # Configuration loaded
# 查看进程
[root@iZhp3i77hpofuqqxvoc790Z ~]# ps -ef |grep redis
root     22241     1  0 15:53 ?        00:00:01 ./redis-server 0.0.0.0:6379
root     31390 30672  0 16:15 pts/0    00:00:00 grep --color=auto redis

原文地址:https://blog.csdn.net/weixin_44748605/article/details/142761079

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!