美文网首页
SUSE虚拟机搭建离线Yast源(zypper)安装GCC

SUSE虚拟机搭建离线Yast源(zypper)安装GCC

作者: 2f486f1742f0 | 来源:发表于2018-07-02 21:12 被阅读109次

    Yast源搭建

    • 挂载ISO镜像
      新建挂载目录
      mkdir /mnt/iso
      挂载iso文件
      mount -o loop /data/SLE-11-SP3-SAP-DVD-x86_64-GM-DVD.iso /mnt/iso
      确认挂载结果
    Portal:/data # df -h
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda2        97G   16G   76G  18% /
    udev             16G  104K   16G   1% /dev
    tmpfs            16G   72K   16G   1% /dev/shm
    /dev/loop0      3.2G  3.2G     0 100% /mnt/iso
    Portal:/data #
    
    • 添加zypper安装源
      zypper ar /mnt/iso/ suse11sp3iso (ar=addrepo)
      最后一部分是昵称,中间路径也可以是web链接。
    Portal:/data # zypper ar /mnt/iso/ suse11sp3iso
    Adding repository 'suse11sp3iso' [done]
    Repository 'suse11sp3iso' successfully added
    Enabled: Yes
    Autorefresh: No
    GPG check: Yes
    URI: dir:///mnt/iso
    
    • zypper 命令
      列出软件仓库zypper repos,更多详情zypper repos -d
    Portal:/data # zypper repos
    # | Alias                                 | Name                                  | Enabled | Refresh
    --+---------------------------------------+---------------------------------------+---------+--------
    1 | SLES-for-SAP-Applications 11.3.3-1.17 | SLES-for-SAP-Applications 11.3.3-1.17 | Yes     | No
    2 | suse11sp3iso                          | suse11sp3iso                          | Yes     | No
    Portal:/data #
    
    • 安装GCC、G++

    搜索软件包
    zypper search gcc-c++

    Portal:/data # zypper search gcc-c++
    Loading repository data...
    Reading installed packages...
    
    S | Name    | Summary                     | Type
    --+---------+-----------------------------+--------
      | gcc-c++ | The system GNU C++ Compiler | package
    Portal:/data #
    

    zypper search gcc

    Portal:/data # zypper search gcc
    Loading repository data...
    Reading installed packages...
    
    S | Name            | Summary                                       | Type
    --+-----------------+-----------------------------------------------+--------
      | gcc             | The system GNU C Compiler                     | package
      | gcc-32bit       | The system GNU C Compiler                     | package
      | gcc-c++         | The system GNU C++ Compiler                   | package
      | gcc-info        | The system GNU Compiler documentation         | package
      | gcc-locale      | The system GNU Compiler locale files          | package
      | gcc43           | The GNU C Compiler and Support Files          | package
      | gcc43-32bit     | The GNU C Compiler 32bit support              | package
      | gcc43-c++       | The GNU C++ Compiler                          | package
      | gcc43-info      | Documentation for the GNU compiler collection | package
      | gcc43-locale    | Locale Data for the GNU Compiler Collection   | package
    i | libgcc43        | C compiler runtime library                    | package
    i | libgcc43-32bit  | C compiler runtime library                    | package
    i | libgcc46        | C compiler runtime library                    | package
    i | libgcc46-32bit  | C compiler runtime library                    | package
    i | libgcc_s1       | C compiler runtime library                    | package
    i | libgcc_s1-32bit | C compiler runtime library                    | package
    Portal:/data #
    

    安装GCC软件包
    zypper install gcc gcc-c++ gcc-info autoconf automake bison flex make
    (gcc gcc-c++必选)

    • 查看安装的软件包
    Portal:/data #  rpm -ql gcc
    /usr/bin/cc
    /usr/bin/gcc
    /usr/bin/gcov
    /usr/share/man/man1/cc.1.gz
    /usr/share/man/man1/gcc.1.gz
    /usr/share/man/man1/gcov.1.gz
    Portal:/data #
    
    Portal:/data #  rpm -ql gcc-c++
    /usr/bin/c++
    /usr/bin/g++
    /usr/share/man/man1/c++.1.gz
    /usr/share/man/man1/g++.1.gz
    Portal:/data #
    

    查看安装软件的版本:

    Portal:/data # rpm -q gcc
    gcc-4.3-62.198
    Portal:/data # rpm -q gcc-c++
    gcc-c++-4.3-62.198
    Portal:/data #
    
    • 删除Zypper软件源
      清理缓存zypper clean
      列出软件仓库zypper repos
      删除软件仓库zypper rr <Name> (rr=removerepo )

    如果软件源名称含空格,则使用双引号把名称括起来。

    相关文章

      网友评论

          本文标题:SUSE虚拟机搭建离线Yast源(zypper)安装GCC

          本文链接:https://www.haomeiwen.com/subject/yyzluftx.html