第十三单元笔记总结

来源:互联网 发布:云计算系统 编辑:程序博客网 时间:2024/05/22 00:14

 软件包的安装:
   - rpm
   - yum
rpm包安装
-1.准备工作:下载iso镜像
- 2.
挂载设备到某个目录:mount xxx.iso /mnt/
- 3.
进入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是由哪个软件包生成的;

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



yum的用法

yum
上层软件管理工具,最重要的功能是可以解决软件的倚赖关系
yum
能够投入使用的前提是必须要有yum源,以及配置源的指向文件

####yum命令####
yum
    install    softwarename   ##
安装
        repolist          ##
列出设定yum源信息
        remove     softwarename   ##
卸载
        list       softwarename   ##
查看软件源中是否有次软件
        list all          ##
列出所有软件名称
        list installd         ##
列出已经安装的软件名称
        list available        ##
列出可以用yum安装的软件名称
        clean all         ##
清空yum缓存
        search     softwareinfo   ##
根据软件信息搜索软件名字
        whatprovides   filename   ##
yum源中查找包含filename文件的软件包     
        update            ##
更新软件
        history           ##
查看系统软件改变历史
        reinstall  softwarename   ##
重新安装
        info       softwarename   ##
查看软件信息
        groups list       ##
查看软件组信息
        groups infosoftwaregroup  ##
查看软件组内包含的软件
        groups install softwaregroup  ##
安装组件
        groups remove  softwaregroup  ##
卸载组件
 



# yum
安装

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


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

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

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

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







##
搭建网络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访问;
   
1.mkdir /var/www/html/rhel7

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

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


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




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

-
理解什么是第三方软件?
    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://是协议,/rhel7ip主机/var/www/html/rhel7目录;
    gpgcheck=0      #
不检测key
    enabled=1       # 1,
仓库生效; 0,不生效; 


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

    ```

5.
清空缓存和检测;



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



 



开机自动挂在iso
vim /etc/rc.d/rc.local
mount rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.1
:wq

chmod +x /etc/rc.d/rc.local


虚拟机可以连接网络


动态获取ip



原创粉丝点击