(二)配置IP地址、本地yum源

2019-01-28  本文已影响0人  Feyya

(一)设置IP地址:

1.查看当前ip:

# ifconfig

2.配置ip地址:

# cd/etc/sysconfig/network-scripts/

# vi ifcfg-eth0

(ifcfg-eth0文件内容:

Device -- 当前网卡设备名称

hwaddr -- 子网掩码

type = ethernet --网络类型(以太网)

uuid = --当前系统地址的唯一编号

onboot = no/yes --启动虚拟机时网卡是否需要被启动

hM-controled -- 当前此张网卡是否需要被network程序管理

bootproto --网卡是如何捕获Ip地址的(启动的前提条件:onboot=yes)

=dhcp(自动获取IP地址)

=static(设置为固定IP地址)

(修改:onboot=yes)

3.重启网络服务:

# service network restart 或

# /etc/init.d/network restart

4.查看修改后IP:

# ifconfig eth0

(二)配置本地yum源:

  前提条件:

1.查看mnt文件夹是否为空:

# ls cd/mnt/dev/mnt

2.实现挂载(把/cdrom下的文件挂载到/mnt下)

# mount  /dev/cdrom  /mnt

3.创建自己的本地yum源配置文件:test.repo

  查看yum源配置路径下的文件:

# cd/etc/yum.repo.d/

(rhel-source.repo  test.repo)

  复制原文件到test.repo文件:

# cp rhel-source.repo test.repo

  给原文件重命名:

# mv rhel-source.repo rhel-source.repo.bak(bak为备份文件后缀)

  编辑test.repo文件:

# vi test.repo

  修改:

baseurl=file:///mnt

enabled=1

gpgcheck=0

  查看修改后文件:

# cat test.repo

4.清除yum源缓存:

# yum cleanall

5.检验是否挂载成功(3737-成功)

# yum list | wc-l

6.用yum源安装包

# yum install -y 需要安装的包名称

7.查看某个服务在当前文件系统的位置

# which 包名称

上一篇 下一篇

猜你喜欢

热点阅读