System-Day5

System-Day5


搭建一个本地yum源

  • 挂载光盘
[root@final ~]# umount /dev/sr0
[root@final ~]# mount /dev/sr0 /media/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@final ~]# mount |tail -1
/dev/sr0 on /media type iso9660 (ro)
  • 配置本地yum源文件
//必须在这个路径下
[root@final ~]# cd /etc/yum.repos.d/
//此路径下事先有配置文件,配置文件必须以.repo结尾
[root@final yum.repos.d]# ls
localcd.repo
[root@final yum.repos.d]# vim localcd.repo 
 [c6-media]  //括号里内容要求唯一,但不要出现特殊字符
name=CentOS-$releasever - Media  //此为描述信息,可以看情况填写
baseurl=file:///media/	//些项为yum软件仓库位置,指向光盘挂载点
gpgcheck=0	//此项为检查签名,1是监测0不检测
enabled=1  //是否开启,1为开启0不开启
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6  //签名认证信息的路径
[root@final yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * c6-media: 
repo id                         repo name                               status
c6-media                        CentOS-6 - Media                        6,518
repolist: 6,518
  • 查看yum库是否有firefox包
[root@final yum.repos.d]# yum list |grep firefox
firefox.x86_64                           31.1.0-5.el6.centos            @anaconda-CentOS-201410241409.x86_64/6.6
firefox.i686                             31.1.0-5.el6.centos            c6-media
  • 利用yum安装bind包
[root@final ~]# yum install -y bind
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * c6-media: 
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.8.2-0.30.rc1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================
 Package     Arch          Version                      Repository       Size
==============================================================================
Installing:
 bind        x86_64        32:9.8.2-0.30.rc1.el6        c6-media        4.0 M

Transaction Summary
==============================================================================
Install       1 Package(s)

Total download size: 4.0 M
Installed size: 7.3 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-9.8.2-0.30.rc1.el6.x86_64                          1/1 
Unable to connect to dbus
  Verifying  : 32:bind-9.8.2-0.30.rc1.el6.x86_64                          1/1 

Installed:
  bind.x86_64 32:9.8.2-0.30.rc1.el6                                           

Complete!
  • 查看/root/install.log
less /root/install.log

使用yum管理软件包

  • yum install 软件名:安装一个软件包
  • yum remove 软件名:卸载一个软件包
  • yum provides[关键词] 搜索特定包文件名
  • yum clean all 清除全部
  • yum deplist 列出包的依赖
  • yum list 可安装和可更新的RPM包
  • yum list installed 已安装的包
  • yum list extras 已安装且不在资源库的包
  • yum localinstall 安装本地的 RPM包
  • yum update[RPM包] 更新包
[root@final ~]# yum remove -y bind
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package bind.x86_64 32:9.8.2-0.30.rc1.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================
 Package    Arch         Version                        Repository       Size
==============================================================================
Removing:
 bind       x86_64       32:9.8.2-0.30.rc1.el6          @c6-media       7.3 M

Transaction Summary
==============================================================================
Remove        1 Package(s)

Installed size: 7.3 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : 32:bind-9.8.2-0.30.rc1.el6.x86_64                          1/1 
Unable to connect to dbus
  Verifying  : 32:bind-9.8.2-0.30.rc1.el6.x86_64                          1/1 

Removed:
  bind.x86_64 32:9.8.2-0.30.rc1.el6                                           

Complete!
  • 使用yum查询与httpd相关的包
[root@final ~]# yum search httpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * c6-media: 
c6-media                                                                                           | 4.0 kB     00:00 ... 
=================================================== N/S Matched: httpd ===================================================
libmicrohttpd-devel.i686 : Development files for libmicrohttpd
libmicrohttpd-devel.x86_64 : Development files for libmicrohttpd
libmicrohttpd-doc.noarch : Documentation for libmicrohttpd
httpd.x86_64 : Apache HTTP Server
httpd-devel.i686 : Development interfaces for the Apache HTTP server
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
httpd-manual.noarch : Documentation for the Apache HTTP server
httpd-tools.x86_64 : Tools for use with the Apache HTTP Server
libmicrohttpd.i686 : Lightweight library for embedding a webserver in applications
libmicrohttpd.x86_64 : Lightweight library for embedding a webserver in applications
mod_auth_mellon.x86_64 : A SAML 2.0 authentication module for the Apache Httpd Server
mod_dav_svn.x86_64 : Apache httpd module for Subversion server
mod_dnssd.x86_64 : An Apache HTTPD module which adds Zeroconf support

  Name and summary matches only, use "search all" for everything.
  • 使用yum info 查询firefox包描述信息
[root@final ~]# yum info firefox
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * c6-media: 
c6-media                                               | 4.0 kB     00:00 ... 
Installed Packages
Name        : firefox
Arch        : x86_64
Version     : 31.1.0
Release     : 5.el6.centos
Size        : 108 M
Repo        : installed
From repo   : anaconda-CentOS-201410241409.x86_64
Summary     : Mozilla Firefox Web browser
URL         : http://www.mozilla.org/projects/firefox/
License     : MPLv1.1 or GPLv2+ or LGPLv2+
Description : Mozilla Firefox is an open-source web browser, designed for
            : standards compliance, performance and portability.

Available Packages
Name        : firefox
Arch        : i686
Version     : 31.1.0
Release     : 5.el6.centos
Size        : 60 M
Repo        : c6-media
Summary     : Mozilla Firefox Web browser
URL         : http://www.mozilla.org/projects/firefox/
License     : MPLv1.1 or GPLv2+ or LGPLv2+
Description : Mozilla Firefox is an open-source web browser, designed for
            : standards compliance, performance and portability.

使用yum管理软件组

  • yum grouplist:查看软件组列表

  • yum groupinfo:查看软件组的说明信息

  • yum groupinstall:安装指定的软件组

  • yum groupupdate:升级软件组

  • yum groupremove:卸载软件组

  • 安装图形环境
    [root@final ~]# LNAG=en
    [root@final ~]# yum groupinstall "Desktop" "Fonts" "X Window System" -y

  • 安装开发环境
    [root@final ~]# yum groupinstall -y "Development Tools"

  • 安装数据库服务器
    [root@final ~]# yum groupinstall -y mysql-server

  • 卸载数据库服务器
    [root@final ~]# yum groupremove -y mysql-server

安装源代码软件

  • 解压tar
    tar xf 软件包
  • 配置
    ./configure -参数
  • 编译
    make -j4
  • 安装
    make install

//部署编译安装环境

[root@final ~]# yum install gcc* -y
//查看GCC编译器版本
[root@final ~]# gcc --version|head -2
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
Copyright (C) 2010 Free Software Foundation, Inc.
//查看make工具版本
[root@final ~]# make -v|head -2
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.

猜你喜欢

转载自www.cnblogs.com/fina/p/9070380.html