首页 > 代码库 > Linux/yum

Linux/yum

作业六:yum命令
1) 自定义yum仓库:createrepo
[root@localhost /]#mkdir /rpm_bak
[root@localhost /]#cp /media/Packages/apr-* /rpm_bak/
[root@localhost /]#cp /media/Packages/mailcap-2.1.41-2.el7.noarch.rpm /rpm_bak/
[root@localhost /]#cp /media/Packages/httpd-2.4.6-40.el7.centos.x86_64.rpm /rpm_bak/
[root@localhost /]# createrepo /rpm_bak/
Spawning worker 0 with 17 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost rpm_bak]# ls -l /rpm_bak
出现repodata目录
drwxr-xr-x. 2 root root 4096 3月 17 18:41 repodata

2) 自定义repo文件
[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# cat local.repo
[local]
name=local repo
baseurl=file:///rpm_bak
enabled=1
gpgcheck=0

3) 使用yum命令安装httpd软件包
安装:
yum install httpd -y
4) 卸载httpd软件包:yum –y remove 软件名
yum –y remove httpd
yum -y erase httpd
5) 使用yum安装组件‘KDE 桌面‘:yum –y groupinstall 组件名
[root@localhost yum.repos.d]# cat local.repo
[local]
name=local repo
baseurl=file:///media
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum grouplist
[root@localhost yum.repos.d]# yum -y groupinstall "KDE Plasma Workspaces"
[root@localhost yum.repos.d]# yum -y groupinstall "虚拟化主机"


6) 掌握使用yum删除组件‘KDE 桌面’:yum –y groupremove 组件名
[root@localhost yum.repos.d]# yum -y groupremove "虚拟化主机"

7) 掌握清除yum缓存:yum clean all
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: local
Cleaning up everything
Cleaning up list of fastest mirrors

8) 使用yum查找软件包:yum search 软件包名
[root@localhost yum.repos.d]# yum search httpd

Linux/yum