Linux(CentOS 6)网络及yum源配置

/etc/sysconfig/network 文件中保存了是否连接互联网,和主机名

配置网络

打开/etc/sysconfig/network-scripts/ifcfg-eth0 将文件修改为如下,IP地址跟VMware的vmnet8在一个网段

输入service network restart若出现3个OK,则表示网通了

打开/etc/hosts文件,修改为如下:

由于2020年底各大厂的centOS 6版本的yum源已经不能用了,可以将/etc/yum.repos.d/CentOS-Base.repo文件修改为如下:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

输入命令:

# yum clean all

# yum makecache 

使用yum安装ntp和vim

使用chkconfig可以查看安装软件的打开状态

输入命令service ntpd start 打开ntp,用于时间同步

输入chkconfig ntpd on 在系统重启后ntpd依旧会启动

输入chkconfig iptables off 将防火墙关闭

输入getenforce查看selinux(增强Linux的安全子系统)的状态,需要将selinux关闭,进入/etc/selinux/config将文件修改为:

进入/etc/ssh/sshd_config,定位UserDNS将yes改为no,如下图:

输入命令

rm -rf /etc/udev/rules.d/70-persistent-net.rules 

删除之后拍摄快照

克隆虚拟机,根据之前拍摄的快照进行克隆:

点击克隆,一直点击下一步,最后更改一下路径和虚拟机名字就克隆成功了

打开node1,vim /etc/sysconfig/network将里面的node0改成node1

打开文件/etc/sysconfig/network-scripts/ifcfg-eth0将IP地址从60改成61

若ifconfig时出现eth0不在的情况,则需要将​/etc/udev/rules.d/70-persistent-net.rules文件删除,在重启即可

相同步骤拷贝node2,node3

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值