CentOS定制RPM包、搭建yum仓库的教程
CentOS定制RPM包
1、准备源码包
我们需要准备一个源码包,这里以nginx为例,从官网下载源码包:
wget http://nginx.org/download/nginx-1.20.1.tar.gz
2、安装依赖库
编译源码包之前,需要先安装一些依赖库,这里以编译nginx为例,安装gcc、pcre等依赖库:
yum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
3、解压源码包
解压下载好的源码包:
tar -zxvf nginx-1.20.1.tar.gz
4、进入源码目录
解压后,进入源码目录:
cd nginx-1.20.1
5、配置、编译源码包
配置源码包,指定安装路径、模块等信息:
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/include --with-openssl=/usr/include --with-stream --without-http_autoindex_module --without-http_geo_module --without-http_limit_conn_module --without-http_limit_req_module --without-http_map_module --without-http_memcached_module --without-http_referer_module --without-http_scgi_module --without-http_split_clients_module --without-http_ssi_module --without-http_userid_module --without-http_uwsgi_module --without-http_fastcgi_module --without-http_auth_request_module --without-http_browser_module --without-http_empty_gif_module --without-http_upstream_ip_hash_module --without-http_upstream_least_conn_module --without-http_upstream_keepalive_module --without-http_upstream_zone_module --without-http_sysguardian_module --without-http_sub_module --without-http_dav_module --without-http_flv_module --without-http_mp4_module --without-http_gunzip_module --without-http_gzip_static_module --without-http_random_index_module --without-http_secure_link_module --without-http_degradation_module --without-http_slice_module --without-http_imagemap_module --without-http_dynamic_module --without-http_xslt_module --without-mail --without-mail_pop3 module
编译源码包:
make && make install
6、创建RPM包
使用rpmbuild工具创建RPM包:
rpmbuild -ba nginx.spec
搭建yum仓库
1、准备RPM包和元数据文件
将上一步生成的RPM包和元数据文件上传到服务器:
mkdir /var/www/html/repo/centos7/x86_64/Packages/nginx/ cp /usr/local/nginx/root/* /var/www/html/repo/centos7/x86_64/Packages/nginx/ cp /usr/local/nginx/root/SPECS/* /var/www/html/repo/centos7/x86_64/SPECS/nginx/
2、安装createrepo工具
安装createrepo工具,用于生成元数据索引:
yum install -y createrepo yum-utils createrepo-cron rsync wget curl bind-utils net-tools nfs-utils rpcbind portmap vsftpd proftpd mod\* mod\*\* perl perl\* perl\** python python\* python\*\* gpg gpg\* gpg\*\* patch patch\* patch\*\* tar tar\* tar\*\* zip zip\* zip\** unzip unzip\* unzip\*\* file file* file\*\* findutils findutils\* findutils\*\* xz xz\* xz\*\* bzip2 bzip2\* bzip2\*\* readline readline\* readline\** zlib zlib\* zlib\*\* openssl openssl\* openssl\** gdbm gdbm* gdbm\*\* db db\* db\** ncurses ncurses* ncurses\*\* libacl libacl\* libacl\*\* libattr libattr\* libattr*\* libcap libcap* libcap\*\* libselinux libselinux\* libselinux\*\* libsemanage libsemanage\* libsemanage\*\* libsepol libsepol\* libsepol\*\* libxml2 libxml2\* libxml2\*\* compat compat-\{gcc,glibc,glibc-\}\{headers,devel,static,utils,lang,profile,math,nss,nss-\} glibc glibc-\{headers,devel,static,utils,lang,profile,math,nss,nss-\} krb5 krb5-\{libs,devel,headers,doc,localedata,} libcompat compat-\{gcc,glibc,glibc-\}\{headers,devel,static,utils,lang,profile,math,nss,nss-} libstdc++ stdc++-\{devel,headers,\} gdb gdb-\{gdbserver,\} binutils binutils-{devel,headers,\} syslog syslog-\{syslogd,\} logrotate logrotate-\{devel,\} lvm2 lvm2-\{devices,\} lvm2-\{libs,\} lvm2-\{python,\} device-mapper device-mapper-\{event,\} device-mapper-\{libs,\} device-mapper-\{multipath,\} device-mapper-\{python,\} udev udev-\{devel,\} udev-\{libs,\} udev-\{rules,\} e2fsprogs e2fsprogs-\{e2fsprogs,\} e2fsprogs-\{libext2fs2,\} e2fsprogs-\{libuuid,\} dosfstools dosfstools-\{dosfstools,\} dosfstools-\{libcomerr,\} dosfstools-\{libmsdosfs,\} dosfstools-\{progs,\} xfsprogs xfsprogs-\{base,\} xfsprogs-{libxfs,\} xfsprogs-\{scripts,\} jq jq \*} createrepo createrepo \*} rsync rsync \*} wget wget \*} curl curl \*} bind bind \*} net net \*} nfs nfs \*} rpcbind rpcbind \*} portmap portmap \*} vsftpd vsftpd \*} proftpd proftpd \*} mod mod \*} mod mod \*} perl perl \*} perl perl \*} python python \*} python python \*} gpg gpg \*} gpg gpg \*} patch patch \*} patch patch \*} tar tar \*} tar tar \*} zip zip \*} zip zip \*} unzip unzip \*} unzip unzip \*} file file \*} file file \*} findutils findutils \*} findutils findutils \*} xz xz \*} xz xz \*} bzip2 bzip2 \*} bzip2 bzip2 \*} readline readline \*} readline readline \*} zlib zlib \*} zlib zlib \*} openssl openssl \*} openssl openssl \*} gdbm gdbm \*} gdbm gdbm \*} db db \*} db db \*} ncurses ncurses \*} ncurses ncurses \*} libacl libacl \*} libacl libacl \*} libattr libattr \*} libattr libattr \*} libcap libcap \*} libcap libcap \*} libselinux libselinux \*} libselinux libselinux \*} libsemanage libsemanage \*} libsemanage libsemanage \supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries supplementary libraries
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/327986.html