溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

六、Linux企業(yè)級YUM軟件管理

發(fā)布時(shí)間:2020-10-17 14:38:37 來源:網(wǎng)絡(luò) 閱讀:762 作者:blackstome 欄目:數(shù)據(jù)庫

一、軟件包的安裝

程序員首先通過開發(fā)工具開發(fā)出軟件來,最初的稱為源碼包,就是人能看的明白的。然后編譯成機(jī)器可以看懂的二進(jìn)制軟件。而rpm就是紅帽公司研發(fā)的適合自動化安裝軟件的一套軟件管理工具。包含軟件的存放位置,庫文件、頭文件,配置文件、文件間依賴關(guān)系等各種關(guān)系的管理工作。

1、軟件包的組成部分

二級制程序:

                   安裝位置:/bin /sbin、/usr/bin、/usr/sbin、/usr/local/bin、/usr/local/sbin。

庫文件:也可以是可執(zhí)行程序,可以是被其他程序調(diào)用的。在開發(fā)中通常稱為函數(shù),公共函數(shù)越多(庫文件),軟件包的適應(yīng)性越強(qiáng),包越小。

                   安裝位置:/lib、/usr/lib、/usr/local/lib

配置文件:/etc/

幫助文件/手冊:/usr/share/doc/

2、軟件包管理工具(rpm):

文件清單

文件放置路徑

提供的功能說明

依賴關(guān)系

3、rpm:package manager 軟件包管理器

具有的功能:打包、安裝、查詢、卸載、升級、校驗(yàn)。

打包:就是將源碼編譯成可以安裝、執(zhí)行的軟件包。

4、編譯軟件包依賴的環(huán)境:

4.1編譯器:gcc,g++

提供編譯環(huán)境,通常需要指明二進(jìn)制文件的路徑及庫文件的路徑

