Compiling the embedded-redis Source Code
- The binary packages available at the Kunpeng mirror site are compiled and packaged based on the open source code, and do not involve vulnerability or bug fixes.
- When using open source software, comply with the applicable license.
- Obtain the source code.
- Download the source code package using the local browser.
- Upload the source package to the /home directory on the server.
If the server is connected to the network, run the wget command to download the source code.
- Decompress the source code package and go to the source code directory.
- embedded-redis-0.6:
1 2
unzip embedded-redis-0.6.zip cd embedded-redis-embedded-redis-0.6/
- embedded-redis-0.7.2:
mv 0.7.2.tar.gz embedded-redis-0.7.2.tar.gz tar -zxvf embedded-redis-0.7.2.tar.gz cd embedded-redis-0.7.2/
- embedded-redis-0.6:
- Modify the source code to adapt to the AArch64 architecture.
- Add the architecture type.
- Open the Architecture.java file.
1vim src/main/java/redis/embedded/util/Architecture.java - Press i to enter the insert mode and add a comma (,) at the end of line 5.
- Add the code to line 6. Save the file and exit.
aarch64

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the Architecture.java file.
- Add the OS definition.
- Open the OsArchitecture.java file.
1vim src/main/java/redis/embedded/util/OsArchitecture.java - Press i to enter the insert mode and add the following content to line 12:
public static final OsArchitecture UNIX_aarch64 = new OsArchitecture(OS.UNIX, Architecture.aarch64);

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the OsArchitecture.java file.
- Add the architecture definition.
- Open the RedisExecProvider.java file.
1vim src/main/java/redis/embedded/RedisExecProvider.java - Press i to enter the insert mode and add the following content to line 32:
executables.put(OsArchitecture.UNIX_aarch64, "redis-server-2.8.19-aarch64");

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the RedisExecProvider.java file.
- Add the architecture judgment.
- Open the OSDetector.java file.
1vim src/main/java/redis/embedded/util/OSDetector.java - Press i to enter the insert mode and modify line 57.
if (line.contains("x86_64")) - Add the following code to lines 60, 61, and 62:
else if (line.contains("aarch64")) { return Architecture.aarch64; }
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the OSDetector.java file.
- Add the architecture type.
- Copy the executable file compiled in Compiling the redis-server-2.8.19 Source Code from the /home/redis-2.8.19/src/redis-server directory to the src/main/resources/redis-server-2.8.19-aarch64 directory.
1 2 3
ls src/main/resources/ \cp /home/redis-2.8.19/src/redis-server src/main/resources/redis-server-2.8.19-aarch64 ls src/main/resources/

- Configure Cntlm.
If a proxy is required for the server to access the Internet, configure Cntlm. For details, see Configuring Cntlm.
- Perform the compilation and installation.
1mvn install

If the message "BUILD SUCCESS" is displayed, the compilation is successful.
If the message "Cannot start redis server" is displayed, see "Can't start redis server" Displayed When Compiling embedded-redis.
- View the generated JAR package.
1ls target/
Parent topic: Compiling and Installing Embedded Redis