从源安装 Redis
从源码编译安装 Redis
Redis 堆栈 | Redis 社区版 |
---|
您可以在各种平台和作系统(包括 Linux 和 macOS)上从源代码编译和安装 Redis。Redis 除了 C 编译器和libc
.
下载源文件
Redis 源文件可从 Download (下载) 页面获取。您可以通过对照 redis-hashes git 存储库中的摘要检查这些下载来验证这些下载的完整性。
要从 Redis 下载站点获取 Redis 最新稳定版本的源文件,请运行:
wget https://download.redis.io/redis-stable.tar.gz
Compiling Redis
To compile Redis, first extract the tarball, change to the root directory, and then run make
:
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
To build with TLS support, you'll need to install OpenSSL development libraries (e.g., libssl-dev on Debian/Ubuntu) and then run:
make BUILD_TLS=yes
If the compile succeeds, you'll find several Redis binaries in the src
directory, including:
- redis-server: the Redis Server itself
- redis-cli is the command line interface utility to talk with Redis.
To install these binaries in /usr/local/bin
, run:
sudo make install
Starting and stopping Redis in the foreground
Once installed, you can start Redis by running
redis-server
If successful, you'll see the startup logs for Redis, and Redis will be running in the foreground.
To stop Redis, enter Ctrl-C
.
For a more complete installation, continue with these instructions.
On this page