4.2庫:/etc/ld.so.conf、/etc/ld.so.conf.d/*.conf

4.3手冊路徑:/etc/man.config。man -M

4.4頭文件:協(xié)調(diào)各個(gè)文件。默認(rèn):/usr/include。

編譯過程需要收集編譯所需要的庫文件,如果庫文件不健全,編譯不會成功。

5、程序安裝的種類:

1、通用二級制格式(類似綠色軟件,解壓后直接使用)

2、軟件包管理器rpm

3、源代碼編譯

知識點(diǎn):java實(shí)現(xiàn)跨平臺的根本就是由于java有一個(gè)虛擬機(jī)jvm,但是這個(gè)jvm是有系統(tǒng)平臺要求的,它的上面java程序都可以運(yùn)行,這樣就解決了跨平臺問題。

6、RPM包的命名規(guī)范

源程序命名:major.minor.release.tar.gz(bz2/xz)

主版本號.次版本號.修改次數(shù).適用平臺.適用CPU類型.tar.壓縮格式

rpm包命名:name-version-release.arch.rpm

發(fā)行號:用于標(biāo)示rpm編譯的發(fā)行號。                

                   el6:redhat 6以上

                   el5:redhat 5

                   suse11:suse11版以上

arch:主機(jī)平臺

           i686:p2以上cpu,32位

           x86-64:64位

           amd64:debian 64位

           ppc 

           noarch:無平臺限制

rpm分包:將一個(gè)大的軟件包依據(jù)功能分成多個(gè)軟件包,所以安裝過程中需要先安裝主包,依據(jù)情況安裝支包。(bind和bind_devel)


7、rpm軟件包驗(yàn)證

rpm包驗(yàn)證機(jī)制:可以驗(yàn)證來源的合法性、軟件包的完整性。

系統(tǒng)安裝完畢后會在/etc/pki/rpm-gpg/目錄下將官方的公鑰放在這里。要驗(yàn)證從網(wǎng)絡(luò)上下載的rpm包是否真實(shí)可靠,需要先通過命令導(dǎo)入公鑰,然后進(jìn)行驗(yàn)證。

查找公鑰

locate GPG-KEY

1、導(dǎo)入公鑰

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 

2、驗(yàn)證軟件包合法性

[root@localhost ~]# rpm -K zsh-4.3.10-7.el6.i686.rpm 
zsh-4.3.10-7.el6.i686.rpm: rsa sha1 (md5) pgp md5 OK

二、RPM命令

1、參數(shù):

-K:檢測rpm包完整性合法性。默認(rèn)

--nodigest:不檢查完整性

--no signature:不檢查合法性

--install、-i:安裝

-v:顯示詳細(xì)信息。

-h:顯示進(jìn)度條

--nodeps:忽略依賴關(guān)系,安裝不一定可用。

--test:測試安裝

--prefix  :指定新的安裝路徑


2、卸載

--replacepkgs:重新安裝軟件包

-e:卸載軟件包 --nodeps可用不卸載依賴包

卸載和重新安裝過程中,如果之前對軟件的配置文件進(jìn)行過更改,linux是會將修改的文件在原路徑上另存一份并重新命名的,以保障用戶配置文件的完整。

[root@localhost]~# rpm -e zsh

warning: /etc/zlogin saved as /etc/zlogin.rpmsave

3、查詢

-q、--query:查詢包信息是否安裝。

-qi:查看軟件包詳細(xì)信息

-qa:查詢所有已安裝的rpm軟件匯總(qi順序不能顛倒)

-qd:查詢r(jià)pm包的幫助文檔安裝路徑

-ql:查詢指定軟件包包含的文件(list)

-qc:只顯示rpm包的配置文件

-qf:查詢指定文件所屬軟件

-qR:查詢軟件的依賴關(guān)系

4、查詢r(jià)pm包的相關(guān)腳本:

rpm -q --scripts

perinstall:安裝前腳本

postinstall:安裝后腳本

preuninstall:卸載前腳本

postunstaill:卸載后腳本

5、查詢未安裝的包的相關(guān)信息:

rpm -qp(i、l、d、c) rpm包名

6、升級

-U:沒安裝就安裝,有安裝則更新

-F:只更新,不安裝。

-Uvh或者-Fvh

注意:內(nèi)核不應(yīng)該升級,而是選擇安裝,本身內(nèi)核允許多版本的存在。

7、校驗(yàn)和數(shù)字證書

-V:校驗(yàn)安裝的軟件包配置文件等信息是否被修改過。

-Va:列出系統(tǒng)所有安裝的軟件被改動的文件

-Vp:后面加文件,顯示所屬軟件可能被改動的文件

-Vf:列出摸個(gè)文件是否被改動過


[root@client ~]# rpm -Va 
S.5....T.  c /etc/login.defs
.......T.  c /etc/inittab
.......T.  c /etc/rc.d/rc.local
文件類型
c(config):表示配置文件
d(document):文檔
l(license):授權(quán)文件
r(readme):readme文件
屬性:
S(size):文件的容量大小是否被更改
M(modediffers):文件類型、屬性是否更改
5:md5已經(jīng)不同
D(device):設(shè)備的主次號碼改變
L(link):link路徑更改
U(user):文件所有者更改
G(group):文件屬組更改
T(time):文件創(chuàng)建時(shí)間更改

三、RPM數(shù)據(jù)庫

rpm軟件之間的依賴關(guān)系是通過數(shù)據(jù)庫保存的,每次yum安裝軟件時(shí)會先從yum倉庫中同步數(shù)據(jù)庫信息,并保存在/var/lib/rpm/目錄下,關(guān)系rpm軟件的正常使用。

如果出現(xiàn)損壞,需要重建:

--initdb:初始化數(shù)據(jù)庫。不會覆蓋原有數(shù)據(jù)庫

--rebuilddb:重建rpm數(shù)據(jù)庫。

四、YUM命令

1、查詢

list:用來顯示相關(guān)程序包 (all、installed、available)

yum list all bind* :顯示所有倉庫中和以安裝的bind*包

repolist:顯示可用的倉庫(all、enable、disabled)

info:查看包的安裝情況及詳細(xì)信息。

grouplist:可用及以安裝的軟件組

groupinfo “group-name”:顯示包組內(nèi)容及信息

清理緩存(清理的是已經(jīng)安裝的軟件及包組的相關(guān)信息,從服務(wù)器上下載的安裝包)

clean:清理緩存(packages、metadata)

makecache:手動建立緩存

2、安裝

install:安裝

groupinstall:安裝軟件包組

reintall:重新安裝

info:顯示指定軟件包的詳細(xì)信息

list:列出yum倉庫所管理的所有軟件(包括未安裝的)

update:軟件包升級,不指定軟件包升級全部。

update-to:升級到指定版本。

check-update:檢查可以升級的軟件包最新版本

(upgrade、upgrade-to廢棄了)

3、卸載

remove:默認(rèn)會將被卸載包所依賴的包一同卸載,需要注意。

清理下載文件:

緩存位置:/var/cache/yum

清理參數(shù):clean

        packages:刪除已下載的軟件包

        headers:刪除軟件文件頭,類似索引列表

        metadata:刪除yum倉庫信息。

4、文件的所屬軟件包

provides:查詢指定文件是由那個(gè)軟件包生成的。

search:模糊匹配查詢命令,查找包含不完整文件名的所有文件。

5、安裝軟件包組

安裝開發(fā)環(huán)境依賴的軟件包組:

Development Tools

Server Platform Development

Desktop Platform Development

軟件包組的安裝、更新

groupinstall、groupupdate、groupremove

五、YUM倉庫的創(chuàng)建


createrepo:創(chuàng)建程序倉庫。

yum倉庫通常都是在互聯(lián)網(wǎng)上由大公司提供的,我們只需要在本地創(chuàng)建配置文件,并將yum源指向哪里就可以了。當(dāng)然也可以創(chuàng)建自己本地的yum倉庫。通常數(shù)據(jù)庫文件默認(rèn)存放位置為/var/lib目錄下。

1、yum源配置文件

/etc/yum.repos.d/*.repo

[base]

name=CentOS-$releasever - Base

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ ##yum源

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

cost=100


[gongbing]

name= centos 6

baseurl=file:///media/cdrom/

enable=1

gpgcheck=0

cost=200 cost用來定義yum源的優(yōu)先級,通常本地優(yōu)先級高于其他

實(shí)例:創(chuàng)建epel第三方倉庫,建議第三方倉庫多了會造成沖突。

[epel]

name=epel

mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$releasever&arch=$basearch

enabled=1

gpcheck=0

#wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6           # 下載 epel repo 的公鑰

靈活應(yīng)用yum源(適用于centos官網(wǎng)yum源)baseurl:baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/

$releasever:顯示當(dāng)前發(fā)行版本,比如5、6、7,而在網(wǎng)站中6指向最新的6.7目錄。

$basearch:顯示系統(tǒng)平臺版本,x86,686,x86_64。

練習(xí)編寫163的linux-yum源

baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/


2、本地安裝

yum命令同樣支持安裝磁盤上的rpm包,相對rpm命令的優(yōu)勢就是可以依據(jù)此rpm包的依賴關(guān)系從互聯(lián)網(wǎng)的yum倉庫中下載依賴包并安裝。

linux5以前的yum如果安裝本地的yum源,可以使用參數(shù):localinstall、localupdate。而在6以后的linux統(tǒng)一使用install來完成。

歷史:

history:查看歷史操作。

--nogpgcheck:不檢查軟件包完整性和可靠性。

3、創(chuàng)建自己的yum倉庫

創(chuàng)建非常簡單,各種參數(shù)都可以不用。

3.1、安裝創(chuàng)建YUM倉庫所需要的命令-createrepo

[root@37-test grub]# yum install createrepo

3.2、制作yum倉庫,需要?jiǎng)?chuàng)建并指定目錄

[root@37-test pkg]# createrepo /root/lnmp-setup-bin/pkg/

Spawning worker 0 with 1 pkgs

Workers Finished

Gathering worker results


Saving Primary metadata

Saving file lists metadata

Saving other metadata

Generating sqlite DBs

Sqlite DBs complete


3.3、創(chuàng)建倉庫完成后,自動在目錄中生成repodata目錄。

[root@37-test pkg]# ls

dtedu.tar.gz                       repodata        setup.tar.gz

puppetlabs-release-6-7.noarch.rpm  scripts.tar.gz

[root@37-test pkg]# 


3.4、在文件夾里生成repodata文件夾,里面包括

filelists.sqlite.gz(rpm包的文件列表,引擎為sqlite)

filelists.xml.gz(rpm包的文件列表,引擎為xml)

primary.sql.gzprimary.xml.gz(包之間的依賴關(guān)系)

other.xml.gz(rpm包其他信息,比如新增、改進(jìn)功能)

other.sqlite.bz2rpm(包其他信息,比如新增、改進(jìn)功能)

repomd.xml文件(紀(jì)錄數(shù)據(jù)庫的時(shí)間戳,用于客戶機(jī)和服務(wù)器間同步)

[root@37-test repodata]# ls

53d2a531435469b1468bcb0f4a9a92b91383c47d2c2532a0c659294fa5ae386c-other.sqlite.bz2

817d1464cbb2750d478cb792fc94b20b2bacbd842a031e7e31425f6e64d8996f-filelists.sqlite.bz2

8e54eef08b1deb052bb3b51ac28a5eb63492594a2789855ac1923315757de807-primary.xml.gz

96c0b7b52aff973e1a816d2e24af178dd775b68f71943a09c71827283716464c-primary.sqlite.bz2

ae3f2e69e30ddf499c40bce4183d2770b366adad39f629d047de0d2366a642b8-filelists.xml.gz

f0053afeca4af6335a88a07891be2547c9d6583f127435d77d4027d39eb8b43d-other.xml.gz

repomd.xml


3.5、客戶端配置本地yum倉庫

[localrepo]

name=pkg

baseurl=file:///root/lnmp-setup-bin/pkg/

enable=1

gpgcheck=0


[root@37-test repodata]# yum repolist

已加載插件:fastestmirror, refresh-packagekit

Loading mirror speeds from cached hostfile

 * base: mirror.bit.edu.cn

 * epel: mirrors.tuna.tsinghua.edu.cn

 * extras: mirror.bit.edu.cn

 * updates: mirror.bit.edu.cn

localrepo                                                | 2.9 kB     00:00 ... 

localrepo/primary_db                                     | 1.9 kB     00:00 ... 

倉庫標(biāo)識               倉庫名稱                                           狀態(tài)

base                   CentOS-6 - Base                                     6,696

epel                   Extra Packages for Enterprise Linux 6 - x86_64     12,150

extras                 CentOS-6 - Extras                                      62

localrepo              pkg                                                     1

ntop                   ntop packages                                           6

ntop-noarch            ntop packages                                           9

puppetlabs-deps        Puppet Labs Dependencies El 6 - x86_64                 77

puppetlabs-products    Puppet Labs Products El 6 - x86_64                    565

saltstack-zeromq4      Copr repo for zeromq4 owned by saltstack                8

updates                CentOS-6 - Updates                                    686

repolist: 20,260


3.6、yum客戶端會在本地生成一個(gè)yum倉庫數(shù)據(jù)庫:

[root@37-test repodata]# ll /var/lib/yum/repos/x86_64/6/

總用量 40

drwxr-xr-x. 2 root root 4096 8月  26 2012 base

drwxr-xr-x  2 root root 4096 10月 14 10:42 epel

drwxr-xr-x. 2 root root 4096 8月  26 2012 extras

drwxr-xr-x  2 root root 4096 12月  8 09:16 gongbing

drwxr-xr-x  2 root root 4096 11月 21 14:40 ntop

drwxr-xr-x  2 root root 4096 11月 21 14:40 ntop-noarch

drwxr-xr-x. 2 root root 4096 8月  26 2012 puppetlabs-deps

drwxr-xr-x. 2 root root 4096 8月  26 2012 puppetlabs-products

drwxr-xr-x  2 root root 4096 11月 22 11:30 saltstack-zeromq4

drwxr-xr-x. 2 root root 4096 8月  26 2012 updates

補(bǔ)充:LFTP

get:文件下載

mget:多文件下載

mirror:下載目錄及文件

!command:使用linux命令

六、編譯源代碼:

編譯源代碼首先需要編譯環(huán)境才能編譯源代碼,然后對于編譯工具使用了make命令,這條命令依據(jù)makefile來進(jìn)行編譯,那makefile又是如何而來的呢?它通過configure腳本和makefile.in來生成makefile文件。


1、依賴環(huán)境,需要開發(fā)包組

安裝開發(fā)環(huán)境依賴的軟件包組:

Development Tools

Server Platform Development

Desktop Platform Development

[root@37-test ~]# yum groupinfo "development tools"

已加載插件:fastestmirror, refresh-packagekit

設(shè)置組進(jìn)程

Loading mirror speeds from cached hostfile

 * base: mirrors.tuna.tsinghua.edu.cn

 * epel: mirrors.tuna.tsinghua.edu.cn

 * extras: mirror.bit.edu.cn

 * updates: mirror.bit.edu.cn


組:開發(fā)工具

 描述:基本開發(fā)環(huán)境。

 必要的軟件包:

   autoconf

   automake

   binutils

   bison

   flex

   gcc

   gcc-c++

   gettext

   libtool

   make

   patch

   pkgconfig

   redhat-rpm-config

   rpm-build

 默認(rèn)的軟件包:

   byacc

   cscope

   ctags

   cvs

   diffstat

   doxygen

   elfutils

   gcc-gfortran

   git

   indent

   intltool

   patchutils

   rcs

   subversion

   swig

   systemtap

 可選的軟件包:

   ElectricFence

   PyYAML

   ant

   babel

   bzr

   ccache

   chrpath

   clips

   clips-devel

   clips-doc

   clips-emacs

   clips-xclips

   clipsmm-devel

   clipsmm-doc

   cmake

   cmucl

   colordiff

   compat-gcc-34

   compat-gcc-34-c++

   compat-gcc-34-g77

   cvs-inetd

   cvsps

   darcs

   dejagnu

   email2trac

   expect

   ftnchek

   gcc-gnat

   gcc-java

   gcc-objc

   gcc-objc++

   ghc

   git

   haskell-platform

   imake

   jpackage-utils

   kdewebdev

   ksc

   libstdc++-docs

   lua

   mercurial

   mock

   mod_dav_svn

   nasm

   nqc

   nqc-doc

   ocaml

   perltidy

   python-docs

   python-requests

   python-six

   qgit

   rpmdevtools

   rpmlint

   sbcl

   systemtap-sdt-devel

   systemtap-server

   trac

   trac-git-plugin

   trac-mercurial-plugin

   trac-webadmin

   translate-toolkit


2、編譯安裝源碼包

2.1解壓縮源碼包

[root@37-test ~]# tar zxvf ntopng-2.4-stable.tar.gz -C /root/test/ 


-C:用于指定解壓縮到那個(gè)目錄里。


2.2進(jìn)入源代碼目錄

2.2.1、配置源代碼的.configure,作用是檢測編譯環(huán)境,此文件一般在軟件包中存在,如果沒有可以通過autoconf來生成。

  自定義編譯變量:

  --help:獲取幫助信息
  --prefix=指定安裝路徑
  --sysconfdir=指定配置文件路徑 

./configure設(shè)置完后,會自動生成config.log和makefile文件。

[root@37-test ntopng-2.4-stable]# ls

autogen.sh      configure       doc       Makefile.in  scripts

autom4te.cache  configure.ac    docker    nDPI         src

CHANGELOG.md    configure.seed  httpdocs  ntopng.8     third-party

config.guess    contrib         include   packages     tmp

config.log      COPYING         LICENSE   README.md    tools



2.2.2、.configure結(jié)合makefile.in來生成makfile,makefile.in通過automake來生成。

2.2.3、編譯源代碼

make
make install

3、完善編譯安裝

編譯安裝和rpm安裝的最大區(qū)別就是,rpm安裝是有數(shù)據(jù)庫的,安裝完后系統(tǒng)知道可執(zhí)行程序、庫文件、幫助文檔、配置文件都放在那里,可以自行尋找。而編譯安裝則不提供此功能,需要手動制定。

3.1定義path的全局環(huán)境變量

[root@37-test ~]# PATH=/usr/local/nagios/bin/:$PATH ##通過命令定義的變量是臨時(shí)的。

修改/etc/profile或者創(chuàng)建/etc/profile.d/nagios.sh文件。

[root@37-test ~]# vi /etc/profile.d/nagios.sh

export PATH=/usr/local/nagios/bin/:$PATH

立即生效:

[root@37-test ~]# . /etc/profile.d/nagios.sh 


3.2添加編譯軟件所依賴的庫文件,此庫文件通常在編譯軟件包的安裝目錄中的lib目錄下,可以通過/etc/ld.so.conf來設(shè)置,或者建議使用/etc/ld.so.conf.d/目錄下創(chuàng)建*.conf文件。

[root@37-test ~]# vi /etc/ld.so.conf.d/nagios.conf

/usr/local/nagios/lib/ ##添加路徑即可



3.3配置文件通常不用手動添加,編譯的軟件可以自己找到。

3.4幫助文件的添加,需要通過/etc/man.config文件進(jìn)行配置,在MANPATH=處添加。

# Every automatically generated MANPATH includes these fields

#

MANPATH /usr/man

MANPATH /usr/share/man

MANPATH /usr/local/man

MANPATH /usr/local/share/man

MANPATH /usr/X11R6/man

MANPATH /usr/local/nagios/share/ 添加路徑

#

# Uncomment if you want to include one of these by default

#

# MANPATH       /opt/*/man

