相对于rpm的命令管理,不需要管理依赖性。
使用yum在线管理,不仅会安装你要安装的包,还会安装相应的依赖包。
yum在线管理的话,并不是一定要在线,可以做本地yum·源。
没有yum包这个说法,yum在线管理的还是RPM包。
ifconfig配置的IP地址,是临时生效的,一旦重启,会恢复原样。用这种方式只能配置IP和子网掩码。如果想要上网还需要网关和DNS。如果在内网访问,只要IP和子网掩码就可以了。但是如果想要访问公网,就需要网关和DNS。使用ifconfig就做不到这样的功能。
配置IP有很多种方法,我们可以选择一个比较简单的setup方法。setup是redhat系列专有的命令,setup配置IP相对简单。

按tab键可以切换。

网络yum源:


CentOS-Base.repo: 网路yum源。
CentOS-Media.repo: 本地光盘yum源。
CentOS-Base.repo里面的配置:
1 # CentOS-Base.repo
2 #
3 # The mirror system uses the connecting IP address of the client and the
4 # update status of each mirror to pick mirrors that are updated to and
5 # geographically close to the client. You should use this for CentOS update s
6 # unless you are manually picking other mirrors.
7 #
8 # If the mirrorlist= does not work for you, as a fall back you can try the
9 # remarked out baseurl= line instead.
10 #
11 #
12
13 [base]
14 name=CentOS-$releasever - Base
15 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch& repo=os&infra=$infra
16 #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
17 gpgcheck=1
18 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
19
20 #released updates
21 [updates]
22 name=CentOS-$releasever - Updates
23 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch& repo=updates&infra=$infra
24 #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
25 gpgcheck=1
26 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
27
28 #additional packages that may be useful
29 [extras]
30 name=CentOS-$releasever - Extras
31 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch& repo=extras&infra=$infra
32 #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
33 gpgcheck=1
34 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
35
36 #additional packages that extend functionality of existing packages
37 [centosplus]
38 name=CentOS-$releasever - Plus
39 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch& repo=centosplus&infra=$infra
40 #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
41 gpgcheck=1
42 enabled=0
43 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
44
从上面可以看出:
[base]与[updates]是一样的格式,定义的相同的内容。
里面有:[base],[updates],[extras],[centosplus]这么几个软件池,默认是第一个软件池([base])生效。
结合上面的图片来查看这个配置。
常用的yum命令:
yum list
列出所有可用的软件包 。

yum列出的包:

分为:包名, 版本, 容器的名称
yum的库存:
$ cd /etc/yum.repos.d/
yum search 关键字来搜索服务器上的所有和关键字相关的包。

eg:yum -y install gcc

如果:yum -y update不跟包名,那么就是更新所有软件包,包括Linux内核都会升级。内核如果升级之后,那么需要在本地做一些配置才能,所以远程执行了这个命令,那么服务器就不能开机了,谨慎使用。

软件组管理:

光盘yum源搭建
也就是本地yum源搭建。
对服务器来说考虑的最主要的是稳定和安全,本地yum光盘可能不是最新的,这个无所谓。
做本地Yum源,需要做一定的配置。

让yum源失效的办法就是修改掉.repo的后缀。



改掉名字之后,本地yum源修改配置:

这样本地yum源就配置好了。
管道符号(
|)
Linux所提供的管道符“|”将两个命令隔开,管道符左边命令的输出就会作为管道符右边命令的输入。
grep "main" test.c
用来搜索test.c里是否包含字串 main
注意:在baseurl=file:///mnt/cdrom
后面不能加任何空格或者tab,也不能写注释这些,严格的要求。