| 
					[root@server1 ~]# useradd tom 
					[root@server1 ~]# su - tom 
					[tom@server1 ~]$ vim httpd.spec 
					[tom@server1 ~]$ cat httpd.spec 
					Name:       httpd              //程序名 
					Version:    2.2.25            //版本号 
					Release:    1%{?dist} 
					Summary:    compiled from 2.2.25 by zsp         //描述信息,这个可以自定义写 
					  
					Group:      System  Environment/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 
					Apache web server. Compiled from  2.2.25 by zsp 
					  
					%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} 
					make install DESTDIR=%{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 -i '1a # chkconfig:  2345 85 15' /etc/init.d/myhttpd 
					sed -i '2a #  description: apache web server' /etc/init.d/myhttpd 
					chkconfig --add myhttpd 
					  
					%preun                         //卸载该rpm包所执行的一些操作 
					/etc/init.d/myhttpd stop 
					chkconfig --del myhttpd 
					  
					  
					%changelog                       //定义一些日志文件,可以使用:rpm -q  --changelog httpd查看到 
					* Wed Mar 26 2014  zhangzhg <zsp@tarena.com> 2.2.25 
					- first rpm from  httpd-2.2.25 
					  
					[tom@server1 ~]$ |