制作源码软件的RPM包



制作源码软件的RPM包


使用nginx-1.12.2版本的源码软件,生产对应的RPM包软件

具体步骤:
1.安装rpm-build软件
# yum -y install rpm-build

2.生成rpmbuild目录结构
# rpmbuild -ba nginx.spec
# ls /root/rpmbuild
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
【会报错,没有文件或目录,目的:自动生成的目录结构】

3.将源码软件复制到SOURCES目录
# cp nginx-1.12.2.tar.gz /root/rpmbuild/SOURCES/


4.创建并修改SPEC配置文件
# vim /root/rpmbuild/SPECS/nginx.spec
Name:nginx //软件名称
Version:1.12.2 //软件版本
Release:1 //作者制作次数
Summary:This is a web server // 软件描述
#Group:
License:GPL
URL:www.sex.org
Source0:nginx-1.12.2.tar.gz 来源名称(不要写错)

#BuildRequires:gcc 所需编译软件
#Requires:

%description
this is a web server and it is very great

%prep
%setup -q //自动解压源码包,并cd进入目录


%build
./configure
make %{?_smp_mflags}


%install
make install DESTDIR=%{buildroot}


%files
%doc
/usr/local/nginx/* 对那些目录打包


%changelog



5.安装依赖包
# yum –y install gcc pcre-devel zlib-devel openssl-devel


6.rpmbuild创建RPM软件包
# rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec


7.查看已经制作成功的软件包
# ls /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm


8.查看软件的具体介绍『刚刚第4步操作内容』
# rpm -qpi RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm


小结:
整体制作不是特别的困难,需注意的是所需制作的软件的源码不可缺少,复制和修改文件的路径不要错误。
制作成功后的rpm软件包也可加入到yum源仓库中,方便分享和下次使用


Cenos 6.7 x86_64 yum安装 yum localinstal nginx-1.6.3-1.x86_64.rpm 定制安装过程 1: FPM 打工具安装 修改yum源: 备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 安装阿里云yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 安装依赖 yum -y install ruby rubygems ruby-devel 添加阿里云的Rubygems 仓库 gem sources -a http://mirrors.aliyun.com/rubygems/ #移除原生Ruby仓库 gem sources --remove http://rubygems.org/ 指定安装版本 gem install fpm -v 1.3.3 wget http://nginx.org/download/nginx-1.9.7.tar.gz wget http://nginx.org/download/nginx-1.6.3.tar.gz mkdir -p /application/tools cd /application/tools/ find /var/cache/yum/ -name "*rpm" yum install pcre-devel openssl-devel find /var/cache/ -type f -name '*rpm' find /var/cache/ -type f -name '*rpm'|xargs cp -t /tmp/ cd /tmp tar zcf nginx_yum.tar.gz *.rpm sz nginx_yum.tar.gz cd /application/tools/ useradd nginx -M -s /sbin/nologin tar zxf nginx-1.6.3.tar.gz ./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module make make install ln -s /application/nginx-1.6.3/ /application/nginx /application/nginx/sbin/nginx ss -lntup|grep nginx ps -ef|grep nginx|grep -v grep netstat -lntup|grep nginx|grep -v grep curl 127.0.0.1 mkdir -p /server/scripts cd /server/scripts/ fpm -s dir -t rpm -n nginx -v 1.6.3 -d 'pcre-devel,openssl-devel' --post-install /server/scripts/nginx_rpm.sh -f /application/nginx-1.6.3/ 检查 rpm -qpl nginx-1.6.3-1.x86_64.rpm [root@nginx tools]# rpm -qpl nginx-1.6.3-1.x86_64.rpm /application/nginx-1.6.3/client_body_temp /application/nginx-1.6.3/conf/fastcgi.conf /application/nginx-1.6.3/conf/fastcgi.conf.default /application/nginx-1.6.3/conf/fastcgi_params /application/nginx-1.6.3/conf/fastcgi_params.default /application/nginx-1.6.3/conf/koi-utf /application/nginx-1.6.3/conf/koi-win /application/nginx-1.6.3/conf/mime.types /application/nginx-1.6.3/conf/mime.types.default /a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值