vmware虚拟机 linux 本地yum源,网卡配置ens33,防火墙selinux

发布时间 2023-12-21 11:16:50作者: dyysH

1、挂载镜像文件,CentOS-7-x86_64-DVD-1804.iso,并且要处于连接状态

#光盘挂载至/mnt
mount /dev/sr0 /mnt

#备份yum源文件
cd /etc/yum.repos.d/
mkdir -p ./bak
mv CentOS* ./bak

#编缉本地源
vim local.repo
[centos7]
name=CentOS7
baseurl=file:///mnt
enable=1
gpgcheck=0

 

关闭防火墙并设置开机不启动
firewall 服务开启与关闭
firewalld状态:# systemctl status firewalld.service
关闭 firewalld:# systemctl stop firewalld
开启firewalld:# systemctl start firewalld
开机自动关闭firewalld:# systemctl disable firewalld
开机自动启动firewalld:# systemctl enable firewalld
查看开机是否启动服务:# chkconfig --list|grepnetwork ##centos 6
临时关闭和永久关闭selinux
临时关闭selinux
# getenforce
Enforcing
# setenforce 0
setenforce: SELinux is disabled
永久关闭selinux
# vim /etc/selinux/config
改:SELINUX=enforcing
为:SELINUX=disabled
# reboot //重启系统生效

 

 

3、固定虚拟机的网卡
在linux操作系统终端执行如下命令:
#进入网卡所在目录
[root@localhost~]#cd/etc/sysconfig/network-scripts/
#安装vim编缉器
[root@localhostnetwork-scripts]#yuminstallvim-y(需要虚拟机可以上外网)
#编缉网卡,固定ip地址
[root@localhostnetwork-scripts]#vimifcfg-ens33(修改网卡内容如下)
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"
IPADDR=192.168.100.200
NETMASK=255.255.255.0
GATEWAY=192.168.100.2
DNS1=114.114.114.114
#使用systemctl管理工具重启网卡
[root@localhostnetwork-scripts]#systemctl restart network
执行ipa,查看linuxip地址

 

 在xshell软件里输入 reconnect是再连接