一,查看是否已安裝redis
1,redis官網:
https://redis.io/
2,檢查是否已安裝:
root@lhdpc:~# whereis redis-server redis-server:
說明:劉宏締的架構森林是一個專注架構的博客,
網站:https://blog.imgtouch.com
本文: https://blog.imgtouch.com/index.php/2023/05/29/ubuntu21-10-linux-apt-fang-shi-an-zhuang-redis6-15/
對應的源碼可以訪問這里獲取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
說明:作者:劉宏締 郵箱: 371125307@qq.com
二,apt方式安裝redis6:
1,安裝
root@lhdpc:~# apt-get install redis
2,檢查安裝完的效果:
root@lhdpc:~# whereis redis-server redis-server: /usr/bin/redis-server /usr/share/man/man1/redis-server.1.gz
3,查看redis版本:
root@lhdpc:~# redis-server -v Redis server v=6.0.15 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=4610f4c3acf7fb25
4,查看redis服務的狀態:
root@lhdpc:~# systemctl status redis.service ● redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-12-27 10:09:00 CST; 3min 45s ago Docs: http://redis.io/documentation, man:redis-server(1) Main PID: 1790 (redis-server) Status: "Ready to accept connections" Tasks: 5 (limit: 4588) Memory: 2.5M CPU: 602ms CGroup: /system.slice/redis-server.service └─1790 /usr/bin/redis-server 127.0.0.1:6379 12月 27 10:09:00 lhdpc systemd[1]: Starting Advanced key-value store... 12月 27 10:09:00 lhdpc systemd[1]: Started Advanced key-value store.
可見已處於啟動狀態
5,查看redis綁定的端口:
root@lhdpc:~# ss -lntp | grep redis LISTEN 0 511 127.0.0.1:6379 0.0.0.0:* users:(("redis-server",pid=1790,fd=6)) LISTEN 0 511 [::1]:6379 [::]:* users:(("redis-server",pid=1790,fd=7))
三,測試安裝效果
root@lhdpc:~# redis-cli 127.0.0.1:6379> get a (nil) 127.0.0.1:6379> set a "this is a" OK 127.0.0.1:6379> get a "this is a" 127.0.0.1:6379>
四,查看linux的版本:
root@lhdpc:~# cat /etc/os-release PRETTY_NAME="Ubuntu 21.10" NAME="Ubuntu" VERSION_ID="21.10" VERSION="21.10 (Impish Indri)" VERSION_CODENAME=impish ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=impish