码迷,mamicode.com
首页 > 其他好文 > 详细

yum杂记

时间:2018-03-21 11:36:41      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:yum linux 基础 杂记

yum

10.1.1 yum基本操作

查看系统是否安装了yum和yum的配置文件

[root@CentOS7 ~]# rpm -q yum
yum-3.4.3-132.el7.centos.0.1.noarch
[root@CentOS7 ~]# 
[root@CentOS7 ~]# 
[root@CentOS7 ~]# rpm -qc yum
/etc/logrotate.d/yum
/etc/yum.conf
/etc/yum/version-groups.conf

查看yum公共配置文件的参数意义

[root@CentOS7 ~]# man yum.conf

列出所有可用仓库

[root@localhost yum.repos.d]# yum repolist
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
base                                     | 3.7 kB     00:00     
epe                                      | 3.7 kB     00:00     
仓库标识                 仓库名称                          状态
base                     Base Repo on 163                  5,062
epe                      Base Repo on sohu                 5,062
repolist: 10,124

显示所有仓库

[root@localhost yum.repos.d]# yum repolist all
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
仓库标识              仓库名称                       状态
C6.0-base             CentOS-6.0 - Base              禁用
C6.0-centosplus       CentOS-6.0 - CentOSPlus        禁用
C6.0-contrib          CentOS-6.0 - Contrib           禁用
C6.0-extras           CentOS-6.0 - Extras            禁用
C6.0-updates          CentOS-6.0 - Updates           禁用
C6.1-base             CentOS-6.1 - Base              禁用
C6.1-centosplus       CentOS-6.1 - CentOSPlus        禁用
C6.1-contrib          CentOS-6.1 - Contrib           禁用
C6.1-extras           CentOS-6.1 - Extras            禁用
C6.1-updates          CentOS-6.1 - Updates           禁用
C6.2-base             CentOS-6.2 - Base              禁用
C6.2-centosplus       CentOS-6.2 - CentOSPlus        禁用
C6.2-contrib          CentOS-6.2 - Contrib           禁用
C6.2-extras           CentOS-6.2 - Extras            禁用
C6.2-updates          CentOS-6.2 - Updates           禁用
C6.3-base             CentOS-6.3 - Base              禁用
C6.3-centosplus       CentOS-6.3 - CentOSPlus        禁用
C6.3-contrib          CentOS-6.3 - Contrib           禁用
C6.3-extras           CentOS-6.3 - Extras            禁用
C6.3-updates          CentOS-6.3 - Updates           禁用
C6.4-base             CentOS-6.4 - Base              禁用
C6.4-centosplus       CentOS-6.4 - CentOSPlus        禁用
C6.4-contrib          CentOS-6.4 - Contrib           禁用
C6.4-extras           CentOS-6.4 - Extras            禁用
C6.4-updates          CentOS-6.4 - Updates           禁用
C6.5-base             CentOS-6.5 - Base              禁用
C6.5-centosplus       CentOS-6.5 - CentOSPlus        禁用
C6.5-contrib          CentOS-6.5 - Contrib           禁用
C6.5-extras           CentOS-6.5 - Extras            禁用
C6.5-updates          CentOS-6.5 - Updates           禁用
base                  Base Repo on 163               启用: 5,062
base-debuginfo        CentOS-6 - Debuginfo           禁用
c6-media              CentOS-6 - Media               禁用
epe                   Base Repo on sohu              启用: 5,062
fasttrack             CentOS-6 - fasttrack           禁用
repolist: 10,124

yum安装,自动解决下载依赖包

[root@localhost ~]# yum install gcc
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package gcc.i686 0:4.4.7-17.el6 will be 安装
--> 处理依赖关系 libgomp = 4.4.7-17.el6,它被软件包 gcc-4.4.7-17.el6.i686 需要
--> 处理依赖关系 cpp = 4.4.7-17.el6,它被软件包 gcc-4.4.7-17.el6.i686 需要
--> 处理依赖关系 libgcc >= 4.4.7-17.el6,它被软件包 gcc-4.4.7-17.el6.i686 需要
--> 处理依赖关系 cloog-ppl >= 0.15,它被软件包 gcc-4.4.7-17.el6.i686 需要
--> 执行事务检查
---> Package cloog-ppl.i686 0:0.15.7-1.2.el6 will be 安装
--> 处理依赖关系 libppl_c.so.2,它被软件包 cloog-ppl-0.15.7-1.2.el6.i686 需要
--> 处理依赖关系 libppl.so.7,它被软件包 cloog-ppl-0.15.7-1.2.el6.i686 需要
---> Package cpp.i686 0:4.4.7-17.el6 will be 安装
--> 处理依赖关系 libmpfr.so.1,它被软件包 cpp-4.4.7-17.el6.i686 需要
---> Package libgcc.i686 0:4.4.7-11.el6 will be 升级
---> Package libgcc.i686 0:4.4.7-17.el6 will be an update
---> Package libgomp.i686 0:4.4.7-11.el6 will be 升级
---> Package libgomp.i686 0:4.4.7-17.el6 will be an update
--> 执行事务检查
---> Package mpfr.i686 0:2.4.1-6.el6 will be 安装
---> Package ppl.i686 0:0.10.2-11.el6 will be 安装
--> 完成依赖关系计算

依赖关系解决

================================================================
 软件包         架构      版本                  仓库       大小
================================================================
正在安装:
 gcc            i686      4.4.7-17.el6          base      8.2 M
为依赖而安装:
 cloog-ppl      i686      0.15.7-1.2.el6        base       93 k
 cpp            i686      4.4.7-17.el6          base      3.4 M
 mpfr           i686      2.4.1-6.el6           base      153 k
 ppl            i686      0.10.2-11.el6         base      1.3 M
为依赖而更新:
 libgcc         i686      4.4.7-17.el6          base      114 k
 libgomp        i686      4.4.7-17.el6          base      136 k

事务概要
================================================================
Install       5 Package(s)
Upgrade       2 Package(s)

总下载量:13 M
确定吗?[y/N]:y
下载软件包:
(1/7): cloog-ppl-0.15.7-1.2.el6.i686.rpm |  93 kB     00:00     
(2/7): cpp-4.4.7-17.el6.i686.rpm         | 3.4 MB     00:01     
(3/7): gcc-4.4.7-17.el6.i686.rpm         | 8.2 MB     00:04     
(4/7): libgcc-4.4.7-17.el6.i686.rpm      | 114 kB     00:00     
(5/7): libgomp-4.4.7-17.el6.i686.rpm     | 136 kB     00:00     
(6/7): mpfr-2.4.1-6.el6.i686.rpm         | 153 kB     00:00     
(7/7): ppl-0.10.2-11.el6.i686.rpm        | 1.3 MB     00:00     
----------------------------------------------------------------
总计                            1.7 MB/s |  13 MB     00:07     
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
  正在升级   : libgcc-4.4.7-17.el6.i686                     1/9 
  正在安装   : ppl-0.10.2-11.el6.i686                       2/9 
  正在安装   : cloog-ppl-0.15.7-1.2.el6.i686                3/9 
  正在升级   : libgomp-4.4.7-17.el6.i686                    4/9 
  正在安装   : mpfr-2.4.1-6.el6.i686                        5/9 
  正在安装   : cpp-4.4.7-17.el6.i686                        6/9 
  正在安装   : gcc-4.4.7-17.el6.i686                        7/9 
  清理       : libgomp-4.4.7-11.el6.i686                    8/9 
  清理       : libgcc-4.4.7-11.el6.i686                     9/9 
  Verifying  : libgcc-4.4.7-17.el6.i686                     1/9 
  Verifying  : cpp-4.4.7-17.el6.i686                        2/9 
  Verifying  : mpfr-2.4.1-6.el6.i686                        3/9 
  Verifying  : ppl-0.10.2-11.el6.i686                       4/9 
  Verifying  : cloog-ppl-0.15.7-1.2.el6.i686                5/9 
  Verifying  : gcc-4.4.7-17.el6.i686                        6/9 
  Verifying  : libgomp-4.4.7-17.el6.i686                    7/9 
  Verifying  : libgomp-4.4.7-11.el6.i686                    8/9 
  Verifying  : libgcc-4.4.7-11.el6.i686                     9/9 

已安装:
  gcc.i686 0:4.4.7-17.el6                                       

作为依赖被安装:
  cloog-ppl.i686 0:0.15.7-1.2.el6    cpp.i686 0:4.4.7-17.el6    
  mpfr.i686 0:2.4.1-6.el6            ppl.i686 0:0.10.2-11.el6   

作为依赖被升级:
  libgcc.i686 0:4.4.7-17.el6     libgomp.i686 0:4.4.7-17.el6    

完毕!
[root@localhost ~]# 

卸载程序包

[root@localhost ~]# yum install php-com*
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package php-common.i686 0:5.3.3-47.el6 will be 安装
--> 完成依赖关系计算

依赖关系解决

================================================================
 软件包          架构      版本                 仓库       大小
================================================================
正在安装:
 php-common      i686      5.3.3-47.el6         base      531 k

事务概要
================================================================
Install       1 Package(s)

总下载量:531 k
Installed size: 2.9 M
确定吗?[y/N]:y
下载软件包:
php-common-5.3.3-47.el6.i686.rpm         | 531 kB     00:00     
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
  正在安装   : php-common-5.3.3-47.el6.i686                 1/1 
  Verifying  : php-common-5.3.3-47.el6.i686                 1/1 

已安装:
  php-common.i686 0:5.3.3-47.el6                                

完毕!
[root@localhost ~]# yum remove php-common.i686 0:5.3.3-47.el6
已加载插件:fastestmirror, refresh-packagekit, security
设置移除进程
参数 0:5.3.3-47.el6 没有匹配
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package php-common.i686 0:5.3.3-47.el6 will be 删除
--> 完成依赖关系计算

依赖关系解决

================================================================
 软件包          架构      版本                仓库        大小
================================================================
正在删除:
 php-common      i686      5.3.3-47.el6        @base      2.9 M

事务概要
================================================================
Remove        1 Package(s)

Installed size: 2.9 M
确定吗?[y/N]:y
下载软件包:
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
  正在删除   : php-common-5.3.3-47.el6.i686                 1/1 
  Verifying  : php-common-5.3.3-47.el6.i686                 1/1 

删除:
  php-common.i686 0:5.3.3-47.el6                                

完毕!

查看程序包信息

[root@localhost ~]# yum info gcc
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
已安装的软件包
Name        : gcc
Arch        : i686
Version     : 4.4.7
Release     : 17.el6
Size        : 15 M
Repo        : installed
From repo   : base
Summary     : Various compilers (C, C++, Objective-C, Java, ...)
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with
            : exceptions
Description : The gcc package contains the GNU Compiler
            : Collection version 4.4. You‘ll need this package
            : in order to compile C code.

查看文件或命令由哪个程序包提供

[root@localhost ~]# yum provides /bin/mkdir
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
coreutils-8.4-43.el6.i686 : A set of basic GNU tools commonly
                          : used in shell scripts
Repo        : base
匹配来自于:
Filename    : /bin/mkdir

coreutils-8.4-43.el6.i686 : A set of basic GNU tools commonly
                          : used in shell scripts
Repo        : epe
匹配来自于:
Filename    : /bin/mkdir

coreutils-8.4-37.el6.i686 : A set of basic GNU tools commonly
                          : used in shell scripts
Repo        : installed
匹配来自于:
Other       : 提供依赖满足:/bin/mkdir

清理yum本地缓存

[root@localhost ~]# yum clean all
已加载插件:fastestmirror, refresh-packagekit, security
Cleaning repos: base epe
清理一切
Cleaning up list of fastest mirrors

以指定的关键字搜索程序包名及summary信息

[root@localhost ~]# yum search bash
已加载插件:fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
====================== N/S Matched: bash =======================
bash-doc.i686 : Documentation files for bash
pcp-pmda-bash.i686 : Performance Co-Pilot (PCP) metrics for the
                   : Bash shell
bash.i686 : The GNU Bourne Again shell

  Name and summary matches only, use "search all" for everythin

查看程序包依赖于哪些包

[root@localhost ~]# yum deplist gcc
已加载插件:fastestmirror, refresh-packagekit, security
查找依赖:
Loading mirror speeds from cached hostfile
软件包:gcc.i686 4.4.7-17.el6
   依赖: libgcc_s.so.1
   provider: libgcc.i686 4.4.7-17.el6
   provider: libgcc.i686 4.4.7-17.el6
   依赖: libgomp = 4.4.7-17.el6
   provider: libgomp.i686 4.4.7-17.el6
   provider: libgomp.i686 4.4.7-17.el6
   依赖: /sbin/install-info
   provider: info.i686 4.13a-8.el6
   provider: info.i686 4.13a-8.el6
   依赖: libgomp.so.1
   provider: libgomp.i686 4.4.7-17.el6
   provider: libgomp.i686 4.4.7-17.el6
   依赖: glibc-devel >= 2.2.90-12
   provider: glibc-devel.i686 2.12-1.192.el6
   provider: glibc-devel.i686 2.12-1.192.el6
   依赖: binutils >= 2.19.51.0.14-33
   provider: binutils.i686 2.20.51.0.2-5.44.el6
   provider: binutils.i686 2.20.51.0.2-5.44.el6
   依赖: cpp = 4.4.7-17.el6
   provider: cpp.i686 4.4.7-17.el6
   provider: cpp.i686 4.4.7-17.el6
   依赖: libc.so.6(GLIBC_2.7)
   provider: glibc.i686 2.12-1.192.el6
   provider: glibc.i686 2.12-1.192.el6
   依赖: rtld(GNU_HASH)
   provider: glibc.i686 2.12-1.192.el6
   provider: glibc.i686 2.12-1.192.el6
   依赖: libgcc >= 4.4.7-17.el6
   provider: libgcc.i686 4.4.7-17.el6
   provider: libgcc.i686 4.4.7-17.el6
   依赖: /bin/sh
   provider: bash.i686 4.1.2-40.el6
   provider: bash.i686 4.1.2-40.el6
   依赖: cloog-ppl >= 0.15
   provider: cloog-ppl.i686 0.15.7-1.2.el6
   provider: cloog-ppl.i686 0.15.7-1.2.el6
软件包:gcc.i686 4.4.7-17.el6
   依赖: libgcc_s.so.1
   provider: libgcc.i686 4.4.7-17.el6
   provider: libgcc.i686 4.4.7-17.el6
   依赖: libgomp = 4.4.7-17.el6
   provider: libgomp.i686 4.4.7-17.el6
   provider: libgomp.i686 4.4.7-17.el6
   依赖: /sbin/install-info
   provider: info.i686 4.13a-8.el6
   provider: info.i686 4.13a-8.el6
   依赖: libgomp.so.1
   provider: libgomp.i686 4.4.7-17.el6
   provider: libgomp.i686 4.4.7-17.el6
   依赖: glibc-devel >= 2.2.90-12
   provider: glibc-devel.i686 2.12-1.192.el6
   provider: glibc-devel.i686 2.12-1.192.el6
   依赖: binutils >= 2.19.51.0.14-33
   provider: binutils.i686 2.20.51.0.2-5.44.el6
   provider: binutils.i686 2.20.51.0.2-5.44.el6
   依赖: cpp = 4.4.7-17.el6
   provider: cpp.i686 4.4.7-17.el6
   provider: cpp.i686 4.4.7-17.el6
   依赖: libc.so.6(GLIBC_2.7)
   provider: glibc.i686 2.12-1.192.el6
   provider: glibc.i686 2.12-1.192.el6
   依赖: rtld(GNU_HASH)
   provider: glibc.i686 2.12-1.192.el6
   provider: glibc.i686 2.12-1.192.el6
   依赖: libgcc >= 4.4.7-17.el6
   provider: libgcc.i686 4.4.7-17.el6
   provider: libgcc.i686 4.4.7-17.el6
   依赖: /bin/sh
   provider: bash.i686 4.1.2-40.el6
   provider: bash.i686 4.1.2-40.el6
   依赖: cloog-ppl >= 0.15
   provider: cloog-ppl.i686 0.15.7-1.2.el6
   provider: cloog-ppl.i686 0.15.7-1.2.el6

查看yum事务(安装、升级、卸载)

[root@localhost ~]# yum history
已加载插件:fastestmirror, refresh-packagekit, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     6 | root <root>              | 2016-07-19 21:01 | Erase          |    1   
     5 | root <root>              | 2016-07-19 21:00 | Install        |    1   
     4 | root <root>              | 2016-07-19 20:48 | I, U           |    7  <
     3 | root <root>              | 2016-07-19 20:46 | Install        |    1 > 
     2 | root <root>              | 2015-08-31 20:43 | Install        |    1   
     1 | 系统 <空>                | 2015-06-06 17:47 | Install        | 1271   
history list

查看包组信息

[root@localhost ~]# yum grouplist
已加载插件:fastestmirror, refresh-packagekit, security
设置组进程
Loading mirror speeds from cached hostfile
base/group_gz                            | 220 kB     00:00     
epe/group_gz                             | 220 kB     00:12     
已安装的组:
   FTP 服务器
   Java 平台
   KDE 桌面
   MySQL 数据库客户端
   MySQL 数据库服务器
   NFS 文件服务器
   Perl 支持
   SNMP 支持
   Web 服务器程序引擎
   X 窗口系统
   万维网服务器
   互联网应用程序
   互联网浏览器
……

包组安装

yum groupinstall "Development Tools"

查看包组信息

yum groupinfo "Development Tools"
[root@localhost ~]# yum groupinfo "Development Tools"
已加载插件:fastestmirror, refresh-packagekit, security
设置组进程
Loading mirror speeds from cached hostfile

组:开发工具
 描述:基本开发环境。
 必要的软件包:
   autoconf
   automake
   binutils
   pkgconfig
   redhat-rpm-config
   rpm-build
 默认的软件包:
   byacc
   cscope
   ctags
   cvs
   swig
   systemtap
 可选的软件包:
   ElectricFence
   PyYAML
   ant
   babel
   bzr
   chrpath
   cmake
   compat-gcc-34
   compat-gcc-34-c++

10.1.2

光盘yum源

[root@CentOS7 yum.repos.d]# cat local.repo 
[base-cd]
name=CentOS 7 from CD
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0

查看光盘包组信息

[root@CentOS7 yum.repos.d]# 
[root@CentOS7 yum.repos.d]# yum grouplist
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
Done

10.2

创建yum仓库

[root@CentOS7 ~]# yum install createrepo
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package createrepo.noarch 0:0.9.9-23.el7 will be installed
--> Processing Dependency: python-deltarpm for package: createrepo-0.9.9-23.el7.noarch
--> Processing Dependency: deltarpm for package: createrepo-0.9.9-23.el7.noarch
--> Running transaction check
---> Package deltarpm.x86_64 0:3.6-3.el7 will be installed
---> Package python-deltarpm.x86_64 0:3.6-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================
 Package            Arch      Version          Repository  Size
================================================================
Installing:
 createrepo         noarch    0.9.9-23.el7     base-cd     92 k
Installing for dependencies:
 deltarpm           x86_64    3.6-3.el7        base-cd     82 k
 python-deltarpm    x86_64    3.6-3.el7        base-cd     31 k

Transaction Summary
================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 205 k
Installed size: 553 k
Is this ok [y/d/N]: y
Downloading packages:
----------------------------------------------------------------
Total                              350 kB/s | 205 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), ‘yum check‘ output follows:
php-odbc-5.3.3-47.el6.x86_64 has missing requires of libodbc.so.2()(64bit)
php-odbc-5.3.3-47.el6.x86_64 has missing requires of php-common(x86-64) = (‘0‘, ‘5.3.3‘, ‘47.el6‘)
php-odbc-5.3.3-47.el6.x86_64 has missing requires of php-pdo(x86-64)
  Installing : deltarpm-3.6-3.el7.x86_64                    1/3 
  Installing : python-deltarpm-3.6-3.el7.x86_64             2/3 
  Installing : createrepo-0.9.9-23.el7.noarch               3/3 
  Verifying  : deltarpm-3.6-3.el7.x86_64                    1/3 
  Verifying  : python-deltarpm-3.6-3.el7.x86_64             2/3 
  Verifying  : createrepo-0.9.9-23.el7.noarch               3/3 

Installed:
  createrepo.noarch 0:0.9.9-23.el7                              

Dependency Installed:
  deltarpm.x86_64 0:3.6-3.el7                                   
  python-deltarpm.x86_64 0:3.6-3.el7                            

Complete!

10.2.2 ftp使用小技巧

在ftp模式下,创建本地文件夹

ftp> !mkdir /tmp/yum/repo
mkdir: cannot create directory ‘/tmp/yum/repo’: No such file or directory
ftp> !mkdir -p /tmp/yum/repo

在ftp模式下,跳转至本地目录

ftp> lcd /tmp/yum/repo
Local directory now /tmp/yum/repo

将ftp当前目录文件下载至本地

ftp> mget *.rpm

10.2.3 制作yum仓库步骤

1、首先把需要制作yum仓库的rpm包下载好

2、使用createrepo命令创建仓库

[root@CentOS7 repo]# createrepo /tmp/yum/repo/
[root@CentOS7 yum.repos.d]# vim local.repo 

   [zabbix]
   name=zabbix Centos 7
   baseurl=file:///tmp/yum/repo/
  gpgcheck=0

[root@CentOS7 repo]# yum repolist
Loaded plugins: fastestmirror, langpacks
base-cd                                  | 3.6 kB     00:00     
zabbix                                   | 2.9 kB     00:00     
zabbix/primary_db                          |  22 kB   00:00     
Loading mirror speeds from cached hostfile
repo id                 repo name                         status
base-cd                 CentOS 7 from CD                  3,723
zabbix                  zabbix Centos 7                      38
repolist: 3,761

10.2.4 编译安装

10.2.4.1 解压需要编译的软件包

[root@localhost httpd]# ll
-rw-r--r-- 1 root root 5524905 7月  21 2016 httpd-2.2.25.tar.bz2
[root@localhost httpd]# ls
httpd-2.2.25.tar.bz2
[root@localhost httpd]# 
[root@localhost httpd]# 
[root@localhost httpd]# tar xf httpd-2.2.25.tar.bz2 
[root@localhost httpd]# ll
总用量 5400
drwxr-xr-x 11 zz   zz      4096 6月  29 2013 httpd-2.2.25
-rw-r--r--  1 root root 5524905 7月  21 2016 httpd-2.2.25.tar.bz2
[root@localhost httpd]# 

[root@localhost httpd]# cd httpd-2.2.25
[root@localhost httpd-2.2.25]# ls
ABOUT_APACHE   configure.in    LAYOUT         os
acinclude.m4   docs            libhttpd.dep   README
Apache.dsw     emacs-style     libhttpd.dsp   README.platforms
build          httpd.dep       libhttpd.mak   README-win32.txt
BuildAll.dsp   httpd.dsp       LICENSE        ROADMAP
BuildBin.dsp   httpd.mak       Makefile.in    server
buildconf      httpd.spec      Makefile.win   srclib
CHANGES        include         modules        support
config.layout  INSTALL         NOTICE         test
configure      InstallBin.dsp  NWGNUmakefile  VERSIONING

10.2.4.2 阅读INSTALL内容

[root@localhost httpd-2.2.25]# less INSTALL  
APACHE INSTALLATION OVERVIEW

  Quick Start - Unix
  ------------------

  For complete installation documentation, see [ht]docs/manual/install.html or
  http://httpd.apache.org/docs/2.2/install.html

     $ ./configure --prefix=PREFIX
     $ make
     $ make install
     $ PREFIX/bin/apachectl start

     NOTES: * Replace PREFIX with the filesystem path under which 
              Apache should be installed.  A typical installation
              might use "/usr/local/apache2" for PREFIX (without the
              quotes).

            * If you are a developer who will be linking your code with
              Apache or using a debugger to step through server

10.2.4.3 通过help命令查看config的选项作用

[root@localhost httpd-2.2.25]# ./configure --help
`configure‘ configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    displa

10.2.4.5 编译安装

1、首先config配置安装路径和配置文件路径
[root@localhost httpd-2.2.25]# ./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd2 

2、开始编译
[root@localhost httpd-2.2.25]# make

3、安装
[root@localhost httpd-2.2.25]# make install

4、启动并检查服务是否开启
[root@localhost bin]# ./apachectl start
httpd: Could not reliably determine the server‘s fully qualified domain name, using ::1 for ServerName
[root@localhost bin]# netstat -tan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
tcp        0     52 10.201.106.129:22           10.201.106.1:49480          ESTABLISHED 
tcp        0      0 :::22                       :::*                        LISTEN      
tcp        0      0 ::1:631                     :::*                        LISTEN      
tcp        0      0 ::1:25                      :::*                        LISTEN      
tcp        0      0 :::80                       :::*                        LISTEN      

5、收尾
5.1 修改bin的环境变量
[root@localhost profile.d]# vim httpd.sh 

export PATH=$PATH://usr/local/apache2/bin

5.2 导出库文件路径
[root@localhost ld.so.conf.d]# vim httpd.conf
/usr/local/apache2/lib

[root@localhost ld.so.conf.d]# ldconfig -v    #重新生成库文件缓存
/usr/lib/ctapi:
libopenctapi.so -> libopenctapi.so
/usr/local/apache2/lib:
libapr-1.so.0 -> libapr-1.so.0.4.8
libexpat.so.0 -> libexpat.so.0.5.0
libaprutil-1.so.0 -> libaprutil-1.so.0.5.2

5.3 导出头文件
[root@localhost include]# ln -v ./* /usr/include

5.4 导出man帮助手册
[root@localhost man]# vim /etc/man.config
MANPATH /usr/local/apache2/man

yum杂记

标签:yum linux 基础 杂记

原文地址:http://blog.51cto.com/zhongle21/2089233

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!