Redis Installation Deployment
Redis Installation and Deployment
Opening Specified Ports or Disabling Firewall
-
View the ports that are already open:
firewall-cmd --list-ports -
Open a specified port (e.g., port 6379 for Redis):
firewall-cmd --zone=public --add-port=6379/tcp --permanent -
Reload the firewall configuration:
firewall-cmd --reload -
Confirm the opened ports:
firewall-cmd --list-ports -
If needed, you can stop the firewall:
systemctl stop firewalld -
Check the firewall status:
systemctl status firewalld
Installation and Deployment
-
Extract the Redis installation package:
tar -zxvf redis-4.0.9.tar.gz -C /usr/local/ -
Rename the extracted folder:
mv redis-4.0.9 redis -
Install the required dependencies (e.g., GCC):
yum install gcc -y -
Compile the Redis files:
cd /usr/local/redis make && make install
Edit Configuration File
-
Edit the Redis configuration file:
vi redis.conf -
Set a password (e.g., "123456"):
# Before # requirepass foobared # After requirepass 123456 -
Enable background daemon mode:
# Before # daemonize no # After daemonize yes -
Allow remote access:
# Before # bind 127.0.0.1 # After bind 0.0.0.0 -
Save the configuration file and exit the editor.
Start Redis
-
Start Redis using the modified configuration file:
redis-server /usr/local/redis/redis.conf -
Validate the Redis server is running:
redis-cli
Make sure to adjust paths, passwords, and other configurations as needed for your specific environment.