1.使用网络安装资源安装软件
1.切换目录
cd /etc/yum.repos.d
2.建立文件
vim westos.repo ##文件必须以.repo结尾
[redhat] ##仓库名称
name=haha ##对软件源的描述
baseurl=http://172.25.254.250/rhel7.3/x86_64/dvd/##基础路径网络安装源
gpgcheck=0 ##0取消校验步骤 1不取消校验步骤
yum clean all ##清空系统中原有的yum信息
3.yum repolist ##yum列表
[root@software_install ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id repo name status
redhat test 4,751
repolist: 4,751
2.配置本地yum源
1.获取一个与本机系统版本一致的系统镜像
建立/iso/将镜像文件放入,这样更安全
[root@foundation32 ~]# mkdir /iso
[root@foundation32 ~]# mv /home/kiosk/Desktop/rhel-server-7.3-x86_64-dvd.iso /iso
2.挂载镜像
mount /xxx/xxxx.iso /rhel7.3
[root@foundation32 ~]# mkdir /redhatyum
[root@foundation32 ~]# mount /iso/rhel-server-7.3-x86_64-dvd.iso /redhatyum/
mount: /dev/loop0 is write-protected, mounting read-only
3.设定永久挂载
vim /etc/rc.d/rc.local
mount /xx/xx.iso /rhel7.3
chmod 755 /etc/rc.d/rc.local ##在系统开机时会自动执行此脚本
4.设定系统安装源指向
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/* /etc/yum.repos.d/backup
vim /etc/yum.repos.d/westos.repo
1 [rhel7.3]
2 name=rhel7.3
3 baseurl=file:///var/www/html/westos/
4 gpgcheck=0
yum clean all
yum install httpd
[root@foundation32 ~]# cd /etc/yum.repos.d/
[root@foundation32 yum.repos.d]# ls
redhat.repo rhel-dvd.repo rht-ucf.repo
[root@foundation32 yum.repos.d]# mkdir backup
[root@foundation32 yum.repos.d]# ls
backup redhat.repo rhel-dvd.repo rht-ucf.repo
[root@foundation32 yum.repos.d]# mv * backup/
mv: cannot move ‘backup’ to a subdirectory of itself, ‘backup/backup’
[root@foundation32 yum.repos.d]# vim westos.repo
[root@foundation32 yum.repos.d]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository 'rhel7.3': Error parsing config: Error parsing "baseurl = 'file:// /redhatyum'": URL must be http, ftp, file or https not ""
repolist: 0
3.共享型yum源的部署
1.在一台已经连接好本地yum源的主机中安装http
yum install httpd
2.配置网络yum源
systemctl start httpd
systemctl enable httpd
systemctl stop firewalld.service
systemctl disable firewalld.service
mkdir /var/www/html/westos
mount /iso/rhel-server-7.3-x86_64-dvd.iso /var/www/html/westos/
vim /etc/rc.d/rc.local
14 mount /iso/rhel-server-7.3-x86_64-dvd.iso /var/www/html/westos/
chmod +x /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
测试:
在浏览器输入地址
http://ip/rhel7.3
4.yum命令
1.yum命令的使用必须是在yum源搭建成功后才能正常运行
2.yum命令详细用法
yum | clean all | ##清除原有yum缓存 |
---|
| repolist | ##列出仓库信息 |
| install software | ##安装 |
| update | ##更新 |
| list software | ##查看软件 |
| list all | ##查看所有软件 |
| list installed | ##列出已安装软件 |
| list available | ##列出可安装软件 |
| reinstall software | ##重新安装 |
| remove software | ##卸载 |
| info software | ##查看软件信息 |
| search software信息 | ##根据软件信息查找软件 |
| whatprovides file | ##根据文件找出包含此文件的软件 |
| groups list | ##列出软件组groups info |
| roups install sfgroup | ##安装软件组 |
| groups remove sfgroup | ##卸载软件组 |
5.用rpm命令处理软件
rpm
-i | ##安装 |
---|
-v | ##显示过程 |
-h | ##hash加密 |
-e | ##卸载 |
-q | ##查看 |
-a | ##所有 |
-p | ##软件包 |
-ql | ##查看软件在系统中的安装文件路径 |
-qlp | ##查看未安装的软件包在系统中如果安装后产生文件的路径 |
-qf | ##根据某个文件找出此文件属于那个安装包 |
-qc | ##查看软件的配置文件名称 |
-qd | ##查看软件的帮助文件 |
–scritps | ##查看脚本 |
–nodeps | ##安装软件忽略软件依赖 |
–force | ##强行安装软件 |
-Kv | ##检测软件包是否被篡改 |
6.软件包名称详解
kolourpaint-4.10.5-4.el7.x86_64.rpm
[1] [2] [3] [4] [5]
[1]软件名称
[2]版本
[3]适用系统
[4]架构
[5]适用rpm体系软件
7.第三方软件仓库的搭建
1.
将所有的rpm包放到一个目录中
2.
createrepo -v /存放软件包的目录 ##命令执行成功会生成repodate目录
3.vim /etc/yum.epos.d/yum.repo
[software]
name=third software
baseurl=file:///software
gpgcheck=0
yum clean all
yum list linux
yum install kolourpaint
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)