yum 配置管理
2013-12-23 22:02
225 查看
YUM:
1. 生成软件包依赖的数据库
2. 使用yum安装软件包(自动查询数据库并解决依赖关系)
第一种情况:使用系统光盘安装rpm软件
1. 本身存在yum数据库,不需要生成
2. 指定数据库位置
[root@station230 ~]# cd /etc/yum.repos.d/
[root@station230 yum.repos.d]# vim rhel-debuginfo.repo //可任意创建一个.repo结尾的文件
[Server]
name=Server
baseurl=file:///media/Server
enabled=1
gpgcheck=0 //是否检查软件包的签名
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@station230 ~]# yum clean all //清空缓存
安装===
[root@station230 ~]# yum install mysql-server
[root@station230 ~]# yum install httpd.i386
[root@station230 ~]# yum install httpd.x86_64
[root@station230 ~]# yum -y install mysql-server
[root@station230 ~]# yum -y install samba
[root@station230 ~]# rpm -e samba
[root@station230 ~]# yum -y remove mysql-server
[root@station230 ~]# yum -y install "mysql*" httpd vsftpd samba dovecot
[root@station230 ~]# yum -y update samba
查询===
[root@station230 ~]# yum list httpd mysql-server vsftpd tftp-server bind
Installed Packages
httpd.i386 2.2.3-63.el5 installed
mysql-server.i386 5.0.77-4.el5_6.6 installed
tftp-server.i386 0.49-2 installed
vsftpd.i386 2.0.5-24.el5 installed
Available Packages
bind.i386 30:9.3.6-20.P1.el5 Server
场景
[root@station230 ~]# rpm -e httpd
[root@station230 ~]# htpasswd 该命令或文件没有,但又不知道属于哪个包
[root@station230 ~]# yum provides */htpasswd
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Server/filelists | 2.4 MB 00:03
httpd-2.2.3-63.el5.i386 : Apache HTTP 服务器
Repo : Server
Matched from:
Filename : /usr/bin/htpasswd
[root@station230 ~]# yum -y install httpd.i386
软件包组管理:
[root@station230 ~]# yum grouplist
[root@station230 ~]# yum -y groupinstall "DNS 名称服务器"
第二种情况:第三方软件
1. 生成yum数据库 createrepo软件包
2. 指定数据库位置
3. yum安装软件包
[root@station230 soft]# yum -y install createrepo
[root@station230 soft]# pwd
/var/soft
[root@station230 soft]# ls
notecase-1.9.8-1.fc6.i386.rpm stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
ntfs-3g-2010.3.6-1.el5.i386.rpm
[root@station230 soft]# createrepo . //在当前目录生成yum数据库文件
3/3 - stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@station230 soft]# ls
notecase-1.9.8-1.fc6.i386.rpm repodata
ntfs-3g-2010.3.6-1.el5.i386.rpm stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
指定仓库
[root@station230 soft]# cd /etc/yum.repos.d/
[root@station230 yum.repos.d]# ls
redhat.repo rhel-debuginfo.repo
[root@station230 yum.repos.d]# cp rhel-debuginfo.repo newsoft.repo
[root@station230 yum.repos.d]# vim newsoft.repo
[newsoft]
name=newsoft
baseurl=file:///var/soft
enabled=1
gpgcheck=0
安装
[root@station230 ~]# rpm -q ntfs-3g
package ntfs-3g is not installed
[root@station230 ~]# yum -y install ntfs-3g
-----------------------------------------
src.rpm: bc-1.06.95-1.el6.src.rpm
需要的软件包:rpm-build,开发工具 开发库
[root@station230 software]# rpm -q rpm-build
rpm-build-4.4.2.3-27.el5
[root@station230 software]# ls /usr/src/redhat/
BUILD RPMS SOURCES SPECS
SRPMS
方法一:
1. # rpm -ivh bc-1.06.95-1.el6.src.rpm --nomd5 释放相应的文件
2. 将src.rpm编译成rpm包
# rpmbuild -ba /usr/src/redhat/SPECS/bc.spec 编译
# ls /usr/src/redhat/RPMS/i386/
bc-1.06.95-1.i386.rpm bc-debuginfo-1.06.95-1.i386.rpm
3. 安装
# rpm -ivh /usr/src/redhat/RPMS/i386/bc-1.06.95-1.i386.rpm 安装
=====================================================================
如果要使用YUM安装
[root@station230 software]# cp /usr/src/redhat/RPMS/i386/bc-1.06.95-1.i386.rpm /var/soft/ 复制到自定义库
[root@station230 software]# cd /var/soft/
[root@station230 soft]# ls
bc-1.06.95-1.i386.rpm repodata
notecase-1.9.8-1.fc6.i386.rpm stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
ntfs-3g-2010.3.6-1.el5.i386.rpm
[root@station230 soft]# createrepo . 更新yum数据库
yum clean all
yum list bc
yum -y install bc
若yum安装组件时提示 “Public key for giflib-4.1.3-7.3.3.el5.i386.rpm is not installed“错误时,执行:
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release //导入rpm的签名信息
或者
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 //当系统为CentOS5时
1. 生成软件包依赖的数据库
2. 使用yum安装软件包(自动查询数据库并解决依赖关系)
第一种情况:使用系统光盘安装rpm软件
1. 本身存在yum数据库,不需要生成
2. 指定数据库位置
[root@station230 ~]# cd /etc/yum.repos.d/
[root@station230 yum.repos.d]# vim rhel-debuginfo.repo //可任意创建一个.repo结尾的文件
[Server]
name=Server
baseurl=file:///media/Server
enabled=1
gpgcheck=0 //是否检查软件包的签名
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@station230 ~]# yum clean all //清空缓存
安装===
[root@station230 ~]# yum install mysql-server
[root@station230 ~]# yum install httpd.i386
[root@station230 ~]# yum install httpd.x86_64
[root@station230 ~]# yum -y install mysql-server
[root@station230 ~]# yum -y install samba
[root@station230 ~]# rpm -e samba
[root@station230 ~]# yum -y remove mysql-server
[root@station230 ~]# yum -y install "mysql*" httpd vsftpd samba dovecot
[root@station230 ~]# yum -y update samba
查询===
[root@station230 ~]# yum list httpd mysql-server vsftpd tftp-server bind
Installed Packages
httpd.i386 2.2.3-63.el5 installed
mysql-server.i386 5.0.77-4.el5_6.6 installed
tftp-server.i386 0.49-2 installed
vsftpd.i386 2.0.5-24.el5 installed
Available Packages
bind.i386 30:9.3.6-20.P1.el5 Server
场景
[root@station230 ~]# rpm -e httpd
[root@station230 ~]# htpasswd 该命令或文件没有,但又不知道属于哪个包
[root@station230 ~]# yum provides */htpasswd
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Server/filelists | 2.4 MB 00:03
httpd-2.2.3-63.el5.i386 : Apache HTTP 服务器
Repo : Server
Matched from:
Filename : /usr/bin/htpasswd
[root@station230 ~]# yum -y install httpd.i386
软件包组管理:
[root@station230 ~]# yum grouplist
[root@station230 ~]# yum -y groupinstall "DNS 名称服务器"
第二种情况:第三方软件
1. 生成yum数据库 createrepo软件包
2. 指定数据库位置
3. yum安装软件包
[root@station230 soft]# yum -y install createrepo
[root@station230 soft]# pwd
/var/soft
[root@station230 soft]# ls
notecase-1.9.8-1.fc6.i386.rpm stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
ntfs-3g-2010.3.6-1.el5.i386.rpm
[root@station230 soft]# createrepo . //在当前目录生成yum数据库文件
3/3 - stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@station230 soft]# ls
notecase-1.9.8-1.fc6.i386.rpm repodata
ntfs-3g-2010.3.6-1.el5.i386.rpm stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
指定仓库
[root@station230 soft]# cd /etc/yum.repos.d/
[root@station230 yum.repos.d]# ls
redhat.repo rhel-debuginfo.repo
[root@station230 yum.repos.d]# cp rhel-debuginfo.repo newsoft.repo
[root@station230 yum.repos.d]# vim newsoft.repo
[newsoft]
name=newsoft
baseurl=file:///var/soft
enabled=1
gpgcheck=0
安装
[root@station230 ~]# rpm -q ntfs-3g
package ntfs-3g is not installed
[root@station230 ~]# yum -y install ntfs-3g
-----------------------------------------
src.rpm: bc-1.06.95-1.el6.src.rpm
需要的软件包:rpm-build,开发工具 开发库
[root@station230 software]# rpm -q rpm-build
rpm-build-4.4.2.3-27.el5
[root@station230 software]# ls /usr/src/redhat/
BUILD RPMS SOURCES SPECS
SRPMS
方法一:
1. # rpm -ivh bc-1.06.95-1.el6.src.rpm --nomd5 释放相应的文件
2. 将src.rpm编译成rpm包
# rpmbuild -ba /usr/src/redhat/SPECS/bc.spec 编译
# ls /usr/src/redhat/RPMS/i386/
bc-1.06.95-1.i386.rpm bc-debuginfo-1.06.95-1.i386.rpm
3. 安装
# rpm -ivh /usr/src/redhat/RPMS/i386/bc-1.06.95-1.i386.rpm 安装
=====================================================================
如果要使用YUM安装
[root@station230 software]# cp /usr/src/redhat/RPMS/i386/bc-1.06.95-1.i386.rpm /var/soft/ 复制到自定义库
[root@station230 software]# cd /var/soft/
[root@station230 soft]# ls
bc-1.06.95-1.i386.rpm repodata
notecase-1.9.8-1.fc6.i386.rpm stardict-langdao-ec-gb-2.4.2-1.noarch.rpm
ntfs-3g-2010.3.6-1.el5.i386.rpm
[root@station230 soft]# createrepo . 更新yum数据库
yum clean all
yum list bc
yum -y install bc
若yum安装组件时提示 “Public key for giflib-4.1.3-7.3.3.el5.i386.rpm is not installed“错误时,执行:
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release //导入rpm的签名信息
或者
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 //当系统为CentOS5时
相关文章推荐
- 配置Fedora core 6中yum光盘源 --去除无网络不能打开软件包管理的问题
- Linux学习日记 —— 6.3.1 RPM包管理-yum在线管理-IP地址配置和网络yum源
- cobbler学习(三)Yum仓库配置管理
- linux下包管理命令yum与apt-get以及开发环境配置
- RHCE课程-RH131Linux管理笔记一-RPM及其管理,YUM客户端及服务器的配置
- linux系统管理之ip配置、yum本地仓库搭建、密码破解
- Linux 之yum在线管理--IP配置
- 第二十一期 Linux配置仓库及软件管理【yum】
- Yum 仓库的管理和配置
- 软件包管理之YUM仓库配置
- 24Linux-yum在线管理,IP地址配置以及网络yum源
- YUM 服务器的配置与管理
- RHCE课程-RH131Linux管理笔记一-RPM及其管理,YUM客户端及服务器的配置 推荐
- RPM及其管理,YUM客户端及服务器的配置
- fedora 用yum来管理安装Apache+PHP+Mysql的基本安装和相关配置
- Linux学习笔记-----RPM包管理----yum在线管理之使用setup配置IP
- Linux学习笔记之 RPM包管理、Yum安装,配置及使用
- Linux学习笔记-----day4(3.15)------软件包/仓库管理与配置(rpm,yum,和源码安装)
- 项目二 任务七:管理rpm软件包与压缩包 任务八:YUM源的配置与软件的YUM安装 拓展训练
- Linux(CentOS6.x)下使用yum软件管理工具安装LNMP(Nginx+PHP+Mysql)环境并配置虚拟主机vhost