制作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/

http://mirrors.aliyun.com/rubygems/ added to sources
[root@localhost ~]# gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
[root@localhost ~]#  gem sources -l
*** CURRENT SOURCES ***
http://mirrors.aliyun.com/rubygems/
[root@localhost ~]# gem install fpm
4.3编译nginx
[root@localhost ~]# tar xf nginx-1.6.0.tar.gz -C /usr/src/
[root@localhost nginx-1.6.0]# yum  -y install pcre-devel zlib-devel
[root@localhost nginx-1.6.0]# ./configure --prefix=/usr/local/nginx --with-pcre && make &&make install
4.4打包nginx生成rpm包
[root@localhost ~]# vim nginx.sh

#!/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

[root@localhost ~]# rpm -qi nginx

 

 

 

 

 

 

 

posted @ 2019-11-21 15:17  elin菻  阅读(611)  评论(0编辑  收藏  举报