Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Customize rpm package and build yum warehouse

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Customize rpm package and build yum warehouse

Chapter 1 customized rpm package 1.FPM Packaging tool

The author of FPM is jordansissel

Github: https://github.com/jordansissel/fpm of FPM

The FPM function is simply to convert one type of package to another.

Supported source type packages:

Dir packages the directory into the desired type, which can be used in software packages compiled and installed by source code

Rpm converts rpm

Gem converts rubygem packages

Python packages the python module into the appropriate type

2.fpm installation

[root@student ~] # yum-y install ruby rubygemsruby-devel

Install the ruby module

[root@web01] # gem sources-a http://mirrors.aliyun.com/rubygems/

Http://mirrors.aliyun.com/rubygems/ added tosources

Add Aliyun's Rubygems warehouse, foreign resources will affect the download speed

[root@student ~] # gem sources-- remove http://rubygems.org/

Http://rubygems.org/ removed from sources

Remove native ruby repositories

[root@student ~] # gem installfpm

Install fpm

Common parameters of 3.fpm

-s # specify the source type

-t # specify the target type, that is, why you want to make the package

-n # specify the name of the package

-v # specify the version number of the package

-C # specifies the relative path of packaging Change directory tohere before searching forfiles

-d # specify which packages to depend on

-f # if an installation package with the same name exists in the directory during the second packaging, overwrite it

The directory of the installation package output from-p #. If you don't want to put it in the current directory, you need to specify it.

-- script to run after post-install # package installation is complete; same as-- after-install

-- script to run before pre-install # package installation is complete; same as-- before-install

-- script to run after the post-uninstall # package has been uninstalled; same as-- after-remove

-- script to run before the pre-uninstall # package is uninstalled; same as-- before-remove

4. Install nginx

Yum-y install pcre-devel openssl-devel

Useradd nginx-M-s / sbin/nologin

Tar xf nginx-1.6.2.tar.gz

Cd nginx-1.6.2

. / configure-- prefix=/application/nginx-1.6.2--user=nginx-- group=nginx-- with-http_ssl_module--with-http_stub_status_module

Make & & make install

Ln-s / application/nginx-1.6.2/ / application/nginx

5. Write a script

[root@oldboy ~] # cd/server/scripts/

[root@oldboy scripts] # vimnginx_rpm.sh

#! / bin/bash

Useradd nginx-M-s / sbin/nologin

Ln-s / application/nginx-1.6.2//application/nginx

6. Packing

[root@web01 application] # yum-yinstall rpm-build

[root@oldboy] # fpm-s dir-t rpm-n nginx- v 1.6.2-d 'pcre-devel,openssl-devel'-- post-install/server/scripts/nginx_rpm.sh-f / application/nginx-1.6.2/

No value for epoch is set,defaulting to nil {: level= >: warn}

No value for epoch is set,defaulting to nil {: level= >: warn}

Created package {: path= > "nginx-1.6.2-1.x86_64.rpm"}

[root@oldboy] # ll-hnginx-1.6.2-1.x86_64.rpm

-rw-r--r-- 1 root root 6.7MNov 1 10:02 nginx-1.6.2-1.x86_64.rpm

4. Install the RPM package

Rpm-ivh nginx-1.6.2-1.x86_64.rpm

Yum-y localinstallnginx-1.6.2-1.x86_64.rpm

Chapter 2 sets up yum warehouse server configuration: 1. Create a yum warehouse directory

Mkdir-p / application/yum/centos6/x86_64/

two。 Install createrepo softwar

Yum-y install createrepo

3. Initialize the repodata index file

Createrepo-pdo/application/yum/centos6.6/x86_64/ / application/yum/centos6.6/x86_64/

4. Enter the directory where you need to provide a warehouse

Cd / application/yum/centos6/x86_64/

5. Configure web to view yum

Python-m SimpleHTTPServer80 & > / dev/null &

/ / you can use Apache or nginx to provide web services, but the http module of Python is simpler and suitable for private network environment, and can be viewed by entering native IP through the browser.

6. Update every time you add a rpm package

Createrepo--update / application/yum/centos6/x86_64/

7. Save downloaded software

Sed-I's keepcache1 etc/yum.conf / keepcache1

/ / modify the yum configuration file keepacache=0 to 1

8. Installation package storage directory

Ls / var/cache/yum/x86_64/6/base/packages

Client configuration: 1. Configure local yum source files

[root@B yum.repos.d] # cd / etc/yum.repos.d

[root@B yum.repos.d] # vi oldboy.repo connects to the local yum source

[oldboy]

Name=oldboy

Baseurl= http://10.0.0.61

Enable=1

Gpgcheck=0

two。 Specify that the new yum source takes effect

[root@YUM] # yum-- enablerepo=oldboy-- disablerepo=base,extras,updates,epellist

Specify the use of the oldboy library (effective temporarily)

3. Make the yum source permanent

[root@oldboy yum.repos.d] # vim / etc/yum.repos.d/CentOS-Base.repo

# add to each startup source

# enabled=0# is enabled if it is changed to 1, or if this parameter is not used.

[base]

Enabled=0

.

[updates]

.

Enabled=0

.

[extras]

.

Enabled=0

# other open warehouses are closed using this method

4. View existing yum feeds

[root@web01 ~] # yum repolist

5. Synchronize public network yum source

The upstream yum source must support the rsync protocol, otherwise rsync cannot be used for synchronization.

Official standard source of CentOS: rsync://mirrors.ustc.edu.cn/centos/

Epel source: rsync://mirrors.ustc.edu.cn/epel/

Source: http://mirrors.163.com/

Ali Yunyuan: http://mirrors.aliyun.com/

# synchronizing base feeds

/ usr/bin/rsync-av rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64//data/yum_data/centos/6/os/x86_64/

# epel Source

/ usr/bin/rsync-av-- exclude=debugrsync://mirrors.ustc.edu.cn/epel/6/x86_64/ / data/yum_data/epel/6/x86_64/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report