日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

【转】Linux系统安装Redis详细过程

發布時間:2024/4/17 linux 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【转】Linux系统安装Redis详细过程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文轉載 https://blog.csdn.net/qq_20989105/article/details/76390367,轉載前請標注原作者,謝謝。

一、安裝gcc?
1、Redis在linux上的安裝首先必須先安裝gcc,這個是用來編譯redis的源文件的。首先需要先切換的到root用戶:

1 [cheny@localhost ~]$ su 2 Password: 3 [root@localhost cheny]#

2、然后開始安裝gcc:

[root@localhost /]# yum install gcc-c++ //這個命令是在線安裝的,所以在這之前你的VM必須能夠上網,需要在 VM中把網卡設置成NAT模式 ,因為我使用的是centos,在網絡設置中需要把網卡開啟,反正我在裝完系統之后它是默認關閉的

3、之后便會出現下載文件界面:?
?
4、會出現2次確認界面,輸入y即可?
?
5、之后會進行更新檢查,進行更新驗證等等操作,等他自動完成即可。?
6、出現如下代碼即是安裝成功:

Installed:gcc-c++.x86_64 0:4.8.5-11.el7 Dependency Installed:cpp.x86_64 0:4.8.5-11.el7 gcc.x86_64 0:4.8.5-11.el7 glibc-devel.x86_64 0:2.17-157.el7_3.5 glibc-headers.x86_64 0:2.17-157.el7_3.5 kernel-headers.x86_64 0:3.10.0-514.26.2.el7 libmpc.x86_64 0:1.0.1-3.el7 libstdc++-devel.x86_64 0:4.8.5-11.el7 Dependency Updated:glibc.x86_64 0:2.17-157.el7_3.5 glibc-common.x86_64 0:2.17-157.el7_3.5 Complete!

?


二、解壓redis的源文件

[root@localhost cheny]# cd Desktop/ [root@localhost Desktop]# ls redis-4.0.1.tar.gz [root@localhost Desktop]# tar zxvf redis-4.0.1.tar.gz redis-4.0.1/ redis-4.0.1/.gitignore redis-4.0.1/00-RELEASENOTES redis-4.0.1/BUGS redis-4.0.1/CONTRIBUTING .......等等

三、進入redis的解壓目錄

[root@localhost Desktop]# ls redis-4.0.1 redis-4.0.1.tar.gz [root@localhost Desktop]# cd redis-4.0.1/

四、使用make命令編譯

[root@localhost redis-4.0.1]# make // 出現以下信息即是編譯成功 CC notify.oCC setproctitle.oCC blocked.oCC hyperloglog.oCC latency.oCC sparkline.oCC redis-check-rdb.oCC redis-check-aof.oCC geo.oCC lazyfree.oCC module.oCC evict.oCC expire.oCC geohash.oCC geohash_helper.oCC childinfo.oCC defrag.oCC siphash.oCC rax.oLINK redis-serverINSTALL redis-sentinelCC redis-cli.oLINK redis-cliCC redis-benchmark.oLINK redis-benchmarkINSTALL redis-check-rdbINSTALL redis-check-aof

五、進入解壓的src目錄下

[root@localhost redis-4.0.1]# cd src

六、?
1、運行make test測試是否可以安裝

[root@localhost src]# make test You need tcl 8.5 or newer in order to run the Redis test make: *** [test] Error 1

2、在這里發現有錯誤?
TCL(Tool Command Language)工具腳本語言,是Linux內的一種語言包。,這里需要先安裝tcl。

1、先去這里下載: http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz 文件 2、然后將其拷貝至虛擬機 3、然后解壓對于.tar.gz的后綴文件可以使用tar zxvf 。。。.tar.gz解壓 tar zxvf tcl8.6.1-src.tar.gz 4、安裝 Tcl 為編譯 Tcl 做準備: cd 到tcl文件夾里 [root@localhost Desktop]# cd tcl8.6.1/ cd unix [root@localhost tcl8.6.1]# cd unix/ ./configure [root@localhost unix]# ./configure 編譯軟件包: [root@localhost unix]# make 安裝軟件包: [root@localhost unix]# make install 這個時候在命令行就可以輸入tclsh進入tcl解釋器 tcl就可以使用了。 繼續我們的redis安裝

3、再次測試make test?
這里反正檢查的一大堆,都是綠色的ok。這就可以了?

4、安裝?
[root@localhost src]# make PREFIX=/usr/local/redis install?
?
安裝成功!

?
框框中標出的都是一個個工具命令


七、把解壓的redis路徑下的redis.conf文件拷貝到安裝路徑下面

[root@localhost Desktop]# cd redis-4.0.1/ [root@localhost redis-4.0.1]# ls 00-RELEASENOTES INSTALL runtest tests BUGS Makefile runtest-cluster utils CONTRIBUTING MANIFESTO runtest-sentinel COPYING README.md sentinel.conf deps redis.conf src [root@localhost redis-4.0.1]# cp redis.conf /usr/local/redis [root@localhost redis-4.0.1]# cd /usr/local/redis [root@localhost redis]# ls bin redis.conf 到這里redis已經安裝成功了。

八、啟動redis?
第一種方法:進入安裝路徑下的bin

[root@localhost redis]# cd bin [root@localhost bin]# ./redis-server

?
這樣其實已經啟動成功了,但是這屬于前端啟動,啟動redis之后,我們的控制臺就不能進行任何操作了。只能ctrl+c停止啟動。

第二種方法:?
后端啟動?
1、首先編輯redis.conf

[root@localhost redis]# vim redis.conf

2、找到daemonize no將其改為yes(在vim中插入數據按鍵盤上的i或者insert)?
?
效果如下:?
?
3、按esc退出insert模式,再按:,并且輸入wq。代表保存并且退出

4、再次啟動

[root@localhost redis]# ls bin redis.conf [root@localhost redis]# ./bin/redis-server ./redis.conf //這里加載配置文件80167:C 30 Jul 16:01:58.145 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 80167:C 30 Jul 16:01:58.145 # Redis version=4.0.1, bits=64, commit=00000000, modified=0, pid=80167, just started 80167:C 30 Jul 16:01:58.145 # Configuration loaded

這樣redis就啟動了

可以通過 ps -ef | grep -i redis 來查看是否啟動

5、關閉redis

[root@localhost redis]# ./bin/redis-cli shutdown

九、簡單的使用

//首先鏈接客戶端 [root@localhost redis]# ./bin/redis-cli //檢查網絡是否可以 127.0.0.1:6379> ping PONG //設置一個鍵值對 127.0.0.1:6379> set name cheny OK //獲取剛剛設置的鍵值對 127.0.0.1:6379> get name "cheny" //查看所有的鍵 127.0.0.1:6379> keys * 1) "name" //刪除name這個鍵 127.0.0.1:6379> del name (integer) 1 127.0.0.1:6379> keys * (empty list or set) 127.0.0.1:6379> ---------------------------END-----------------------------
最后,非常感謝原作者分享此文章!

轉載于:https://www.cnblogs.com/hujunhui/p/9353684.html

總結

以上是生活随笔為你收集整理的【转】Linux系统安装Redis详细过程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。