# MANPATH       /usr/lib/*/man

# MANPATH       /usr/share/*/man


3.5添加頭文件,使用ln -s 創(chuàng)建軟連接到系統(tǒng)頭文件目錄/etc/include/中。

[root@37-test ~]# ln -sv /usr/local/nagios/include/ /usr/include/nagios

"/usr/include/nagios" -> "/usr/local/nagios/include/"

[root@mail ~]# ln -sv /usr/local/courier-authlib/include/* /usr/include/

"/usr/include/courier_auth_config.h" -> "/usr/local/courier-authlib/include/courier_auth_config.h"

"/usr/include/courierauthdebug.h" -> "/usr/local/courier-authlib/include/courierauthdebug.h"

"/usr/include/courierauth.h" -> "/usr/local/courier-authlib/include/courierauth.h"

"/usr/include/courierauthsaslclient.h" -> "/usr/local/courier-authlib/include/courierauthsaslclient.h"

"/usr/include/courierauthsasl.h" -> "/usr/local/courier-authlib/include/courierauthsasl.h"

"/usr/include/courierauthstaticlist.h" -> "/usr/local/courier-authlib/include/courierauthstaticlist.h"


知識點(diǎn):

查看命令所依賴的庫文件有哪些?ldd

[root@37-test ~]# ldd /bin/ls

