制作nginx的rpm包
制作nginx的rpm包
必须在联网的情况下使用
1、基于FPM制作RPM包,搭建Epel Yum源
上传安装包:epel-release-latest-7.noarch.rpm
[root@localtion ~]# rpm -ivh epel-release-latest-7.noarch.rpm
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg 公共
epel-release-latest-7.noarch.rpm original-ks.cfg 模板
[root@localhost ~]# ls /etc/yum.repos.d/
a local.repo
[root@localhost ~]# rpm -ivh epel-release-latest-7.noarch.rpm
警告:epel-release-latest-7.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:epel-release-7-11 ################################# [100%]
[root@localhost ~]# ls /etc/yum.repos.d/
a epel.repo epel-testing.repo local.repo
[root@localhost ~]# mv /etc/yum.repos.d/a/CentOS-Base.repo /etc/yum.repos.d/
[root@localhost ~]# ls /etc/yum.repos.d/
a epel.repo local.repo
CentOS-Base.repo epel-testing.repo
[root@localhost yum.repos.d]# vim epel.repo
[root@localhost yum.repos.d]# yum clean all && yum makecache
2、安装ruby 环境和gem命令FPM
gem命令是从rubygem仓库安装软件类似yum从yum仓库安装软件
[root@localtion ~]# yum install -y ruby rubygems ruby-devel
[root@localhost ~]# gem update --system
[root@localhost ~]# gem sources -a http://mirrors.aliyun.com/rubygems/
[root@localhost ~]# gem sources --remove https://rubygems.org/
[root@localhost ~]# gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
[root@localhost ~]# gem sources -l
*** CURRENT SOURCES ***
#!/bin/bash
useradd -M -s /sbin/nologin nginx
ln -s /usr/local/nginx/sbin/nginx /sbin/
echo www.crushlinux.com > /usr/local/nginx/html/index.html
nginx
[root@localhost ~]# chmod +x nginx.sh
[root@localhost ~]# fpm -s dir -t rpm -n nginx -v 1.10.2 -d 'pcre-devel,zlib-devel' -f --post-install /root/nginx.sh /usr/local/nginx
[root@localhost ~]# rpm -ivh nginx-1.10.2-1.x86_64.rpm