标签:rac lan option http openldap for hash depend 新版本
软件运行环境
ABI(应用程序的二进制接口):Application Binary Interface
Windows 与Linux 不兼容
ELF(Executable and Linkable Format) --->Linux
可执行可连接的格式
PE (Portable Executable) ) --->Windows
可移植的可执行格式
库级别的虚拟化:
Linux: WINE
Windows: Cywin
API(应用程序的开发接口):Application Programming Interface
POSIX :Portable OS
程序源代码 -->预处理 -->编译 -->汇编 -->链接
静态编译:.a
动态编译:.so
静态和动态链接
链接主要作用是把各个模块之间相互引用的部分处理好,使得各个模块之间能够正确地衔接,分为静态链接和动态链接
静态链接
把程序对应的依赖库复制一份到包
libxxx.a
嵌入程序包
升级难,需重新编译
占用较多空间,迁移容易
动态链接
只把依赖加做一个动态链接
libxxx.so
“连接指向”
占用较少空间升级方便
开发语言:
系统级开发
C,C++
应用级开发
Java,Delphi,Python,Go,Php,Perl,Ruby
软件包基础
包管理器
二进制应用程序的组成部分:
二进制文件、库文件、配置文件、帮助文件
程序包管理器:
debian :deb 文件, dpkg 包管理器
redhat: rpm 文件, rpm 包管理器
rpm: Redhat Package Manager(软件包管理器)
RPM Package Manager
包命名
源代码:name-VERSION.tar.gz|bz2|xz
VERSION(版本): major.minor.release
rpm 包命名方式:
name-VERSION-release.arch.rpm
例: :bash-4.2.46-19.el7.x86_64.rpm
VERSION: major.minor.release
Release :release.OS
常见的arch:
x86: i386, i486, i586, i686
x86_64: x64, x86_64, amd64
powerpc: ppc
跟平台无关:noarch
包命名和工具
包:分类 和 拆包
Application-VERSION-ARCH.rpm: 主包
应用程序库版本
Application-devel-VERSION-ARCH.rpm 开发子包
Application-utils-VERSION-ARHC.rpm 其它子包
Application-libs-VERSION-ARHC.rpm 其它 子包
包之间:可能存在依赖关系,甚至循环依赖
(安装A包时,A包依赖于B包,B包依赖于C包,C包依赖于A包)
解决依赖包管理工具:
Yum :rpm 包管理器的前端工具
apt-get :deb 包管理器前端工具
zypper: suse 上的rpm 前端管理工具
dnf: Fedora 18+ rpm 包管理器前端管理工具
库文件
查看二进制程序所依赖的库文件
ldd /PATH/TO/BINARY_FILE
管理及查看本机装载的库文件
ldconfig
/sbin/ldconfig -p: 显示本机已经缓存的所有可用库文件
名及文件路径映射关系
配置文件:/etc/ld.so.conf, /etc/ld.so.conf.d/*.conf
缓存文件:/etc/ld.so.cache
程序包管理器:
功能:将编译好的应用程序的各组成文件打包一个或几个程序包文件,从而方便快捷地实现程序包的安装、卸载、查询、升级和校验等管理操作
1、包文件组成 ( 每个包独有)
RPM 包内的文件
RPM 的元数据,如名称,版本,依赖性,描述等
安装或卸载时运行的脚本
2、数据库( 公共) :/var/lib/rpm
程序包名称及版本
依赖关系
功能说明
包安装后生成的各文件路径及校验码信息
[root@station29 ~]# cd /var/lib/rpm [root@station29 rpm]# ll -rw-r--r--. 1 root root 5136384 Mar 24 05:55 Basenames total 63060 -rw-r--r--. 1 root root 12288 Mar 24 05:53 Conflictname -rw-r--r--. 1 root root 73728 Apr 17 19:46 __db.001 -rw-r--r--. 1 root root 1318912 Apr 17 19:46 __db.003 -rw-r--r--. 1 root root 237568 Apr 17 19:46 __db.002 -rw-r--r--. 1 root root 753664 Apr 17 19:46 __db.004 -rw-r--r--. 1 root root 5251072 Mar 24 05:55 Filedigests -rw-r--r--. 1 root root 1064960 Mar 24 05:55 Dirnames -rw-r--r--. 1 root root 20480 Mar 24 05:55 Group -rw-r--r--. 1 root root 20480 Mar 24 05:55 Installtid -rw-r--r--. 1 root root 24576 Mar 24 05:55 Obsoletename -rw-r--r--. 1 root root 49152 Mar 24 05:55 Name
程序包的来源
管理程序包的方式:
使用包管理器:rpm
使用前端工具:yum, dnf
获取程序包的途径:
(1)系统发版的光盘或官方的服务器;
CentOS 镜像:
https://www.centos.org/download/
http://mirrors.aliyun.com
http://mirrors.sohu.com
http://mirrors.163.com
(2)项目官方站点
(3)第三方组织:
Fedora-EPEL:
Extra Packages for Enterprise Linux
Rpmforge:RHEL 推荐,包很全
搜索引擎 :
http://pkgs.org
http://rpmfind.net
http://rpm.pbone.net
https://sourceforge.net/
(4)自己制作
FPM 制作安装包
注意:第三方包建议要检查其合法性
来源合法性, 程序包的完整性
rpm 包管理
CentOS 系统上使用rpm 命令管理程序包:
安装、卸载、升级、查询、校验、数据库维护
安装:
rpm {-i|--install} [install-options] PACKAGE_FILE…
-v: verbose 显示安装过程中的详细信息
-vv: 显示安装过程中更详细的信息
-h: 以# 显示程序包管理执行进度
rpm -ivh PACKAGE_FILE ...
[root@localhost/]#rpm -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/tree-1.6.0-10.el7.x86_64.rpm Preparing... ################################# [100%] package tree-1.6.0-10.el7.x86_64 is already installed (已经安装完成) [root@localhost /]# rpm -q tree tree-1.6.0-10.el7.x86_64 [root@localhost /]# tree /dev/ /dev/ ├── agpgart ├── autofs ├── block │ ├── 11:0 -> ../sr0 │ ├── 253:0 -> ../dm-0 │ ├── 253:1 -> ../dm-1 │ ├── 253:2 -> ../dm-2 │ ├── 8:0 -> ../sda │ ├── 8:1 -> ../sda1 │ ├── 8:16 -> ../sdb │ └── 8:2 -> ../sda2 ├── bsg │ ├── 1:0:0:0 │ ├── 2:0:0:0 │ └── 2:0:1:0
rpm 包安装
[install-options]
--test: 测试安装,但不真正 执行安装,即dry run 模式
[root@localhost~]#rpm -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/tree-1.6.0-10.el7.x86_64.rpm --test Preparing... ################################# [100%] package tree-1.6.0-10.el7.x86_64 is already installed
--nodeps :忽略依赖关系
--replacepkgs | replacefiles
(replacepkgs 覆盖安装 包损坏时可用)
(replacefiles 覆盖冲突文件)
[root@localhost ~]# rm /usr/bin/tree rm: remove regular file ‘/usr/bin/tree’? Y [root@localhost~]#rpm -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/tree-1.6.0-10.el7.x86_64.rpm --replacepkgs Preparing... ################################# [100%] Updating / installing... 1:tree-1.6.0-10.el7 ################################# [100%]
--nosignature: 不检查来源合法性
--nodigest :不检查包完整性
--noscripts :不执行 程序包脚本
%pre: ; 安装前脚本; --nopre
%post: ; 安装后脚本; --nopost
%preun: ; 卸载前脚本; --nopreun
%postun: 卸载后脚本; --nopostun
[root@localhost~]#rpm -qp --noscripts /run/media/root/CentOS\ 7\ x86_64/Packages/bash-4.2.46-20.el7_2.x86_64.rpm rpm: script disabling options may only be specified during package installation and erasure
脚本禁用选项只能在包安装和删除过程中指定
rpm 包升级
升级:
rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
upgrade :安装有旧版程序包,则“升级”
如果不存在旧版程序包,则“安装”
freshen :安装有旧版程序包,则“升级”
如果不存在旧版程序包,则不执行升级操作
rpm -Uvh PACKAGE_FILE ...
rpm -Fvh PACKAGE_FILE ...
--oldpackage:降级
--force:强制安装
注意:
(1) 不要对内核做升级操作;Linux 支持多内核版本并存,因此,直接安装新版本内核
(2) 如果原程序包的配置文件安装后曾被修改,升级时,新版本的提供的同一个配置文件并不会直接覆盖老版本的配置文件,而把新版本的文件重命名(FILENAME.rpmnew) 后保留
例:将CentOS6.8升级为CentOS9 1.将光盘挂载改为新下好的CentOS9 ios 2.df查询 [root@station29 Packages]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda6 173059896 3639456 160622796 3% / tmpfs 1019184 80 1019104 1% /dev/shm /dev/sda1 194241 39027 144974 22% /boot /dev/sda2 20511356 45032 19417748 1% /data /dev/sda3 10190136 40504 9625344 1% /home /dev/sr0 3878870 3878870 0 100% /media/CentOS_6.9_Final [root@station29 Packages]# rpm -q kernel kernel-2.6.32-642.el6.x86_64 (当前版本内核) [root@station29 Packages]# ls kernel* kernel-2.6.32-696.el6.x86_64.rpm (最新版本内核) kernel-doc-2.6.32-696.el6.noarch.rpm kernel-abi-whitelists-2.6.32-696.el6.noarch.rpm kernel-firmware-2.6.32-696.el6.noarch.rpm kernel-devel-2.6.32-696.el6.x86_64.rpm kernel-headers-2.6.32-696.el6.x86_64.rpm [root@station29 Packages]# rpm -ivh kernel-2.6.32-696.el6.x86_64.rpm error: Failed dependencies: kernel-firmware >= 2.6.32-696.el6 is needed by kernel-2.6.32-696.el6.x86_64 (内核固件> = 2.6.32-696.el6需要kernel-2.6.32-696.el6.x86_64) [root@station29 Packages]# rpm -ivh kernel-2.6.32-696.el6.x86_64.rpm kernel-firmware-2.6.32-696.el6.noarch.rpm Preparing... ########################################### [100%] 1:kernel-firmware ########################################### [ 50%] 2:kernel ########################################### [100%] [root@station29 Packages]# rpm -q kernel kernel-2.6.32-642.el6.x86_64 kernel-2.6.32-696.el6.x86_64 [root@station29 Packages]# reboot (重新启动) Broadcast message from zhouao@station29.magelinux.com (/dev/pts/1) at 11:10 ... The system is going down for reboot NOW! 选择CentOS6.9 [root@station29 ~]# rpm -q kernel kernel-2.6.32-642.el6.x86_64 kernel-2.6.32-696.el6.x86_64 [root@station29 ~]# uname -r 2.6.32-696.el6.x86_64 升级成功
包查询
rpm {-q|--query} [select-options] [query-options]
[select-options]
-a: 所有包
[root@station29 ~]# rpm -qa | grep bas ncurses-base-5.7-4.20090207.el6.x86_64 gstreamer-plugins-base-0.10.29-2.el6.x86_64 khmeros-base-fonts-5.0-9.el6.noarch libasyncns-0.8-1.1.el6.x86_64 system-config-keyboard-base-1.3.1-6.el6.x86_64 basesystem-10.0-4.el6.noarch libbasicobjects-0.1.1-11.el6.x86_64 system-config-firewall-base-1.2.27-7.2.el6_6.noarch bash-4.1.2-40.el6.x86_64
-f: 查看指定的文件由哪个程序包安装生成
[root@station29 ~]# rpm -qf /lib64/ filesystem-2.4.30-3.el6.x86_64
-p rpmfile :针对尚未安装的程序包文件做查询操作(-p后面跟完整路径)
--whatprovides CAPABILITY :查询指定的 CAPABILITY由哪个包所提供
[root@station29 ~]# rpm -q --whatprovides bash bash-4.1.2-40.el6.x86_64
--whatrequires CAPABILITY :查询指定的 CAPABILITY 被哪个包所依赖
[root@station29 ~]# rpm -q --whatrequires bash initscripts-9.03.53-1.el6.centos.x86_64 dracut-004-409.el6.noarch rsyslog-5.8.10-10.el6_6.x86_64 cronie-1.4.4-15.el6_7.1.x86_64 autofs-5.0.5-122.el6.x86_64 lvm2-2.02.143-7.el6.x86_64
rpm2cpio 包文件|cpio –itv 预览包内文件
rpm2cpio 包文件|cpio –id “*.conf” ” 释放包内文件
[query-options]
--changelog :查询rpm 包的changelog
[root@station29 ~]# rpm -q --changelog bash | head -10 * Tue Dec 22 2015 Ondrej Oprala <ooprala@redhat.com> - 4.1.2-40 - Bash shouldn‘t ignore bash --debugger without a dbger installed Related: #1260568 * Wed Nov 25 2015 Ondrej Oprala <ooprala@redhat.com> - 4.1.2-39 - Wrong parsing inside for loop and brackets Resolves: #1207803 * Wed Nov 25 2015 Ondrej Oprala <ooprala@redhat.com> - 4.1.2-38 - IFS incorrectly splitting herestrings
-c: 查询程序的配置文件
[root@station29 ~]# rpm -qc bash /etc/skel/.bash_logout /etc/skel/.bash_profile /etc/skel/.bashrc
-d: 查询程序的文档
[root@station29 ~]# rpm -qd bash /usr/share/doc/bash-4.1.2/COPYING /usr/share/info/bash.info.gz /usr/share/man/man1/..1.gz /usr/share/man/man1/:.1.gz /usr/share/man/man1/[.1.gz /usr/share/man/man1/alias.1.gz /usr/share/man/man1/bash.1.gz
-i: information(查看信息)
-l: 查看指定的程序包安装后生成的所有文件
[root@station29 ~]# rpm -ql bash /bin/bash /bin/sh /etc/skel/.bash_logout /etc/skel/.bash_profile /etc/skel/.bashrc /usr/bin/bashbug-64 /usr/share/doc/bash-4.1.2/COPYING /usr/share/info/bash.info.gz /usr/share/locale/af/LC_MESSAGES/bash.mo /usr/share/locale/bg/LC_MESSAGES/bash.mo /usr/share/locale/ca/LC_MESSAGES/bash.mo
--scripts :程序包自带的脚本
[root@station29 ~]# rpm -q bash --scripts postinstall scriptlet (using <lua>): bashfound = false; shfound = false; f = io.open("/etc/shells", "r"); if f == nil then f = io.open("/etc/shells", "w"); else repeat t = f:read(); if t == "/bin/bash" then bashfound = true; end if t == "/bin/sh" then shfound = true; end until t == nil; end
--provides: 列出指定程序包所提供的CAPABILITY(能力)
[root@station29 ~]# rpm -q --provides bash config(bash) = 4.1.2-40.el6 bash = 4.1.2-40.el6 bash(x86-64) = 4.1.2-40.el6
常用查询用法:
-qi PACKAGE, -qf FILE, -qc PACKAGE, -ql PACKAGE, -qd PACKAGE
[root@station29 ~]# rpm -qi tree Name : tree Relocations: (not relocatable) Version : 1.5.3 Vendor: CentOS Release : 3.el6 Build Date: Wed 14 Jan 2015 08:21:02 PM CST Install Date: Tue 18 Apr 2017 03:38:46 PM CST Build Host: c6b9.bsys.dev.centos.org Group : Applications/File Source RPM: tree-1.5.3-3.el6.src.rpm Size : 66687 License: GPLv2+ Signature : RSA/SHA1, Wed 14 Jan 2015 10:12:21 PM CST, Key ID 0946fca2c105b9de Packager : CentOS BuildSystem <http://bugs.centos.org> URL : http://mama.indstate.edu/users/ice/tree/ Summary : File system tree viewer Description : The tree utility recursively displays the contents of directories in a tree-like format. Tree is basically a UNIX port of the DOS tree utility.
-qpi PACKAGE_FILE, -qpl PACKAGE_FILE, ...
[root@station29~]#rpm -qpl /media/CentOS_6.9_Final/Packages/tree-1.5.3-3.el6.x86_64.rpm /usr/bin/tree /usr/share/doc/tree-1.5.3 /usr/share/doc/tree-1.5.3/LICENSE /usr/share/doc/tree-1.5.3/README /usr/share/man/man1/tree.1.gz
包卸载:
rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME ...
包校验
rpm {-V|--verify} [select-options] [verify-options]
S file Size differs (文件大小改变)
M Mode differs (includes permissions and file type) (模式,权限,文件类型改变)
5 digest (formerly MD5 sum) differs (hash值改变,文件内容变化,hash值随之变化)
D Device major/minor number mismatch (设备主要号码和次要号码)
[root@localhost ~]# ll /dev/sda
brw-rw----. 1 root disk 8, 0 Apr 20 16:44 /dev/sda
L readLink(2) path mismatch (连接)
U User ownership differs (不同的用户权限)
G Group ownership differs (不同的组权限)
T mTime differs (时间改变)
P capabilities differ (能力不同)
包来源合法性验正及完整性验正
完整性验正:SHA256
来源合法性验正:RSA
公钥加密
对称加密:加密、解密使用同一密钥
非对称加密:密钥是成对儿的
public key: 公钥,公开所有人
secret key: 私钥, 不能公开
导入所需要公钥
rpm -K|checksig rpmfile 检查包的完整性和签名
rpm --import / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
CentOS 7 发行版光盘提供: RPM-GPG-KEY-CentOS-7
rpm -qa “gpg-pubkey*”
rpm 数据库
数据库重建:
/var/lib/rpm
rpm {--initdb|--rebuilddb}
initdb: 初始化
如果 事先不存在数据库,则新建之;否则 ,不执行任何操作
rebuilddb :重建已 安装的包头的数据库索引目录
yum 管理
yum
CentOS: yum, dnf
yum: Yellowdog Update Modifier ,rpm 的前端程序,可解决软件包相关依赖性,可在多个库之间定位软件包,up2date的替代工具
yum repository: yum repo ,存储了众多rpm 包,以及包的相关的元数据文件(放置于特定目录repodata 下)
文件服务器:
ftp://
http://
file://
yum 配置文件
yum 客户端配置文件:
/etc/yum.conf :为所有仓库提供公共配置
/etc/yum.repos.d/*.repo :为仓库的指向提供配置
[root@station29 ~]# cd /etc/yum.repos.d/ [root@station29 yum.repos.d]# ls CentOS-Base.repo CentOS-fasttrack.repo CentOS-Vault.repo CentOS-Debuginfo.repo CentOS-Media.repo
仓库指向的定义:
[repositoryID]
name=Some name for this repository
baseurl=url://path/to/repository/
enabled={1|0}
gpgcheck={1|0}
gpgkey=URL
enablegroups={1|0}
failovermethod={roundrobin|priority}
roundrobin: : 意为随机挑选,默认值
priority: 按顺序访问
cost= 默认为1000
[centos7] name=centos7 baseurl=https://mirrors.aliyun.com/centos/$releasever/os/x86_64/ gpgcheck=1 gpgkey=file:///etc/pik/rpm-gpg/RPM-GPG-KEY-Centos-7 [epel] baseurl=http://172.18.0.1/fedora-epel/7/x86_64 gpgcheck=0
yum 仓库
yum 的repo 配置文件中可用的变量:
$releasever: 当前OS 的发行版的主版本号
$arch: 平台,i386,i486,i586,x86_64等
$basearch :基础平台;i386, x86_64
$YUM0-$YUM9: 自定义变量
实例:
http://server/centos/$releasever/$basearch/
http://server/centos/7/x86_64
http://server/centos/6/i384
yum源
阿里云repo 文件:
http://mirrors.aliyun.com/repo/
CentOS 系统yum源
阿里云:
https://mirrors.aliyun.com/centos/$releasever/os/x86_64/
教学环境:
http://172.16.0.1/cobbler/ks_mirror/$releasever/
Epel 的yum 源:
阿里云:
https://mirrors.aliyun.com/epel/$releasever/x86_64
教学环境:
http://172.16.0.1/fedora-epel/$releasever/x86_64/
yum 命令
yum 命令的用法:
yum [options] [command] [package ...]
显示仓库列表:
yum repolist [all|enabled|disabled](enabled列出启用的 disabled列出禁用的)
[root@localhost ~]# yum repolist all repo id repo name status centos7 centos7 enabled: 9,363 centos71/7 centos71 enabled: 9,363 epel epel disabled repolist: 18,726
显示程序包:
yum list
yum list [all | glob_exp1] [glob_exp2] [...]
列出所有的包,可用正则表达式
yum list {available|installed|updates} [glob_exp1][...]
available列出可用的包;installed列出已经装好的包;updates列出可更新的包
安装程序包:
yum install package1 [package2] [...]
[root@localhost ~]# yum install createrepo Loaded plugins: fastestmirror, langpacks Repository ‘epel‘ is missing name in configuration, using id Repository ‘epel‘ is missing name in configuration, using id Repository epel is listed more than once in the configuration centos7 | 3.6 kB 00:00:00 centos71 | 3.6 kB 00:00:00 (1/4): centos7/group_gz | 155 kB 00:00:00 (2/4): centos7/primary_db | 5.6 MB 00:00:00 (3/4): centos71/7/primary_db | 5.6 MB 00:00:07 yum reinstall package1 [package2] [...] ( 重新安装)
升级程序包:
yum update [package1] [package2] [...]
yum downgrade package1 [package2] [...] ( 降级)
检查可用升级:
yum check-update
卸载程序包:
yum remove | erase package1 [package2] [...]
查看程序包information: :
yum info [...]
[root@localhost ~]# yum info vsftpd Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Installed Packages Name : vsftpd Arch : x86_64 Version : 3.0.2 Release : 21.el7 Size : 348 k Repo : installed From repo : centos71 Summary : Very Secure Ftp Daemon URL : https://security.appspot.com/vsftpd.html License : GPLv2 with exceptions Description : vsftpd is a Very Secure FTP daemon. It was written completely from : scratch.
查看指定的特性( 可以是某文件) 是由哪个程序包所提供:
yum provides | whatprovides feature1 [feature2][...]
[root@localhost ~]# yum provides vsftpd Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile vsftpd-3.0.2-21.el7.x86_64 : Very Secure Ftp Daemon Repo : centos71 vsftpd-3.0.2-21.el7.x86_64 : Very Secure Ftp Daemon Repo : @centos71
清理本地缓存:
清除/var/cache/yum/$basearch/$releasever 缓存
yum clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
[root@localhost ~]# yum clean all Loaded plugins: fastestmirror, langpacks Repository ‘epel‘ is missing name in configuration, using id Repository ‘epel‘ is missing name in configuration, using id Repository epel is listed more than once in the configuration Cleaning repos: centos7 centos71 Cleaning up everything Cleaning up list of fastest mirrors
构建缓存:
yum makecache
搜索:yum search string1 [string2] [...]
以指定的关键字搜索程序包名及summary 信息
查看指定包所依赖的capabilities: :
yum deplist package1 [package2] [...]
查看yum 事务历史:
yum history [info|list|packages-list|packages-info|
summary|addon-info|redo|undo|
rollback|new|sync|stats]
yum history(查看yum安装的历史列表)
实例: [root@localhost yum.repos.d]# yum history Loaded plugins: fastestmirror, langpacks Repository ‘epel‘ is missing name in configuration, using id Repository ‘epel‘ is missing name in configuration, using id Repository epel is listed more than once in the configuration ID | Login user | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 10 | root <root> | 2017-04-21 06:13 | Install | 1 9 | root <root> | 2017-04-21 06:12 | Install | 4 8 | root <root> | 2017-04-21 06:10 | Install | 1 7 | putong <putong> | 2017-04-20 23:42 | Erase | 4 6 | putong <putong> | 2017-04-20 22:46 | Install | 1 5 | putong <putong> | 2017-04-20 20:57 | Install | 1 4 | putong <putong> | 2017-04-20 17:58 | Install | 1 3 | putong <putong> | 2017-04-20 07:55 | Install | 1 2 | putong <putong> | 2017-04-20 06:57 | Install | 1 1 | System <unset> | 2017-03-21 04:20 | Install | 1587 history list
yum history info 6(查看编号为9的详细操作)
实例: [root@localhost yum.repos.d]# yum history info 9 Loaded plugins: fastestmirror, langpacks Repository ‘epel‘ is missing name in configuration, using id Repository ‘epel‘ is missing name in configuration, using id Repository epel is listed more than once in the configuration Transaction ID : 9 Begin time : Fri Apr 21 06:12:21 2017 Begin rpmdb : 1589:b4e72653f9467b7dd4fe8526994f44c67ecabd4e End time : 06:12:25 2017 (4 seconds) End rpmdb : 1593:2fa17e04d1ea55397e1f0c484335d73b9cd8fc18 User : root <root> Return-Code : Success Command Line : install -y apr-util-devel Transaction performed with: Installed rpm-4.11.3-21.el7.x86_64 @anaconda Installed yum-3.4.3-150.el7.centos.noarch @anaconda Installed yum-plugin-fastestmirror-1.1.31-40.el7.noarch @anaconda Packages Altered: Install apr-util-devel-1.5.2-6.el7.x86_64 @centos7 Dep-Install cyrus-sasl-devel-2.1.26-20.el7_2.x86_64 @centos7 Dep-Install expat-devel-2.1.0-8.el7.x86_64 @centos7 Dep-Install openldap-devel-2.4.40-13.el7.x86_64 @centos7 history info
yum history undo 6(取消/重新进行编号为9的yum操作)
实例: [root@localhost yum.repos.d]# yum history undo 9 Loaded plugins: fastestmirror, langpacks Repository ‘epel‘ is missing name in configuration, using id Repository ‘epel‘ is missing name in configuration, using id Repository epel is listed more than once in the configuration Undoing transaction 9, from Fri Apr 21 06:12:21 2017 Install apr-util-devel-1.5.2-6.el7.x86_64 @centos7 Dep-Install cyrus-sasl-devel-2.1.26-20.el7_2.x86_64 @centos7 Dep-Install expat-devel-2.1.0-8.el7.x86_64 @centos7 Dep-Install openldap-devel-2.4.40-13.el7.x86_64 @centos7 Remove 4 Packages Installed size: 5.1 M Is this ok [y/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : apr-util-devel-1.5.2-6.el7.x86_64 1/4 Erasing : openldap-devel-2.4.40-13.el7.x86_64 2/4 Erasing : expat-devel-2.1.0-8.el7.x86_64 3/4 Erasing : cyrus-sasl-devel-2.1.26-20.el7_2.x86_64 4/4 Verifying : cyrus-sasl-devel-2.1.26-20.el7_2.x86_64 1/4 Verifying : apr-util-devel-1.5.2-6.el7.x86_64 2/4 Verifying : openldap-devel-2.4.40-13.el7.x86_64 3/4 Verifying : expat-devel-2.1.0-8.el7.x86_64 4/4 Removed: apr-util-devel.x86_64 0:1.5.2-6.el7 cyrus-sasl-devel.x86_64 0:2.1.26-20.el7_2 expat-devel.x86_64 0:2.1.0-8.el7 openldap-devel.x86_64 0:2.4.40-13.el7 Complete!
日志 :/var/log/yum.log
安装及升级本地程序包:
yum localinstall rpmfile1 [rpmfile2] [...]
( 用install 替代)
yum localupdate rpmfile1 [rpmfile2] [...]
( 用update 替代)
包组管理的相关命令:
yum groupinstall group1 [group2] [...]
yum groupupdate group1 [group2] [...]
yum grouplist [hidden] [groupwildcard] [...]
yum groupremove group1 [group2] [...]
yum groupinfo group1 [...]
yum的命令行选项:
--nogpgcheck :禁止进行gpg check
-y: 自动回答为“yes”
-q:静默模式
--disablerepo=repoidglob :临时禁用此处指定的repo
--enablerepo=repoidglob :临时启用此处指定的repo
--noplugins:禁用所有插件
系统光盘yum 仓库
系统安装光盘作为本地yum 仓库:
ü (1) 挂载光盘至某目录,例如/media/cdrom
# mount /dev/cdrom /media/cdrom
ü (2) 创建配置文件
[CentOS7]
name=
baseurl=
gpgcheck=
enabled=
创建yum 仓库:
createrepo [options] <directory>
程序包编译
程序包编译安装:
Application-VERSION-release.src.rpm --> 安装后,使用rpmbuild 命令制作成二进制格式的rpm 包,而后再安装
源代码--> 预处理--> 编译--> 汇编--> 链接--> 执行
源代码组织格式:
多文件:文件中的代码之间,很可能存在跨文件依赖关系
C 、C++ :make 项目管理器
configure --> Makefile.in --> makefile
Java: maven
编译安装
C 语言源代码编译安装三步骤:
1 、./configure
(1) 通过选项传递参数,指定启用特性、安装路径等;执行时会参考用户的指定以及makefile.in 文件生成makefile
(2) 检查依赖到的外部环境,如依赖的软件包
2 、make 根据makefile 文件,构建应用程序
3 、make install 复制文件到相应路径
开发工具:
autoconf: 生成configure 脚本
automake :生成Makefile.in
注意:安装前查看INSTALL ,README
开源程序源代码的获取:
官方自建站点:
apache.org (ASF :Apache Software Foundation)
mariadb.org
...
代码托管:
SourceForge.net
Github.com
Code.google.com
c/c++ 编译器: gcc (GNU C Complier)
编译C 源代码:
准备: 提供开发工具及开发环境
开发工具:make, gcc等
开发环境:开发库,头文件
glibc :标准库
实现:通过 “包组”提供开发组件
CentOS 6:
Development Tools
Server Platform Development
CentOS 7:
Development Tools
Development and Creative Workstation
第一步:configure 脚本
选项:指定安装位置、指定启用的特性
--help: 获取其支持使用的选项
选项分类:
安装路径设定:
--prefix=/PATH: 指定默认安装位置, 默认为/usr/local/
--sysconfdir=/PATH :配置文件安装位置
System types:支持交叉编译
Optional Features: 可选特性
--disable-FEATURE
--enable-FEATURE[=ARG]
Optional Packages: 可选包
--with-PACKAGE[=ARG], 依赖包
--without-PACKAGE, 禁用依赖关系
第二步:make
第三步:make install
安装后的配置:
(1) 二进制程序目录导入至PATH 环境变量中
编辑文件/etc/profile.d/NAME.sh
export PATH=/PATH/TO/BIN:$PATH
(2) 导入库文件路径
编辑/etc/ld.so.conf.d/NAME.conf
添加新的库文件所在目录至此文件中
让系统重新生成缓存:
ldconfig [-v]
(3) 导入头文件
基于链接的方式实现:
ln -sv
(4) 导入帮助手册
编辑/etc/man.config|man_db.conf 文件
添加一个MANPATH
标签:rac lan option http openldap for hash depend 新版本
原文地址:http://www.cnblogs.com/Linux--rookie/p/6760185.html