redis(一)
CentOS安装redis
Centos7安装redis
安装前所需检查
-
yum 是否安装
-
wget 是否安装
-
gcc是否安装
-
升级gcc
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
-
配置环境变量
export REDIS_HOME=/opt/安装目录
export PATH: P A T H : PATH: PATH:REDIS_HOME/bin
-
注释 utils/install__server.sh 以下类容
#bail if this system is managed by systemd
#_pid_1_exe="KaTeX parse error: Expected 'EOF', got '#' at position 28: … /proc/1/exe)" #̲if [ "{_pid_1_exe##*/}" = systemd ]
#then#echo “This systems seems to use systemd.”
#echo “Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!”
#exit 1
#fi
#unset _pid_1_exe
所用命令
-
yum命令
yum install 工具名
yum list(检查安装项)
-
wget 下载链接
-
redis命令
make
make distclean
make install PREPIX=安装目录
service redis start
service redis stop
service redis restart
-
source /etc/profile (环境变量立即生效)
-
firewall命令
添加:
firewall-cmd --zone=public --add-port=80/tcp --permanent (–permanent永久生效,没有此参数重启后失效)
重新载入:
firewall-cmd --reload
查看:
firewall-cmd --zone=public --query-port=80/tcp
删除:
firewall-cmd --zone=public --remove-port=80/tcp --permanent
开始安装
-
wget http://download.redis.io/releases/redis-6.0.6.tar.gz
-
cd redis-6.0.6
-
make
-
make install PREPIX=/opt/redis_server
-
cd uitls
-
./install_server.sh
-
开放,开启,重启 防火墙
-
etc/6379.conf
设置密码 requirepass
注释 bin 127.0.0.1
设置 appendonly yes;
设置 daemonize yes.