linux-vdso.so.1 =>  (0x00007fff787b1000)

libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fa143af6000)

librt.so.1 => /lib64/librt.so.1 (0x00007fa1438ee000)

libcap.so.2 => /lib/libcap.so.2 (0x00007fa1436e9000)

libacl.so.1 => /lib64/libacl.so.1 (0x00007fa1434e1000)

libc.so.6 => /lib64/libc.so.6 (0x00007fa14314d000)

libdl.so.2 => /lib64/libdl.so.2 (0x00007fa142f48000)

/lib64/ld-linux-x86-64.so.2 (0x00007fa143d27000)

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa142d2b000)

libattr.so.1 => /lib64/libattr.so.1 (0x00007fa142b26000)


查看運(yùn)行命令的執(zhí)行路徑是什么?hash

[root@37-test ~]# hash

hits command

   1 /usr/bin/ldd

   1 /usr/local/nagios/bin/nrpe

   1 /bin/vi

   2 /usr/bin/man


ldconfig -v 

重新搜索系統(tǒng)中的所有庫文件,并生成/etc/ld.so.cache。

[root@37-test ~]# ldconfig -v

ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-642.11.1.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg

ldconfig: 無法對 /usr/lib64/mysql 進(jìn)行 stat 操作: 沒有那個(gè)文件或目錄

