Compile the source code to the RPM package —- Take Nginx as an example

Packaging process
Prepare source code software
Install rpm-build
Write compilation configuration file
Compile RPM package

Specific steps

1. Install tool
yum install rpm-build
Install dependent packages
yum -y install gcc pcre-devel zlib-devel openssl-devel

rpmbuild -ba nginx.spec will report an error , No files and directories

Compile the source code into an rpm package----take nginx as an example
But it will automatically create a rpmbuild directory in the current directory (note that it must be in the user’s home directory, this article uses the root user)

Compile the source code into rpm package----take nginx as an example
Compile the source code into an rpm package--- -Take nginx as an example

Store the source code in the rpmbuild directory

SOURCES directory Package
BUILDROOT is a fake root, used to store the rpm package in the directory
SPECS stores the compiled configuration spec file
RPMS stores the generated rpm package

2. Copy the source package
cp nginx-1.8.0.tar.gz /root/rpmbuild/SOURCES

3. Create a new SPEC file
cd /root/rpmbuild/SPECS
vim nginx.spec must be End with .spec

Spec file analysis

Name:nginx software name
Version:1.8.0 software version
Release: 1%{?dist} The default source package is 1 and you can do whatever you want
Summary: nginx web server summary information

#Group: Group package
License:GPL agreement
URL:www.test.com website
Source0:nginx-1.8.0.tar.gz The source package name must be the same as the source package name

#BuildRequires: Dependency
#Requires:

%description Detailed description
this is web server

%pre pre-installation script
%post installation script

%prep
%setup -q unzip and cd in

%build
./configure –with-http_ssl_module can be customized installation Extension module
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} execute make install

%files
%doc
/usr/local/nginx/* Which files are compressed

%changelog

3. Use SPEC files to compile rpm packages
rpmbuild -ba /root/rpmbuild/SPECS/nginx .spec
4. View the generated rpm package
ll /root/rpmbuild/RPMS/x86_64/
Compile the source code into an rpm package----take nginx as an example
cd /root/rpmbuild/RPMS/x86_64/
5. Install and test rpm package
rpm -qpi nginx. rpm

Compile the source code into an rpm package----take nginx as an example
rpm -qpl nginx.rpm

Compile the source code into an rpm package----take nginx as an example
rpm -ivh nginx.rpm Verify installation

Compile the source code into a rpm package----take nginx as an example
ll /usr/local/nginx/

Compile the source code into an rpm package- ---Take nginx as an example

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4674 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.