centos8.5 安装 redis 7.2.4 详细步骤

1 下载Index of /releases/ (redis.io)

通过xftp等方式上传到服务器,安装依赖包

yum install gcc gcc-c++ make  tcl -y
[root@localhost software]# ll
total 3308
-rw-r--r--. 1 root root 3386861 May  3 21:56 redis-7.2.4.tar.gz
[root@localhost software]# ll
total 3308
-rw-r--r--. 1 root root 3386861 May  3 21:56 redis-7.2.4.tar.gz
[root@localhost software]# tar  xf  redis-7.2.4.tar.gz
[root@localhost software]# mv redis-7.2.4/  redis/

[root@localhost software]# cd redis/
[root@localhost redis]# make MALLOC=libc
[root@localhost redis]# make test
\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]: Leaving directory '/data/software/redis/src'
[root@localhost redis]# make install PREFIX=/usr/local/redis
cd src && make install
make[1]: Entering directory '/data/software/redis/src'

Hint: It's a good idea to run 'make test' ;)

    INSTALL redis-server
    INSTALL redis-benchmark
    INSTALL redis-cli
make[1]: Leaving directory '/data/software/redis/src'
[root@localhost redis]# mkdir  -p /usr/local/redis/etc
[root@localhost redis]# cp  redis.conf  /usr/local/redis/etc/
[root@localhost redis]# vim /usr/local/redis/etc/redis.conf
bind 127.0.0.1 -::1-->bind 0.0.0.0
# requirepass foobared-->requirepass 123456
daemonize no-->daemonize yes
#vim /etc/profile
export PATH="$PATH:/usr/local/redis/bin"
#source /etc/profile
#过量使用内存设置为0!在低内存环境下,后台保存可能失败
[root@localhost redis]# vim  /etc/sysctl.conf
vm.overcommit_memory = 1
[root@localhost redis]# sysctl -p

 2 启动

[root@localhost redis]# redis-cli  -v
redis-cli 7.2.4
[root@localhost redis]# redis-server /usr/local/redis/etc/redis.conf

#查看进程 

#测试下

#配置系统服务启动

[root@localhost redis]# vim  /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target
重新加载系统服务
systemctl daemon-reload
设置开机自启:
systemctl enable redis
#关闭之前启动的进程
ps   -ef  |  grep  redis| grep  -v  grep| awk  -F " "  '{print $2}'| xargs kill -9
启动服务
systemctl start redis

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是CentOS 8.5安装Zabbix 6.0的详细步骤: 1. 环境要求 - CentOS 8.5操作系统 - root权限 - 基本的Linux命令行经验 2. 安装必要的软件包 在终端中执行以下命令: ```bash # yum install -y epel-release # yum install -y httpd mariadb mariadb-devel mariadb-server openssl-devel net-snmp-devel net-snmp-utils wget gcc make php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-snmp ``` 3. 安装Zabbix 6.0 更新软件包之后,从Zabbix官方下载页面下载最新版本的Zabbix源代码。选择适用于CentOS 8的.tar.gz源代码包,将其下载并解压: ```bash # wget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.0.tar.gz # tar xvfz zabbix-6.0.0.tar.gz ``` 更改工作目录: ```bash # cd zabbix-6.0.0/ ``` 在工作目录中执行以下命令: ```bash # ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 # make install ``` 安装好后,将配置文件复制到相应位置: ```bash # cp -rp frontends/php /var/www/html/zabbix ``` 4. 配置数据库 创建名为zabbix的数据库和zabbix用户,为该用户授予对该数据库的访问: ```bash # mysql -u root -p create database zabbix character set utf8 collate utf8_bin; create user 'zabbix'@'localhost' identified by 'zabbixpwd'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; flush privileges; exit; ``` 导入Zabbix数据库模板: ```bash # cd /usr/local/zabbix/share/zabbix/ # mysql -u root -p zabbix < database/mysql/schema.sql # mysql -u root -p zabbix < database/mysql/images.sql # mysql -u root -p zabbix < database/mysql/data.sql ``` 5. 配置Zabbix Server 将配置文件复制到相应位置: ```bash # cp /usr/local/zabbix/etc/zabbix_server.conf /etc/zabbix/ ``` 打开配置文件,并修改以下内容: ```bash DBName=zabbix DBUser=zabbix DBPassword=zabbixpwd ``` 保存并关闭文件。 在终端中启动Zabbix Server并将其设置为开机自启: ```bash # systemctl start zabbix-server # systemctl enable zabbix-server ``` 6. 配置Web服务器 打开配置文件,并修改以下内容: ```bash php_value max_execution_time 300 php_value memory_limit 256M php_value post_max_size 32M php_value upload_max_filesize 16M php_value max_input_time 300 php_value date.timezone Asia/Shanghai ``` 保存并关闭文件。 在终端中启动Apache并将其设置为开机自启: ```bash # systemctl start httpd # systemctl enable httpd ``` 7. 访问Zabbix Web 现在,您可以通过浏览器访问http://your-server-name-or-ip/zabbix来访问Zabbix Web控制台。在登录页面中输入默认的用户名Admin和密码zabbix,即可开始使用Zabbix。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值