Redis installation in linux environment
- Ensure the normal operation of the Linux environment
- One, download Redis
- 2. Upload the Redis installation package to Linux
- Three, enter the relevant directory to execute the relevant command
- Fourth, install the relevant gcc dependency (redis is based on the C language, so install such a dependency)
- 5. Switch to the relevant directory and execute the installation command
- Six, start Redis
Ensure the normal operation of the Linux environment
Personal PC, VMWare or VirtualBox can be used to install virtual machine, operating system, it is recommended to install CentOS7.x version
One, download Redis
You can download related packages from the Redis official website https://redis.io/. It is recommended to download the 4.x commercial version.
2. Upload the Redis installation package to Linux
You can use the xftp tool (mkdir /soft is recommended, or the app is placed in the soft (app) directory)
Three, enter the relevant directory to execute the relevant command
tar -zxvf redis-4.0.14.tar.gz
Fourth, install the relevant gcc dependency (redis is based on the C language, so install such a dependency)
yum -y install gcc
5. Switch to the relevant directory and execute the installation command
cd redis-4.0.14
# 编译
make
# 安装到/usr/local/redis目录下
make PREFIX=/usr/local/redis install
# 拷贝配置文件
mkdir /usr/local/redis/etc/
cp redis.conf /usr/local/redis/etc/
Six, start Redis
1. Let Redis be started in the background and modify the configuration file
#进入安装目录
cd /usr/local/redis/
#修改redis.conf配置文件
vi ./etc/redis.conf
Modify the following:
daemonize yes
#后台启动
#bind 127.0.0.1
#Redis的IP,可以在前面加#注释或者改为虚拟机相关IP,例如:bind 192.168.48.20 protected-mode no #取消保护模式
#保存退出
:wq
2. Start redis
./bin/redis-server ./etc/redis.conf
3. Visit Redis
./bin/redis-cli