在银河麒麟 V10 SP1(Kylin Linux Advanced Server V10 SP1)环境中,官方源提供的 Nginx 和 Redis 版本通常较低。为了满足更高性能、安全性和新特性需求,本文提供自行编译打包的 Nginx 1.29.8 和 Redis 8.6.2 RPM 安装包,支持 ARM64(aarch64) 和 x86_64 两种架构,可直接离线安装,特别适合信创和内网环境使用。
一、适用环境
- 操作系统:银河麒麟 V10 SP1
- 支持架构:ARM64(aarch64) + x86_64
- Nginx 版本:1.29.8
- Redis 版本:8.6.2
- 安装方式:RPM 离线安装
二、安装包下载
请根据您的服务器架构选择对应 RPM 包:
Nginx 1.29.8 RPM:
Redis 8.6.2 RPM:
安装包已在银河麒麟 V10 SP1 对应架构下编译测试通过,其他系统及版本,请自测!
三、编译参数说明
Nginx 1.29.8 编译参数
采用以下 configure 参数进行编译打包:
./configure \
--prefix=/app/nginx \
--sbin-path=/app/nginx/sbin/nginx \
--conf-path=/app/nginx/conf/nginx.conf \
--pid-path=/app/nginx/logs/nginx.pid \
--lock-path=/app/nginx/logs/nginx.lock \
--error-log-path=/app/nginx/logs/error.log \
--http-log-path=/app/nginx/logs/access.log \
--http-client-body-temp-path=/app/nginx/temp/client_body_temp \
--http-proxy-temp-path=/app/nginx/temp/proxy_temp \
--http-fastcgi-temp-path=/app/nginx/temp/fastcgi_temp \
--http-uwsgi-temp-path=/app/nginx/temp/uwsgi_temp \
--http-scgi-temp-path=/app/nginx/temp/scgi_temp \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-ipv6 \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module \
--without-http_fastcgi_module \
--with-cc-opt="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -march=native" \
--with-ld-opt="-Wl,-z,relro -Wl,-z,now"
Redis 8.6.2 编译参数(SPEC 文件核心)
Redis 采用官方推荐方式编译,并特别添加 systemd-devel 依赖以支持 systemd 通知:
make %{?_smp_mflags} USE_SYSTEMD=yes MALLOC=libc
关键处理:
- 使用 USE_SYSTEMD=yes 开启 systemd 支持
- 使用 MALLOC=libc 提升兼容性(适合银河麒麟环境)
- 安装后自动创建 redis 系统用户和组
- 默认配置文件路径调整为 /etc/redis/redis.conf
- 安装时自动生成随机强密码(requirepass 和 masterauth),并在安装完成后提示用户查看
Redis systemd 服务文件(内置于 RPM)
[Unit] Description=Redis In-Memory Data Store Documentation=https://redis.io/ After=network.target [Service] Type=notify ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd ExecStop=/usr/bin/redis-cli shutdown Restart=always User=redis Group=redis RuntimeDirectory=redis RuntimeDirectoryMode=0755 LimitNOFILE=65535 [Install] WantedBy=multi-user.target
四、安装步骤
1. 准备工作
mkdir -p /root/packages && cd /root/packages
2. 安装 Nginx
dnf install -y pcre openssl zlib libatomic rpm -ivh nginx-1.29.8-1.ky10.$(uname -m).rpm nginx -v
3. 安装 Redis
rpm -ivh redis-8.6.2-1.ky10.$(uname -m).rpm redis-server --version redis-cli --version
4. 启动服务
Nginx:
nginx -t systemctl daemon-reload systemctl start nginx systemctl enable nginx systemctl status nginx
Redis:
systemctl daemon-reload systemctl start redis systemctl enable redis systemctl status redis # 查看自动生成的随机密码 grep '^requirepass' /etc/redis/redis.conf
五、常见问题排查
- 端口占用:Nginx(80/443)、Redis(6379)。
- 防火墙:
firewall-cmd --permanent --add-port=80/tcp --add-port=443/tcp --add-port=6379/tcp firewall-cmd --reload
- SELinux:如遇权限问题,可临时 setenforce 0 测试。
六、卸载方法
rpm -e nginx rpm -e redis
七、注意事项
- Redis 安装完成后会自动生成随机密码,请务必记录并尽快修改为自己的强密码。
- 生产环境建议:Nginx 配置 HTTPS,为 Redis 设置绑定 IP(bind 127.0.0.1 ::1 或指定内网 IP)。
- 本 RPM 包已在银河麒麟 V10 SP1 ARM & x86 环境下充分测试。
» 本文链接:银河麒麟操作系统 V10 SP1(ARM/x86)Nginx 1.29.8 和 Redis 8.6.2 RPM 安装包
» 转载请注明来源:刺客博客
» 如果文章失效或者安装失败,请留言进行反馈。
» 转载请注明来源:刺客博客
» 如果文章失效或者安装失败,请留言进行反馈。