Redis下载与安装 Linux + Windows 较详细步骤
- Redis下载与安装
- Linux CentOS7
- 下载
- 安装
- Windows
- 下载
- 安装
- 最后的最后
Redis下载与安装
Linux CentOS7
下载
官网下载:https://redis.io/download
历史版本:https://download.redis.io/releases/
在官网下载redis的tar.gz包,此时版本为6.2.6,即 redis-6.2.6.tar.gz
使用Xftp传送到Linux中,然后放在opt目录下面
安装
进入opt目录进行解压
(注:env目录是我自己创建的目录,你可以根据你自己喜好放置):
$ cd /opt
$ tar zxvf redis-6.2.6.tar.gz -C /usr/local/env
进入/usr/local/env/redis-6.2.6,执行 make 命令
$ cd /usr/local/env/redis-6.2.6
$ make
执行完 make 命令后,redis-6.2.6 的 src 目录下会出现编译后的 redis 服务程序 redis-server,还有用于测试的客户端程序 redis-cli
复制配置文件,不动原来的,以后启动 Redis 就使用这个复制后的配置文件
$ cp redis.conf /usr/local/env/aconfig
$ cd /usr/local/env/aconfig
$ vim redis.conf
################################# GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# When Redis is supervised by upstart or systemd, this parameter has no impact.
# 将 daemonize no 改成 daemonize yes
# Redis 默认不是以守护进程的方式运行,可以通过该配置项修改,使用 yes 启用守护进程
daemonize yes
进入 redis-6.2.6 的 src 目录
# 运行server
$ ./redis-server /usr/local/env/aconfig/redis.conf
# 运行client
$ ./redis-cli
127.0.0.1:6379> set foo god23bin
OK
127.0.0.1:6379> get foo
"god23bin"
127.0.0.1:6379>
使用Xshell另外新建一个连接窗口,查看redis进程,发现没问题
$ ps -ef | grep "redis"
root 8300 1 0 22:15 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 8648 1080 0 22:21 pts/0 00:00:00 ./redis-cli
root 8828 8803 0 22:24 pts/1 00:00:00 grep --color=auto redis
退出操作:shutdown 加上 exit
127.0.0.1:6379> shutdown
not connected> exit
Windows
下载
Github下载:https://github/microsoftarchive/redis/releases/tag/win-3.2.100
下载好后直接解压,解压后目录长这样
安装
-
打开cmd,用cd命令进入到你的解压目录
-
启动Redis:进入解压目录后
输入:redis-server redis.windows.conf,成功后显示端口号为6379
-
部署Redis为Windows下的服务:关闭上面的cmd,再打开新的cmd进入到Redis目录
输入:redis-server --service-install redis.windows.conf
默认端口号6379,到这里,Redis安装成功
-
安装后的启动服务命令
redis-server --service-start
以上,Redis安装完成
-
常见服务命令
卸载服务:redis-server --service-uninstall
开启服务:redis-server --service-start
停止服务:redis-server --service-stop
参考资料:https://wwwblogs/cang12138/p/8880776.html#_label0
最后的最后
希望各位屏幕前的靓仔靓女们
给个三连!你轻轻地点了个赞,那将在我的心里世界增添一颗明亮而耀眼的星!
咱们下期再见!
Redis下载与安装 Linux + Windows 较详细步骤
- Redis下载与安装
- Linux CentOS7
- 下载
- 安装
- Windows
- 下载
- 安装
- 最后的最后
Redis下载与安装
Linux CentOS7
下载
官网下载:https://redis.io/download
历史版本:https://download.redis.io/releases/
在官网下载redis的tar.gz包,此时版本为6.2.6,即 redis-6.2.6.tar.gz
使用Xftp传送到Linux中,然后放在opt目录下面
安装
进入opt目录进行解压
(注:env目录是我自己创建的目录,你可以根据你自己喜好放置):
$ cd /opt
$ tar zxvf redis-6.2.6.tar.gz -C /usr/local/env
进入/usr/local/env/redis-6.2.6,执行 make 命令
$ cd /usr/local/env/redis-6.2.6
$ make
执行完 make 命令后,redis-6.2.6 的 src 目录下会出现编译后的 redis 服务程序 redis-server,还有用于测试的客户端程序 redis-cli
复制配置文件,不动原来的,以后启动 Redis 就使用这个复制后的配置文件
$ cp redis.conf /usr/local/env/aconfig
$ cd /usr/local/env/aconfig
$ vim redis.conf
################################# GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# When Redis is supervised by upstart or systemd, this parameter has no impact.
# 将 daemonize no 改成 daemonize yes
# Redis 默认不是以守护进程的方式运行,可以通过该配置项修改,使用 yes 启用守护进程
daemonize yes
进入 redis-6.2.6 的 src 目录
# 运行server
$ ./redis-server /usr/local/env/aconfig/redis.conf
# 运行client
$ ./redis-cli
127.0.0.1:6379> set foo god23bin
OK
127.0.0.1:6379> get foo
"god23bin"
127.0.0.1:6379>
使用Xshell另外新建一个连接窗口,查看redis进程,发现没问题
$ ps -ef | grep "redis"
root 8300 1 0 22:15 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 8648 1080 0 22:21 pts/0 00:00:00 ./redis-cli
root 8828 8803 0 22:24 pts/1 00:00:00 grep --color=auto redis
退出操作:shutdown 加上 exit
127.0.0.1:6379> shutdown
not connected> exit
Windows
下载
Github下载:https://github/microsoftarchive/redis/releases/tag/win-3.2.100
下载好后直接解压,解压后目录长这样
安装
-
打开cmd,用cd命令进入到你的解压目录
-
启动Redis:进入解压目录后
输入:redis-server redis.windows.conf,成功后显示端口号为6379
-
部署Redis为Windows下的服务:关闭上面的cmd,再打开新的cmd进入到Redis目录
输入:redis-server --service-install redis.windows.conf
默认端口号6379,到这里,Redis安装成功
-
安装后的启动服务命令
redis-server --service-start
以上,Redis安装完成
-
常见服务命令
卸载服务:redis-server --service-uninstall
开启服务:redis-server --service-start
停止服务:redis-server --service-stop
参考资料:https://wwwblogs/cang12138/p/8880776.html#_label0
最后的最后
希望各位屏幕前的靓仔靓女们
给个三连!你轻轻地点了个赞,那将在我的心里世界增添一颗明亮而耀眼的星!
咱们下期再见!