Install redis under Linux and connect remote redis with local

1. Open the virtual machine and enter the Linux environment

Insert picture description here

2. Right-click to open the terminal, switch root permissions

(1) Input: su

(2) Administrator password

Insert picture description here

(3) Forgot the password

https://blog.csdn.net/m0_48283915/article/details/107754168

3. Connect to the local shell

(1) Input: ifconfig

Find ip address

Insert picture description here

(2) Open Xsell and connect

Insert picture description here

I myself use MD5 encryption, and accept and save

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

4. Xftp transfer compressed package

Insert picture description here

5. Unzip the compressed package

# 打包文件
tar -cvf 打包文件.tar 被打包的文件/路径...
# 解包文件
tar -xvf 打包文件.tar

tar -xvf  redis-6.2.4.tar.gz
Insert picture description here

6. Enter the Redis-6.2.4 folder

cd redis-6.2.4
Do not correspond to the following picture, it is not necessary. I always make up the picture after finishing the event. May be a bit off
Insert picture description here

7. Install Redis-6.2.4

Enter one by one in the directory just now

(1)yum -y install gcc-c++

//因为redis是基于C++开发的,所以需要这个环境
yum -y install gcc-c++
# 查看gcc版本
gcc -v
Insert picture description here

(2)make

make
Insert picture description here

(3)make install

make install
Insert picture description here

(4) Installation is complete

(5) Redis default installation path /usr/local/bin

8. Enter the installation path

cd /usr/local/bin
Insert picture description here

9. Modify the configuration file

Insert picture description here
Insert picture description here
Insert picture description here

Need to modify the configuration file

10. Run redis

reids-server kconfig/redis.conf

The kconfig here is a folder created by myself, you can create it yourself, or you can know the path of redis.conf.

note:

Because of the version issue, the following may not appear anymore

Insert picture description here

It is directly:

Insert picture description here

You can also go directly to see the process of reids to see if it runs successfully

ps -ef |grep redis

11. Possible problems with the connection

Solution place

To put it briefly:

Explanation: Because you modified the configuration file, but you did not take effect. It is still the port 127.0.0.1:6379

[[email protected] src]# ps -ef | grep redis
root 5352 1 0 10:59? 00:00:00 ./redis-server 127.0.0.1:6379
root 5367 2321 0 11:00 pts/0 00:00:00 grep redis

So you need to kill the Redis process first

redis-cli shutdown

Then check whether the ip has changed

Insert picture description here

Linux modify file content [command]

Install Redis under Linux

The most complete summary of Linux commonly used commands in history (super comprehensive! Super detailed!) Collect this one!

Redis reported an error: "Could not create server TCP listening socket *:6379: bind: Address already in use" simple solution

13. Add a cd command

(1) cd command

cd …return to the previous directory

cd /software/java, an error occurred unexpectedly, prompt: there is no such file or directory

First cd software, then cd java, successfully entered without error

The cause of the problem: Under linux / always represents the root directory of the file system, and does not represent any other meaning, let alone the meaning of a relative path. Once the directory is preceded by /, it means that it should be an absolute directory starting from the root directory.