ldconfig: 多次給出路徑“/usr/local/lib”

ldconfig: 多次給出路徑“/usr/local/lib”

ldconfig: 多次給出路徑“/usr/lib”

ldconfig: 多次給出路徑“/usr/lib64”

/opt/glibc/lib:

libnss_nisplus.so.2 -> libnss_nisplus-2.14.so

ld-linux-x86-64.so.2 -> ld-2.14.so


七、編譯源碼格式的rpm包-SRPM


打包(rpm源代碼包制作成rpm包,一般格式為:filename.src.rpm)

包制作過程是根據(jù).spec文件來完成的。

源軟件包經(jīng)過編譯后存放在/usr/src/目錄下,并且一般在正確編譯后會僅僅留下SRPMS里面的經(jīng)過編譯的軟件包。

1、解壓安裝src.rpm包,有些安裝需要?jiǎng)?chuàng)建指定的用戶名。

[root@37-test ~]# rpm -ivh mingetty-1.00-3.src.rpm 

warning: mingetty-1.00-3.src.rpm: Header V3 DSA/SHA1 Signature, key ID db42a60e: NOKEY

   1:mingetty               ########################################### [100%]


2、進(jìn)入解壓目錄,一般為用戶家目錄的rpmbuild中。

[root@37-test ~]# cd rpmbuild/S

