温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

linux 8

发布时间:2020-08-01 23:54:50 来源:网络 阅读:325 作者:c吕科 栏目:系统运维

# 软件包的安装:
 - rpm

linux 8 - yum
# rpm包安装
- 准备工作: 下载iso镜像
- 挂载设备到某个目录:mount xxx.iso /mnt/
- 进入Packages包执行命令:
 rpm -ivh xxx.rpm  # 安装软件, i:install,v,显示过程
 rpm -qp xxx.rpm  # 找出rpm包在系统中安装后的名字
 rpm -e xxx  # 删除软件

 查询:
  rpm -ql xxx.rpm  # 查询该软件生成了哪些文件;
  rpm -qc xxx.rpm  # 查询软件生成的配置文件;
  rpm -qa   # 查询已经安装的软件包
  rpm -qa | grep http # 查询与http相关的软件是否安装;
  rpm -qf /bin/ls  # 查看/bin/ls是由哪个软件包生成的;

- 缺点:必须切换到软件包所在的目录;依赖性需要自己查找安装;

linux 8

linux 8

linux 8

linux 8


# yum安装

- 前提
 iso镜像
 需要你的软件包仓库;


## 搭建本地yum仓库
1. 挂载iso镜像到本地的某个目录:
 mount xxx.iso /mnt/
 # 你可以在/mnt目录里面访问到iso镜像的内容;
2. 告诉yum仓库你的软件位置:
 # 切换到yum仓库配置文件所在目录
 cd /etc/yum.repos.d/
 
 # 删除装系统时默认设置配置文件
 rm -fr *

 # 编辑属于你的配置文件
 vim westos.repo  # 一定要以.repo结尾,前面任意
 ```
 [rhel7]   # 仓库名称
 name=rhel7  # 仓库描述
 baseurl=file:///mnt # 仓库地址,file://是协议,/mnt是本地所在位置;
 gpgcheck=0  # 不检测key
 enabled=1  # 1,仓库生效; 0,不生效; 
 ```
3. 清除缓存:
 # 默认会去/var/cache/yum去找软件信息,更改配置后一定要清缓存;
 yum clean all

4. 检测
 - 方法一: 
  # 列出所有的软件仓库包含的软件包;
  yum repolist

 - 方法二:
  # 任意安装一个软件
  yum install lftp -y

linux 8

linux 8

linux 8

linux 8

linux 8

linux 8


1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
## 搭建网络yum仓库


** desktop主机
1. 准备工作: 把本机文件让其他主机可以访问(httpd)
 # 一般把安装了httpd软件的主机称为Web服务器,可以共享文件给其他主机;
 yum install httpd -y
 systemctl start httpd
 systemctl enabled httpd
 systemctl stop firewalld
 systemctl disable firewalld


2. 把iso镜像的内容让其他主机可以访问:
 # /var/www/html,是http的默认发布目录,http://ip/rhel7访问;
 mkdir /var/www/html/rhel7

 # iso挂载到http的默认发布目录
 mount xxx.iso /var/www/html/rhel7

3. 修改yum仓库的配置文件
 # 只需要修改baseurl
 vim westos.repo  # 一定要以.repo结尾,前面任意
 ```
 [rhel7]   # 仓库名称
 name=rhel7  # 仓库描述
 baseurl=http://ip/rhel7 # 仓库地址,http://是协议,/rhel7是ip主机/var/www/html/rhel7目录;
 gpgcheck=0  # 不检测key
 enabled=1  # 1,仓库生效; 0,不生效; 
 ```
4. 清空缓存和检测


*** 其他主机(想使用desktop搭建好的yum仓库)
 # 只需要修改yum仓库的配置文件,同desktop第3步;

 

linux 8

linux 8

linux 8

linux 8

linux 8


## 搭建网络第三方软件仓库

- 理解什么是第三方软件?
 iso镜像里面包含4000多个软件包,但还有一些软件(eg:wps,smplayer,ntfs)没有;
 从其他地方(eg:baidu,www.pkgs.org)下载的其他软件包;


** desktop主机
1. 创建software目录,可让其他主机访问
 mkdir /var/www/html/software

2. 将第三方软件放在/var/www/html/software目录下;
 # 可通过网址http://ip/software访问;
 cp xxxx.rpm /var/www/html/software/
3. 对software目录生成repodata元数据,让系统知道该目录下有软件包;
 createrepo /var/www/html/software/

4. 修改yum仓库的配置文件;
 vim westos.repo  # 一定要以.repo结尾,前面任意
 ```
 [rhel7]   # 仓库名称
 name=rhel7  # 仓库描述
 baseurl=http://ip/rhel7 # 仓库地址,http://是协议,/rhel7是ip主机/var/www/html/rhel7目录;
 gpgcheck=0  # 不检测key
 enabled=1  # 1,仓库生效; 0,不生效; 


 [soft]   # 仓库名称
 name=soft  # 仓库描述
 baseurl=http://ip/software # 仓库地址,http://是协议,/software是ip主机/var/www/html/software目录;
 gpgcheck=0  # 不检测key
 enabled=1  # 1,仓库生效; 0,不生效; 

 ```

5. 清空缓存和检测;

 

**** 其他主机要使用第三方软件仓库:
 # 只需要修改yum仓库的配置文件,同desktop主机第4步操作;

 

linux 8

linux 8

linux 8

linux 8

linux 8

linux 8

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI