|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!第一步:起首装置rpm-build软件包:完成天生rpm包操纵
[root@server1~]#rpm-qa|greprpm-build
[root@server1~]#yuminstall-yrpm-build
第二步:制造httpd.spec文件
注:必需一般用户来做
[root@server1~]#useraddtom
[root@server1~]#su-tom
[tom@server1~]$vimhttpd.spec
[tom@server1~]$cathttpd.spec
Name:httpd//步伐名
Version:2.2.25//版本号
Release:1%{?dist}
Summary:compiledfrom2.2.25byzsp//形貌信息,这个能够自界说写
Group:SystemEnvironment/Daemons
License:GPL
URL:http://www.tarnea.com//自界说该信息
Source0:httpd-2.2.25.tar.gz//源文件称号,需和上面第四步对应,文件称号要一向
BuildRoot:%(mktemp-ud%{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires:gcc,gcc-c++,openssl-devel//天生rpm包所必要的软件撑持
Requires:wireshark-gnome//实行该rpm
%description
Apachewebserver.Compiledfrom2.2.25byzsp
%prep
%setup-q
%build
./configure--prefix=/usr/local/httpd--enable-so--enable-rewrite--enable-cgi--enable-ssl--enable-charset-lite--enable-suexec--with-suexec-caller=daemon--with-suexec-docroot=/usr/local/httpd/htdocs
make%{?_smp_mflags}
%install//装置之前需初始化装置目次
rm-rf%{buildroot}
makeinstallDESTDIR=%{buildroot}
%clean
rm-rf%{buildroot}
%files//装置以后天生的文件
%defattr(-,root,root,-)
%defattr(-,root,root,-)
/usr/local/httpd/bin/*
/usr/local/httpd/build/*
/usr/local/httpd/cgi-bin/*
%config/usr/local/httpd/conf/*
/usr/local/httpd/error/*
/usr/local/httpd/htdocs/*
/usr/local/httpd/icons/*
/usr/local/httpd/include/*
/usr/local/httpd/lib/*
%dir/usr/local/httpd/logs
%doc/usr/local/httpd/man/*
%doc/usr/local/httpd/manual/*
/usr/local/httpd/modules/*
%post//装置以后必要实行的举措,将apachectl拷贝成myhttpd
cp/usr/local/httpd/bin/apachectl/etc/init.d/myhttpd
sed-i1a#chkconfig:23458515/etc/init.d/myhttpd
sed-i2a#description:apachewebserver/etc/init.d/myhttpd
chkconfig--addmyhttpd
%preun//卸载该rpm包所实行的一些操纵
/etc/init.d/myhttpdstop
chkconfig--delmyhttpd
%changelog//界说一些日记文件,可使用:rpm-q--changeloghttpd检察到
*WedMar262014zhangzhg<zsp@tarena.com>2.2.25
-firstrpmfromhttpd-2.2.25
[tom@server1~]$
第三步:天生相干目次
[tom@server1~]$ls
httpd-2.2.25.tar.gzhttpd.spec
[tom@server1~]$rpmbuildhttpd.spec//天生相干目次,有毛病范例的提醒信息,属一般
error:File/home/tom/rpmbuild/SOURCES/httpd-2.2.25.tar.gz:Nosuchfileordirectory
[tom@server1~]$ls
httpd-2.2.25.tar.gzhttpd.specrpmbuild//天生以后会呈现rpmbuild目次
[tom@server1~]$lsrpmbuild/
BUILDBUILDROOTRPMSSOURCESSPECSSRPMS//rpmbuild目次下有这六个目次
第四步:把文件拷贝到指定目次
[tom@server1~]$cphttpd.specrpmbuild/SPECS/
[tom@server1~]$cphttpd-2.2.25.tar.gzrpmbuild/SOURCES/
第五步:天生RPM包
[tom@server1~]$rpmbuild-barpmbuild/SPECS/httpd.spec
假如没法实行,则大概会提醒没有装置gcc、gcc-c++和openssl-devel软件,加入tom用户,实行yum装置便可;[root@server1~]#yuminstall-ygccgcc-c++openssl-devel
装置完成后,会在在RPMS目次下天生rpm包,在SRPMS目次下天生源码包:
[tom@server1~]$lsrpmbuild/RPMS/x86_64/
httpd-2.2.25-1.el6.x86_64.rpm
[tom@server1~]$lsrpmbuild/SRPMS/
httpd-2.2.25-1.el6.src.rpm
[tom@server1~]$
第六步:测试重生成的RPM包
[root@server1~]#cp/home/tom/rpmbuild/RPMS/x86_64/httpd-2.2.25-1.el6.x86_64.rpm.
[root@server1~]#rpm-ivhhttpd-2.2.25-1.el6.x86_64.rpm
//因为在httpd.spec文件中设置了依附干系,以是装置的时分会提醒有wireshark-gnome的依附,做这个设置为了考证rpm制造时的依附选项,以是,能够经由过程疏忽依附干系装置。
error:Faileddependencies:
wireshark-gnomeisneededbyhttpd-2.2.25-1.el6.x86_64
[root@server1~]#rpm-ivh--nodepshttpd-2.2.25-1.el6.x86_64.rpm//疏忽依附干系装置
Preparing...###########################################[100%]
1:httpd###########################################[100%]
[root@server1~]#rpm-e--nodepshttpd-2.2.25-1.el6.x86_64
httpd(nopidfile)notrunning
//因为没有开启myhttpd,而在httpd.spec文件中设置了%preun选项,以是会有提醒说httpd没有运转
[root@server1~]#
欢迎大家来到仓酷云论坛! |
|