SOURCES/ SPECS/   

[root@37-test SOURCES]# ll

總用量 20

-rw-rw-r--. 1 root root   259 3月   4 2002 mingetty-1.00-opt.patch

-rw-rw-r--. 1 root root 14038 3月   4 2002 mingetty-1.00.tar.gz


3、編譯源碼rpm包

[root@37-test SPECS]# rpmbuild -bb mingetty.spec 


-ba:生成二進(jìn)制包及源碼格式的rpm包

-bb:生成一個(gè)二進(jìn)制格式的rpm包


可能會需要依賴包,將依賴包安裝完畢后,重新編譯。


[root@37-test rpmbuild]# ll

總用量 24

drwxr-xr-x 3 root root 4096 12月  9 14:11 BUILD

drwxr-xr-x 2 root root 4096 12月  9 14:11 BUILDROOT

drwxr-xr-x 3 root root 4096 12月  9 14:11 RPMS

drwxr-xr-x 2 root root 4096 12月  9 14:04 SOURCES

drwxr-xr-x 2 root root 4096 12月  9 14:11 SPECS

drwxr-xr-x 2 root root 4096 12月  9 14:07 SRPMS ##用于其他系統(tǒng)的重新制作編譯

[root@37-test rpmbuild]# cd RPMS/

[root@37-test RPMS]# ls

x86_64

[root@37-test RPMS]# cd x86_64/

[root@37-test x86_64]# ls

mingetty-1.00-3.x86_64.rpm  mingetty-debuginfo-1.00-3.x86_64.rpm

[root@37-test x86_64]# rpm -ivh mingetty-debuginfo-1.00-3.x86_64.rpm 

Preparing...                ########################################### [100%]

   1:mingetty-debuginfo     ########################################### [100%]


問題:

1、error: line 4: Unknown tag: Copyright: GPL

此錯(cuò)誤可以通過修改repc文件中的需要將"Copyright:"該改成新的Tag"License:" 即可


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI