论坛首页 编程语言技术论坛

跟散仙学shell命令(七)

浏览 1889 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2014-08-05  
本篇主要写关于Linux的文件系统的管理,在使用linux时,我们需要决定我们的系统的存储设备用什么文件系统,安装linux发行版时,会提供一个默认的文件系统,散仙在虚拟机里面安装的系统,一般都是ext4的系统作为默认的系统。


linux提供了一些不同的工具,可以让命令行下操作文件系统更方便,我们可以通过shell命令来轻松的创建新的系统和修改已有的文件系统。


1,创建一个分区来容纳文件系统,使用命令fdisk /dev/sdc
2,创建文件系统sudo mkfs.ext4 /dev/sdc
3, 挂载虚拟目录sudo monut -t ext4 /dev/sdb1 /mnt/test

上面的部分,在实际开发中,很少用到,一般会由运维人员给我们做这些底层工作,所以散仙就简单说下

下面重点介绍下,在linux中如何安装软件程序,yum是red hat系列操作系统中的神器,使用它我们很轻松的安装很多软件。


1,找出系统上已经安装的包 命令:yum list installed

<pre name="code" class="java">[root@h1 ~]# yum list installed
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
base                                                                                                                                                     | 3.7 kB     00:00    
extras                                                                                                                                                   | 3.4 kB     00:00    
updates                                                                                                                                                  | 3.4 kB     00:00    
updates/primary_db                                                                                                                                       | 4.7 MB     00:01    
Installed Packages
MAKEDEV.x86_64                                                        3.24-6.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
acl.x86_64                                                            2.2.49-6.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
attr.x86_64                                                           2.4.44-7.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
audit.x86_64                                                          2.2-2.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
audit-libs.x86_64                                                     2.2-2.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
authconfig.x86_64                                                     6.1.12-13.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
b43-openfwwf.noarch                                                   5.2-4.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
basesystem.noarch                                                     10.0-4.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
bash.x86_64                                                           4.1.2-15.el6_4                                                    @anaconda-CentOS-201311272149.x86_64/6.5
binutils.x86_64                                                       2.20.51.0.2-5.36.el6                                              @anaconda-CentOS-201311272149.x86_64/6.5
bridge-utils.x86_64                                                   1.2-10.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
bzip2.x86_64                                                          1.0.5-7.el6_0                                                     @anaconda-CentOS-201311272149.x86_64/6.5
bzip2-libs.x86_64                                                     1.0.5-7.el6_0                                                     @anaconda-CentOS-201311272149.x86_64/6.5
ca-certificates.noarch                                                2013.1.94-65.0.el6                                                @anaconda-CentOS-201311272149.x86_64/6.5
centos-release.x86_64                                                 6-5.el6.centos.11.1                                               @anaconda-CentOS-201311272149.x86_64/6.5
checkpolicy.x86_64                                                    2.0.22-1.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
chkconfig.x86_64                                                      1.3.49.3-2.el6_4.1                                                @anaconda-CentOS-201311272149.x86_64/6.5
coreutils.x86_64                                                      8.4-31.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
coreutils-libs.x86_64                                                 8.4-31.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
cpio.x86_64                                                           2.10-11.el6_3                                                     @anaconda-CentOS-201311272149.x86_64/6.5
cracklib.x86_64                                                       2.8.16-4.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
cracklib-dicts.x86_64                                                 2.8.16-4.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
cronie.x86_64                                                         1.4.4-12.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
cronie-anacron.x86_64                                                 1.4.4-12.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
crontabs.noarch                                                       1.10-33.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
cryptsetup-luks.x86_64                                                1.2.0-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
cryptsetup-luks-libs.x86_64                                           1.2.0-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
curl.x86_64                                                           7.19.7-37.el6_4                                                   @anaconda-CentOS-201311272149.x86_64/6.5
cyrus-sasl.x86_64                                                     2.1.23-13.el6_3.1                                                 @anaconda-CentOS-201311272149.x86_64/6.5
cyrus-sasl-lib.x86_64                                                 2.1.23-13.el6_3.1                                                 @anaconda-CentOS-201311272149.x86_64/6.5
dash.x86_64                                                           0.5.5.1-4.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
db4.x86_64                                                            4.7.25-18.el6_4                                                   @anaconda-CentOS-201311272149.x86_64/6.5
db4-utils.x86_64                                                      4.7.25-18.el6_4                                                   @anaconda-CentOS-201311272149.x86_64/6.5
dbus-glib.x86_64                                                      0.86-6.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
dbus-libs.x86_64                                                      1:1.2.24-7.el6_3                                                  @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper.x86_64                                                  1.02.79-8.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper-event.x86_64                                            1.02.79-8.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper-event-libs.x86_64                                       1.02.79-8.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper-libs.x86_64                                             1.02.79-8.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper-multipath.x86_64                                        0.4.9-72.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper-multipath-libs.x86_64                                   0.4.9-72.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
device-mapper-persistent-data.x86_64                                  0.2.8-2.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
dhclient.x86_64                                                       12:4.1.1-38.P1.el6.centos                                         @anaconda-CentOS-201311272149.x86_64/6.5
dhcp-common.x86_64                                                    12:4.1.1-38.P1.el6.centos                                         @anaconda-CentOS-201311272149.x86_64/6.5
diffutils.x86_64                                                      2.8.1-28.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
dos2unix.x86_64                                                       3.1-37.el6                                                        @base                                  
dracut.noarch                                                         004-335.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
dracut-kernel.noarch                                                  004-335.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
e2fsprogs.x86_64                                                      1.41.12-18.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
e2fsprogs-libs.x86_64                                                 1.41.12-18.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
efibootmgr.x86_64                                                     0.5.4-11.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
elfutils-libelf.x86_64                                                0.152-1.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
ethtool.x86_64                                                        2:3.5-1.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
expat.x86_64                                                          2.0.1-11.el6_2                                                    @anaconda-CentOS-201311272149.x86_64/6.5
file.x86_64                                                           5.04-15.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
file-libs.x86_64                                                      5.04-15.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
filesystem.x86_64                                                     2.4.30-3.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
findutils.x86_64                                                      1:4.4.2-6.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
fipscheck.x86_64                                                      1.2.0-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
fipscheck-lib.x86_64                                                  1.2.0-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
fuse.x86_64                                                           2.8.3-4.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
gamin.x86_64                                                          0.1.10-9.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
gawk.x86_64                                                           3.1.7-10.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
gdbm.x86_64                                                           1.8.0-36.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
git.x86_64                                                            1.7.1-3.el6_4.1                                                   @base                                  
glib2.x86_64                                                          2.26.1-3.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
glibc.x86_64                                                          2.12-1.132.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
glibc-common.x86_64                                                   2.12-1.132.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
gmp.x86_64                                                            4.3.1-7.el6_2.2                                                   @anaconda-CentOS-201311272149.x86_64/6.5
gnupg2.x86_64                                                         2.0.14-6.el6_4                                                    @anaconda-CentOS-201311272149.x86_64/6.5
gpgme.x86_64                                                          1.1.8-3.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
gpm-libs.x86_64                                                       1.20.6-12.el6                                                     @base                                  
grep.x86_64                                                           2.6.3-4.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
groff.x86_64                                                          1.18.1.4-21.el6                                                   @anaconda-CentOS-201311272149.x86_64/6.5
grub.x86_64                                                           1:0.97-83.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
grubby.x86_64                                                         7.0.15-5.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
gzip.x86_64                                                           1.3.12-19.el6_4                                                   @anaconda-CentOS-201311272149.x86_64/6.5
hwdata.noarch                                                         0.233-9.1.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
info.x86_64                                                           4.13a-8.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
initscripts.x86_64                                                    9.03.40-2.el6.centos                                              @anaconda-CentOS-201311272149.x86_64/6.5
iproute.x86_64                                                        2.6.32-31.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
iptables.x86_64                                                       1.4.7-11.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
iptables-ipv6.x86_64                                                  1.4.7-11.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
iputils.x86_64                                                        20071127-17.el6_4.2                                               @anaconda-CentOS-201311272149.x86_64/6.5
iscsi-initiator-utils.x86_64                                          6.2.0.873-10.el6                                                  @anaconda-CentOS-201311272149.x86_64/6.5
kbd.x86_64                                                            1.15-11.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
kbd-misc.noarch                                                       1.15-11.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
kernel.x86_64                                                         2.6.32-431.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
kernel-firmware.noarch                                                2.6.32-431.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
keyutils-libs.x86_64                                                  1.4-4.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
kpartx.x86_64                                                         0.4.9-72.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
krb5-libs.x86_64                                                      1.10.3-10.el6_4.6                                                 @anaconda-CentOS-201311272149.x86_64/6.5
less.x86_64                                                           436-10.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
libacl.x86_64                                                         2.2.49-6.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libaio.x86_64                                                         0.3.107-10.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
libattr.x86_64                                                        2.4.44-7.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libblkid.x86_64                                                       2.17.2-12.14.el6                                                  @anaconda-CentOS-201311272149.x86_64/6.5
libcap.x86_64                                                         2.16-5.5.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libcap-ng.x86_64                                                      0.6.4-3.el6_0.1                                                   @anaconda-CentOS-201311272149.x86_64/6.5
libcom_err.x86_64                                                     1.41.12-18.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
libcurl.x86_64                                                        7.19.7-37.el6_4                                                   @anaconda-CentOS-201311272149.x86_64/6.5
libdrm.x86_64                                                         2.4.45-2.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libedit.x86_64                                                        2.11-4.20080712cvs.1.el6                                          @anaconda-CentOS-201311272149.x86_64/6.5
libffi.x86_64                                                         3.0.5-3.2.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
libgcc.x86_64                                                         4.4.7-4.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
libgcrypt.x86_64                                                      1.4.5-11.el6_4                                                    @anaconda-CentOS-201311272149.x86_64/6.5
libgpg-error.x86_64                                                   1.7-4.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
libidn.x86_64                                                         1.18-2.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
libnih.x86_64                                                         1.0.1-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
libpciaccess.x86_64                                                   0.13.1-2.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libselinux.x86_64                                                     2.0.94-5.3.el6_4.1                                                @anaconda-CentOS-201311272149.x86_64/6.5
libselinux-utils.x86_64                                               2.0.94-5.3.el6_4.1                                                @anaconda-CentOS-201311272149.x86_64/6.5
libsemanage.x86_64                                                    2.0.43-4.2.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
libsepol.x86_64                                                       2.0.41-4.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libss.x86_64                                                          1.41.12-18.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
libssh2.x86_64                                                        1.4.2-1.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
libstdc++.x86_64                                                      4.4.7-4.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
libtasn1.x86_64                                                       2.3-3.el6_2.1                                                     @anaconda-CentOS-201311272149.x86_64/6.5
libudev.x86_64                                                        147-2.51.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
libusb.x86_64                                                         0.1.12-23.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
libuser.x86_64                                                        0.56.13-5.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
libutempter.x86_64                                                    1.1.5-4.1.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
libuuid.x86_64                                                        2.17.2-12.14.el6                                                  @anaconda-CentOS-201311272149.x86_64/6.5
libxml2.x86_64                                                        2.7.6-14.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
logrotate.x86_64                                                      3.7.8-17.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
lsscsi.x86_64                                                         0.23-2.el6                                                        @base                                  
lua.x86_64                                                            5.1.4-4.1.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
lvm2.x86_64                                                           2.02.100-8.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
lvm2-libs.x86_64                                                      2.02.100-8.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
m4.x86_64                                                             1.4.13-5.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
make.x86_64                                                           1:3.81-20.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
man.x86_64                                                            1.6f-32.el6                                                       @base                                  
man-pages.noarch                                                      3.22-20.el6                                                       @base                                  
man-pages-cs.noarch                                                   0.18.20090209-2.1.el6                                             @base                                  
man-pages-es.noarch                                                   1.55-14.el6                                                       @base                                  
man-pages-es-extra.noarch                                             1.55-14.el6                                                       @base                                  
man-pages-fr.noarch                                                   3.23-10.el6                                                       @base                                  
man-pages-it.noarch                                                   2.80-6.el6                                                        @base                                  
man-pages-ja.noarch                                                   20100115-6.el6                                                    @base                                  
man-pages-ko.noarch                                                   2:20050219-17.el6                                                 @base                                  
man-pages-overrides.noarch                                            6.5.3-1.el6_5                                                     @updates                               
man-pages-pl.noarch                                                   0.24-8.1.el6                                                      @base                                  
man-pages-ru.noarch                                                   0.97-9.el6                                                        @base                                  
man-pages-uk.noarch                                                   0.1-0.11.20071108.el6                                             @base                                  
mdadm.x86_64                                                          3.2.6-7.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
mingetty.x86_64                                                       1.08-5.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
module-init-tools.x86_64                                              3.9-21.el6_4                                                      @anaconda-CentOS-201311272149.x86_64/6.5
mysql.x86_64                                                          5.1.73-3.el6_5                                                    @updates                               
mysql-libs.x86_64                                                     5.1.73-3.el6_5                                                    @updates                               
mysql-server.x86_64                                                   5.1.73-3.el6_5                                                    @updates                               
ncurses.x86_64                                                        5.7-3.20090208.el6                                                @anaconda-CentOS-201311272149.x86_64/6.5
ncurses-base.x86_64                                                   5.7-3.20090208.el6                                                @anaconda-CentOS-201311272149.x86_64/6.5
ncurses-libs.x86_64                                                   5.7-3.20090208.el6                                                @anaconda-CentOS-201311272149.x86_64/6.5
net-tools.x86_64                                                      1.60-110.el6_2                                                    @anaconda-CentOS-201311272149.x86_64/6.5
newt.x86_64                                                           0.52.11-3.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
newt-python.x86_64                                                    0.52.11-3.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
nspr.x86_64                                                           4.10.0-1.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
nss.x86_64                                                            3.15.1-15.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
nss-softokn.x86_64                                                    3.14.3-9.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
nss-softokn-freebl.x86_64                                             3.14.3-9.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
nss-sysinit.x86_64                                                    3.15.1-15.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
nss-tools.x86_64                                                      3.15.1-15.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
nss-util.x86_64                                                       3.15.1-3.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
openldap.x86_64                                                       2.4.23-32.el6_4.1                                                 @anaconda-CentOS-201311272149.x86_64/6.5
openssh.x86_64                                                        5.3p1-94.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
openssh-clients.x86_64                                                5.3p1-94.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
openssh-server.x86_64                                                 5.3p1-94.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
openssl.x86_64                                                        1.0.1e-15.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
p11-kit.x86_64                                                        0.18.5-2.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
p11-kit-trust.x86_64                                                  0.18.5-2.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
pam.x86_64                                                            1.1.1-17.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
passwd.x86_64                                                         0.77-4.el6_2.2                                                    @anaconda-CentOS-201311272149.x86_64/6.5
pciutils-libs.x86_64                                                  3.1.10-2.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
pcre.x86_64                                                           7.8-6.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
perl.x86_64                                                           4:5.10.1-136.el6                                                  @base                                  
perl-DBD-MySQL.x86_64                                                 4.013-3.el6                                                       @base                                  
perl-DBI.x86_64                                                       1.609-4.el6                                                       @base                                  
perl-Error.noarch                                                     1:0.17015-4.el6                                                   @base                                  
perl-Git.noarch                                                       1.7.1-3.el6_4.1                                                   @base                                  
perl-Module-Pluggable.x86_64                                          1:3.90-136.el6                                                    @base                                  
perl-Pod-Escapes.x86_64                                               1:1.04-136.el6                                                    @base                                  
perl-Pod-Simple.x86_64                                                1:3.13-136.el6                                                    @base                                  
perl-libs.x86_64                                                      4:5.10.1-136.el6                                                  @base                                  
perl-version.x86_64                                                   3:0.77-136.el6                                                    @base                                  
pinentry.x86_64                                                       0.7.6-6.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
pkgconfig.x86_64                                                      1:0.23-9.1.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
plymouth.x86_64                                                       0.8.3-27.el6.centos                                               @anaconda-CentOS-201311272149.x86_64/6.5
plymouth-core-libs.x86_64                                             0.8.3-27.el6.centos                                               @anaconda-CentOS-201311272149.x86_64/6.5
plymouth-scripts.x86_64                                               0.8.3-27.el6.centos                                               @anaconda-CentOS-201311272149.x86_64/6.5
policycoreutils.x86_64                                                2.0.83-19.39.el6                                                  @anaconda-CentOS-201311272149.x86_64/6.5
popt.x86_64                                                           1.13-7.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
postfix.x86_64                                                        2:2.6.6-2.2.el6_1                                                 @anaconda-CentOS-201311272149.x86_64/6.5
procps.x86_64                                                         3.2.8-25.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
psmisc.x86_64                                                         22.6-15.el6_0.1                                                   @anaconda-CentOS-201311272149.x86_64/6.5
pth.x86_64                                                            2.0.7-9.3.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
pygpgme.x86_64                                                        0.1-18.20090824bzr68.el6                                          @anaconda-CentOS-201311272149.x86_64/6.5
python.x86_64                                                         2.6.6-51.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
python-iniparse.noarch                                                0.3.1-2.1.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
python-libs.x86_64                                                    2.6.6-51.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
python-pycurl.x86_64                                                  7.19.0-8.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
python-urlgrabber.noarch                                              3.9.1-9.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
readline.x86_64                                                       6.0-4.el6                                                         @anaconda-CentOS-201311272149.x86_64/6.5
redhat-logos.noarch                                                   60.0.14-12.el6.centos                                             @anaconda-CentOS-201311272149.x86_64/6.5
rootfiles.noarch                                                      8.1-6.1.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
rpm.x86_64                                                            4.8.0-37.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
rpm-libs.x86_64                                                       4.8.0-37.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
rpm-python.x86_64                                                     4.8.0-37.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
rsync.x86_64                                                          3.0.6-9.el6_4.1                                                   @base                                  
rsyslog.x86_64                                                        5.8.10-8.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
sed.x86_64                                                            4.2.1-10.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
selinux-policy.noarch                                                 3.7.19-231.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
selinux-policy-targeted.noarch                                        3.7.19-231.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
setup.noarch                                                          2.8.14-20.el6_4.1                                                 @anaconda-CentOS-201311272149.x86_64/6.5
shadow-utils.x86_64                                                   2:4.1.4.2-13.el6                                                  @anaconda-CentOS-201311272149.x86_64/6.5
shared-mime-info.x86_64                                               0.70-4.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
slang.x86_64                                                          2.2.1-1.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
sqlite.x86_64                                                         3.6.20-1.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
sudo.x86_64                                                           1.8.6p3-12.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
system-config-firewall-base.noarch                                    1.2.27-5.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
sysvinit-tools.x86_64                                                 2.87-5.dsf.el6                                                    @anaconda-CentOS-201311272149.x86_64/6.5
tar.x86_64                                                            2:1.23-11.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
tcp_wrappers-libs.x86_64                                              7.6-57.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
tzdata.noarch                                                         2013g-1.el6                                                       @anaconda-CentOS-201311272149.x86_64/6.5
udev.x86_64                                                           147-2.51.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
upstart.x86_64                                                        0.6.5-12.el6_4.1                                                  @anaconda-CentOS-201311272149.x86_64/6.5
ustr.x86_64                                                           1.0.4-9.1.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
util-linux-ng.x86_64                                                  2.17.2-12.14.el6                                                  @anaconda-CentOS-201311272149.x86_64/6.5
vim-common.x86_64                                                     2:7.2.411-1.8.el6                                                 @base                                  
vim-enhanced.x86_64                                                   2:7.2.411-1.8.el6                                                 @base                                  
vim-minimal.x86_64                                                    2:7.2.411-1.8.el6                                                 @anaconda-CentOS-201311272149.x86_64/6.5
which.x86_64                                                          2.19-6.el6                                                        @anaconda-CentOS-201311272149.x86_64/6.5
xfsprogs.x86_64                                                       3.1.1-14.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
xz.x86_64                                                             4.999.9-0.3.beta.20091007git.el6                                  @base                                  
xz-libs.x86_64                                                        4.999.9-0.3.beta.20091007git.el6                                  @anaconda-CentOS-201311272149.x86_64/6.5
xz-lzma-compat.x86_64                                                 4.999.9-0.3.beta.20091007git.el6                                  @base                                  
yum.noarch                                                            3.2.29-40.el6.centos                                              @anaconda-CentOS-201311272149.x86_64/6.5
yum-metadata-parser.x86_64                                            1.1.2-16.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
yum-plugin-fastestmirror.noarch                                       1.1.30-14.el6                                                     @anaconda-CentOS-201311272149.x86_64/6.5
zlib.x86_64                                                           1.2.3-29.el6                                                      @anaconda-CentOS-201311272149.x86_64/6.5
[root@h1 ~]# </pre>

2,如果输出的信息太多,我们可以重定向到一个文件中,命令如下:
yun list installed &gt;&gt; installed_software.txt


3,查看某个特定软件包的信息使用命令,和验证是否安装:
yum list 软件包名
yum list installed 软件包名

<pre name="code" class="java">[root@h1 ~]# yum list mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Installed Packages
mysql.x86_64                                                                       5.1.73-3.el6_5                                                                       @updates
[root@h1 ~]# yum list installed mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Installed Packages
mysql.x86_64                                                                       5.1.73-3.el6_5                                                                       @updates
[root@h1 ~]# </pre>

如果需要找什么软件包提供了系统上的某个文件,yum命令如下:
<pre name="code" class="java">[root@h1 ~]# yum provides /etc/yum.conf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
yum-3.2.29-40.el6.centos.noarch : RPM package installer/updater/manager
Repo        : base
Matched from:
Filename    : /etc/yum.conf



yum-3.2.29-43.el6.centos.noarch : RPM package installer/updater/manager
Repo        : updates
Matched from:
Filename    : /etc/yum.conf



yum-3.2.29-40.el6.centos.noarch : RPM package installer/updater/manager
Repo        : installed
Matched from:
Other       : Provides-match: /etc/yum.conf



[root@h1 ~]# yum provides /etc/passwd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
setup-2.8.14-20.el6_4.1.noarch : A set of system configuration and setup files
Repo        : base
Matched from:
Filename    : /etc/passwd



setup-2.8.14-20.el6_4.1.noarch : A set of system configuration and setup files
Repo        : installed
Matched from:
Other       : Provides-match: /etc/passwd



[root@h1 ~]# yum provides /var/
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
base/filelists_db                                                                                                                                        | 5.9 MB     01:23    
extras/filelists_db                                                                                                                                      |  11 kB     00:00    
updates/filelists_db                                                                                                                                     | 2.7 MB     00:01    
filesystem-2.4.30-3.el6.x86_64 : The basic directory layout for a Linux system
Repo        : base
Matched from:
Filename    : /var/



filesystem-2.4.30-3.el6.x86_64 : The basic directory layout for a Linux system
Repo        : installed
Matched from:
Other       : Provides-match: /var/



[root@h1 ~]# </pre>


yum安装软件命令 yum install 软件包名(支持通配)


<pre name="code" class="java">[root@h1 ~]# yum install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package wget.x86_64 0:1.12-1.11.el6_5 will be installed
--&gt; Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================
Package                               Arch                                    Version                                           Repository                                Size
================================================================================================================================================================================
Installing:
wget                                  x86_64                                  1.12-1.11.el6_5                                   updates                                  483 k

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

Total download size: 483 k
Installed size: 1.8 M
Is this ok [y/N]: y
Downloading Packages:
wget-1.12-1.11.el6_5.x86_64.rpm                                                                                                                          | 483 kB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : wget-1.12-1.11.el6_5.x86_64                                                                                                                                  1/1
  Verifying  : wget-1.12-1.11.el6_5.x86_64                                                                                                                                  1/1

Installed:
  wget.x86_64 0:1.12-1.11.el6_5                                                                                                                                                

Complete!
[root@h1 ~]# </pre>


使用yum手动安装rpm文件包,yum命令如下:
yum localinstall  软件包名.rpm即可


yum更新软件:
1,查看所有需要更新的内容  命令:yum list updates
<pre name="code" class="java">[root@h1 ~]# yum list updates
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
Updated Packages
audit.x86_64                                                                               2.2-4.el6_5                                                                   updates
audit-libs.x86_64                                                                          2.2-4.el6_5                                                                   updates
ca-certificates.noarch                                                                     2014.1.98-65.0.el6_5                                                          updates
centos-release.x86_64                                                                      6-5.el6.centos.11.2                                                           updates
coreutils.x86_64                                                                           8.4-31.el6_5.2                                                                updates
coreutils-libs.x86_64                                                                      8.4-31.el6_5.2                                                                updates
curl.x86_64                                                                                7.19.7-37.el6_5.3                                                             updates
device-mapper-multipath.x86_64                                                             0.4.9-72.el6_5.3                                                              updates
device-mapper-multipath-libs.x86_64                                                        0.4.9-72.el6_5.3                                                              updates
device-mapper-persistent-data.x86_64                                                       0.2.8-4.el6_5                                                                 updates
dracut.noarch                                                                              004-336.el6_5.2                                                               updates
dracut-kernel.noarch                                                                       004-336.el6_5.2                                                               updates
e2fsprogs.x86_64                                                                           1.41.12-18.el6_5.1                                                            updates
e2fsprogs-libs.x86_64                                                                      1.41.12-18.el6_5.1                                                            updates
ethtool.x86_64                                                                             2:3.5-1.4.el6_5                                                               updates
glib2.x86_64                                                                               2.26.1-7.el6_5                                                                updates
glibc.x86_64                                                                               2.12-1.132.el6_5.2                                                            updates
glibc-common.x86_64                                                                        2.12-1.132.el6_5.2                                                            updates
grep.x86_64                                                                                2.6.3-4.el6_5.1                                                               updates
grub.x86_64                                                                                1:0.97-84.el6_5                                                               updates
initscripts.x86_64                                                                         9.03.40-2.el6.centos.3                                                        updates
iproute.x86_64                                                                             2.6.32-32.el6_5                                                               updates
kernel.x86_64                                                                              2.6.32-431.23.3.el6                                                           updates
kernel-firmware.noarch                                                                     2.6.32-431.23.3.el6                                                           updates
kpartx.x86_64                                                                              0.4.9-72.el6_5.3                                                              updates
krb5-libs.x86_64                                                                           1.10.3-15.el6_5.1                                                             updates
libblkid.x86_64                                                                            2.17.2-12.14.el6_5                                                            updates
libcom_err.x86_64                                                                          1.41.12-18.el6_5.1                                                            updates
libcurl.x86_64                                                                             7.19.7-37.el6_5.3                                                             updates
libss.x86_64                                                                               1.41.12-18.el6_5.1                                                            updates
libtasn1.x86_64                                                                            2.3-6.el6_5                                                                   updates
libuuid.x86_64                                                                             2.17.2-12.14.el6_5                                                            updates
libxml2.x86_64                                                                             2.7.6-14.el6_5.2                                                              updates
mdadm.x86_64                                                                               3.2.6-7.el6_5.2                                                               updates
nspr.x86_64                                                                                4.10.6-1.el6_5                                                                updates
nss.x86_64                                                                                 3.16.1-4.el6_5                                                                updates
nss-softokn.x86_64                                                                         3.14.3-10.el6_5                                                               updates
nss-softokn-freebl.x86_64                                                                  3.14.3-10.el6_5                                                               updates
nss-sysinit.x86_64                                                                         3.16.1-4.el6_5                                                                updates
nss-tools.x86_64                                                                           3.16.1-4.el6_5                                                                updates
nss-util.x86_64                                                                            3.16.1-1.el6_5                                                                updates
openldap.x86_64                                                                            2.4.23-34.el6_5.1                                                             updates
openssl.x86_64                                                                             1.0.1e-16.el6_5.14                                                            updates
p11-kit.x86_64                                                                             0.18.5-2.el6_5.2                                                              updates
p11-kit-trust.x86_64                                                                       0.18.5-2.el6_5.2                                                              updates
postfix.x86_64                                                                             2:2.6.6-6.el6_5                                                               updates
psmisc.x86_64                                                                              22.6-19.el6_5                                                                 updates
python.x86_64                                                                              2.6.6-52.el6                                                                  updates
python-libs.x86_64                                                                         2.6.6-52.el6                                                                  updates
selinux-policy.noarch                                                                      3.7.19-231.el6_5.3                                                            updates
selinux-policy-targeted.noarch                                                             3.7.19-231.el6_5.3                                                            updates
tzdata.noarch                                                                              2014e-1.el6                                                                   updates
upstart.x86_64                                                                             0.6.5-13.el6_5.3                                                              updates
util-linux-ng.x86_64                                                                       2.17.2-12.14.el6_5                                                            updates
yum.noarch                                                                                 3.2.29-43.el6.centos                                                          updates
yum-plugin-fastestmirror.noarch                                                            1.1.30-17.el6_5                                                               updates
[root@h1 ~]# </pre>

如果你发现某个软件包需要更新,执行命令:
yum update 软件包名

更新所有的命令
yum update


yum卸载软件,命令如下:
yum remove 软件包名
要删除软件和它所有的文件命令:
yum erase 软件包名


如果包的依赖关系损坏了,先执行yum clean all,然后执行
yum update ,如果还不行,可以试试下面的这个命令:
yum deplist 软件包名 查看依赖关系后,我们就可以安装它依赖的关系。

查看我的yum的仓库命令:
yum repolist
<pre name="code" class="java">[root@h1 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.yun-idc.com
* updates: mirrors.btte.net
repo id                                                                        repo name                                                                                  status
base                                                                           CentOS-6 - Base                                                                            6,367
extras                                                                         CentOS-6 - Extras                                                                             14
updates                                                                        CentOS-6 - Updates                                                                         1,251
repolist: 7,632</pre>











论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics