yum的各种安装 1.光盘安装 [root@localhost ~]# mkdir /install [root@localhost ~]# mount /dev/cdrom /mnt [root@localhost ~]# cp -r /mnt /install [root@localhost ~]# vi /etc/yum.repos.d/local.repo 写入如下内容:/install/Server为修改后的RPM包的路径 [rhel5-local] name=Red Hat Enterprise Linux 5 Local Repository baseurl=file:///install/Server enabled=1 gpgcheck=0 [root@localhost Server]# yum install system-config-kickstart Loading "rhnplugin" plugin Loading "security" plugin This system is not registered with RHN. RHN support will be disabled. rhel5-local 100% |=========================| 1.3 kB 00:00 primary.xml.gz 100% |=========================| 709 kB 00:00 rhel5-loca: ################################################## 2223/2223 Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package system-config-kickstart.noarch 0:2.6.19.6-1.el5 set to be updated --> Processing Dependency: pykickstart for package: system-config-kickstart --> Running transaction check ---> Package pykickstart.noarch 0:0.43.1-1.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: system-config-kickstart noarch 2.6.19.6-1.el5 rhel5-local 988 k Installing for dependencies: pykickstart noarch 0.43.1-1.el5 rhel5-local 127 k Transaction Summary ============================================================================= Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 1.1 M Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: pykickstart ######################### [1/2] Installing: system-config-kickstart ######################### [2/2] Installed: system-config-kickstart.noarch 0:2.6.19.6-1.el5 Dependency Installed: pykickstart.noarch 0:0.43.1-1.el5 Complete! 2.网络安装 A:[root@nihao ~]# vi /etc/yum.conf [Base] name=as5-base baseurl= http://centos.ustc.edu.cn/centos/5/os/i386 gpgcheck=1 gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 把上述加入文件的最后 B:[root@nihao ~]# cd /etc/yum.repos.d/ [root@nihao yum.repos.d]# vi centos.repo # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for # CentOS. # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS # updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base baseurl= http://centos.ustc.edu.cn/centos/5/os/i386/ gpgcheck=1 gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates baseurl= http://centos.ustc.edu.cn/centos/5/updates/i386/ gpgcheck=1 gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons baseurl= http://centos.ustc.edu.cn/centos/5/addons/i386/ gpgcheck=1 gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl= http://centos.ustc.edu.cn/centos/5/extras/i386/ gpgcheck=1 gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl= http://centos.ustc.edu.cn/centos/5/centosplus/i386/ gpgcheck=1 enabled=0 gpgkey= http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 把上述写入文件 3. yum各个命令 安装: yum install RPM包的名称 删除: yum remove RPM包的名称 搜索: yum search RPM包的名称 显示仓库所有文件: yum list 显示安装包详细说明信息: yum info RPM包的名称 更新安装: yum update RPM包的名称 清楚服务器仓库缓存等: yum clean all 本地安装: yum localinstall /路径/RPM包的名称 本地更新: yum localupdate /路径/RPM包的名称 显示安装包所安装的文件列表: yum provides RPM包的名称 反查文件所属安装包: yum whatprovides /路径/文件 注: 若安装时需要安装到指定的文件夹,则需要 --installroot 举例: yum install --installroot=/mnt vim 常见问题: 1、解决安装时需要KEY的问题? vim /etc/yum.conf 找到这行: gpgcheck=1 替换成: gpgcheck=0 总结: 这个是针对单机配置,所以使用file关键字,如果打算在网络内使用,则可以使用ftp关键字,当 然还要开启相应的ftp服务。具体配置参考附件脚本。另外这个配置完成以后,在使用: system-config-packages system-config-kickstart 这些工具时,也能够支持。 yum list installed #所有已安装名 yum list updates #所有可更新包 yum updates #升级系统 yum install gcc #安装gcc 4. PGP公钥解决办法: rpm --import /usr/share/rhn/RPM-PGP-KEY |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-30 03:32 , Processed in 0.173325 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.