ubuntu安裝redis

孔德昌發表於2020-12-21

官網是這麼寫

$ wget https://download.redis.io/releases/redis-6.0.9.tar.gz
$ tar xzf redis-6.0.9.tar.gz
$ cd redis-6.0.9
$ make

今天試了一下gcc 9.3.0 以下編譯過程,大概花了十幾分鍾

buntu@MateBook:~$ wget https://download.redis.io/releases/redis-6.0.9.tar.gz
--2020-12-21 01:44:38--  https://download.redis.io/releases/redis-6.0.9.tar.gz
Resolving download.redis.io (download.redis.io)... 45.60.125.1
Connecting to download.redis.io (download.redis.io)|45.60.125.1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2261418 (2.2M) [application/octet-stream]
Saving to: ‘redis-6.0.9.tar.gz’

redis-6.0.9.tar.gz            100%[=================================================>]   2.16M  45.6KB/s    in 2m 5s

2020-12-21 01:46:49 (17.7 KB/s) - ‘redis-6.0.9.tar.gz’ saved [2261418/2261418]
ubuntu@MateBook:~$ tar zxvf redis-6.0.9.tar.gz
redis-6.0.9/
redis-6.0.9/.github/
redis-6.0.9/.github/workflows/
redis-6.0.9/.github/workflows/ci.yml
redis-6.0.9/.github/workflows/daily.yml
redis-6.0.9/.gitignore
redis-6.0.9/00-RELEASENOTES
redis-6.0.9/BUGS
redis-6.0.9/CONTRIBUTING
redis-6.0.9/COPYING
redis-6.0.9/INSTALL
ubuntu@MateBook:~$ cd redis-6.0.9
ubuntu@MateBook:~/redis-6.0.9$ make
cd src && make all
make[1]: Entering directory '/home/ubuntu/redis-6.0.9/src'
/bin/sh: 1: pkg-config: not found
    CC Makefile.dep
/bin/sh: 1: pkg-config: not found
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
rm -f adlist.d quicklist.d ae.d anet.d dict.d server.d sds.d zmalloc.d lzf_c.d lzf_d.d pqsort.d zipmap.d sha1.d ziplist.d release.d networking.d util.d object.d db.d replication.d rdb.d t_string.d t_list.d t_set.d t_zset.d t_hash.d config.d aof.d pubsub.d multi.d debug.d sort.d ints
.....
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

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

make[1]: Leaving directory '/home/ubuntu/redis-6.0.9/src'

一路順風,沒有出現什麼問題,沒有像redis5.x編譯時候dep總有問題

ubuntu@MateBook:~/redis-6.0.9$ src/redis-server
22440:C 21 Dec 2020 02:00:36.550 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
22440:C 21 Dec 2020 02:00:36.550 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=22440, just started
22440:C 21 Dec 2020 02:00:36.551 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
22440:M 21 Dec 2020 02:00:36.552 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 22440
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

22440:M 21 Dec 2020 02:00:36.560 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
22440:M 21 Dec 2020 02:00:36.561 # Server initialized
22440:M 21 Dec 2020 02:00:36.561 # 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.
22440:M 21 Dec 2020 02:00:36.562 * Ready to accept connections

官網還給出了通過apt軟體包儲存庫安裝Redis的最新穩定版本 。

$ sudo add-apt-repository ppa:redislabs/redis
$ sudo apt-get update
$ sudo apt-get install redis
# 檢查Redis伺服器系統程式
~ ps -aux|grep redis
redis     4162  0.1  0.0  10676  1420 ?        Ss   23:24   0:00 /usr/bin/redis-server /etc/redis/redis.conf
conan     4172  0.0  0.0  11064   924 pts/0    S+   23:26   0:00 grep --color=auto redis

# 通過啟動命令檢查Redis伺服器狀態
~ netstat -nlt|grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN

# 通過啟動命令檢查Redis伺服器狀態
~ sudo /etc/init.d/redis-server status
redis-server is running

相關文章