- 進(jìn)入redis官網(wǎng)下載要安裝的redis壓縮包并上傳到linux服務(wù)器
- 解壓redis壓縮包
tar -zxvf redis-3.2.11.tar.gz - 進(jìn)入解壓縮后的文件
[root@centos-linux redis-3.2.11]# ll
總用量 212
-rw-rw-r--. 1 root root 92766 9月 21 2017 00-RELEASENOTES
-rw-rw-r--. 1 root root 53 9月 21 2017 BUGS
-rw-rw-r--. 1 root root 1805 9月 21 2017 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 9月 21 2017 COPYING
drwxrwxr-x. 7 root root 4096 9月 21 2017 deps
-rw-rw-r--. 1 root root 11 9月 21 2017 INSTALL
-rw-rw-r--. 1 root root 151 9月 21 2017 Makefile
-rw-rw-r--. 1 root root 4223 9月 21 2017 MANIFESTO
-rw-rw-r--. 1 root root 6834 9月 21 2017 README.md
-rw-rw-r--. 1 root root 46695 9月 21 2017 redis.conf
-rwxrwxr-x. 1 root root 271 9月 21 2017 runtest
-rwxrwxr-x. 1 root root 280 9月 21 2017 runtest-cluster
-rwxrwxr-x. 1 root root 281 9月 21 2017 runtest-sentinel
-rw-rw-r--. 1 root root 7606 9月 21 2017 sentinel.conf
drwxrwxr-x. 2 root root 4096 9月 21 2017 src
drwxrwxr-x. 10 root root 4096 9月 21 2017 tests
drwxrwxr-x. 7 root root 4096 9月 21 2017 utils
- 執(zhí)行make命令
[root@centos-linux redis-3.2.11]# make - 開(kāi)始安裝redis
PREFIX就是指定要安裝到哪個(gè)位置,這里我就直接安裝到redis解壓縮后的文件夾下了。
安裝完之后執(zhí)行l(wèi)l命令會(huì)發(fā)現(xiàn)這個(gè)文件夾中多了一個(gè)bin文件夾。
[root@centos-linux redis-3.2.11]# make PREFIX=/home/demo/redis-3.2.11 install
cd src && make install
make[1]: 進(jìn)入目錄“/home/demo/redis-3.2.11/src”
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: 離開(kāi)目錄“/home/demo/redis-3.2.11/src”
[root@centos-linux redis-3.2.11]# ll
總用量 216
-rw-rw-r--. 1 root root 92766 9月 21 2017 00-RELEASENOTES
drwxr-xr-x. 2 root root 4096 6月 4 11:57 bin
-rw-rw-r--. 1 root root 53 9月 21 2017 BUGS
-rw-rw-r--. 1 root root 1805 9月 21 2017 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 9月 21 2017 COPYING
drwxrwxr-x. 7 root root 4096 6月 4 11:51 deps
-rw-rw-r--. 1 root root 11 9月 21 2017 INSTALL
-rw-rw-r--. 1 root root 151 9月 21 2017 Makefile
-rw-rw-r--. 1 root root 4223 9月 21 2017 MANIFESTO
-rw-rw-r--. 1 root root 6834 9月 21 2017 README.md
-rw-rw-r--. 1 root root 46695 9月 21 2017 redis.conf
-rwxrwxr-x. 1 root root 271 9月 21 2017 runtest
-rwxrwxr-x. 1 root root 280 9月 21 2017 runtest-cluster
-rwxrwxr-x. 1 root root 281 9月 21 2017 runtest-sentinel
-rw-rw-r--. 1 root root 7606 9月 21 2017 sentinel.conf
drwxrwxr-x. 2 root root 4096 6月 4 11:52 src
drwxrwxr-x. 10 root root 4096 9月 21 2017 tests
drwxrwxr-x. 7 root root 4096 9月 21 2017 utils
[root@centos-linux redis-3.2.11]#
- 進(jìn)入bin文件夾下會(huì)發(fā)現(xiàn)這里都是一些可執(zhí)行文件
[root@centos-linux redis-3.2.11]# cd bin
[root@centos-linux bin]# ll
總用量 15076
-rwxr-xr-x. 1 root root 2432160 6月 4 11:57 redis-benchmark
-rwxr-xr-x. 1 root root 25080 6月 4 11:57 redis-check-aof
-rwxr-xr-x. 1 root root 5189792 6月 4 11:57 redis-check-rdb
-rwxr-xr-x. 1 root root 2584960 6月 4 11:57 redis-cli
lrwxrwxrwx. 1 root root 12 6月 4 11:57 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 5189792 6月 4 11:57 redis-server
[root@centos-linux bin]#
- 我們可以找到redis的配置文件并拷貝一份到我們的bin文件夾下
[root@centos-linux bin]# cp /home/demo/redis-3.2.11/redis.conf /home/demo/redis-3.2.11/bin/
[root@centos-linux bin]# ll
總用量 15124
-rwxr-xr-x. 1 root root 2432160 6月 4 11:57 redis-benchmark
-rwxr-xr-x. 1 root root 25080 6月 4 11:57 redis-check-aof
-rwxr-xr-x. 1 root root 5189792 6月 4 11:57 redis-check-rdb
-rwxr-xr-x. 1 root root 2584960 6月 4 11:57 redis-cli
-rw-r--r--. 1 root root 46695 6月 4 12:09 redis.conf
lrwxrwxrwx. 1 root root 12 6月 4 11:57 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 5189792 6月 4 11:57 redis-server
[root@centos-linux bin]#
- 指定使用我們拷貝的配置文件來(lái)啟動(dòng)redis
[root@centos-linux bin]# ./redis-server ./redis.conf
8164:M 04 Jun 12:11:38.259 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.11 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 8164
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
8164:M 04 Jun 12:11:38.262 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
8164:M 04 Jun 12:11:38.262 # Server started, Redis version 3.2.11
8164:M 04 Jun 12:11:38.262 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
8164:M 04 Jun 12:11:38.262 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
8164:M 04 Jun 12:11:38.262 * The server is now ready to accept connections on port 6379
ok啟動(dòng)成功
- 接下來(lái)我們進(jìn)行一下測(cè)試
我們復(fù)制一個(gè)窗口
[root@centos-linux /]# cd /home/demo/redis-3.2.11/bin
[root@centos-linux bin]# ll
總用量 15124
-rwxr-xr-x. 1 root root 2432160 6月 4 11:57 redis-benchmark
-rwxr-xr-x. 1 root root 25080 6月 4 11:57 redis-check-aof
-rwxr-xr-x. 1 root root 5189792 6月 4 11:57 redis-check-rdb
-rwxr-xr-x. 1 root root 2584960 6月 4 11:57 redis-cli
-rw-r--r--. 1 root root 46695 6月 4 12:09 redis.conf
lrwxrwxrwx. 1 root root 12 6月 4 11:57 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 5189792 6月 4 11:57 redis-server
[root@centos-linux bin]# ./redis-cli
127.0.0.1:6379> set key1 hello
OK
127.0.0.1:6379> get key1
"hello"
127.0.0.1:6379>