安装虚拟机笔记

安装虚拟机

准备工作

先安装 VMware

下载好 Linux 镜像,这边使用的 CentOS 7


配置 Linux 环境

首先尝试 ping 百度能不能 ping 通

ping www.baidu.com

发现返回指令

ping www.baidu.com: Name or services not known

查看 ip 地址

ip addr

先在 VMware 中找到分配的网卡

配置图

到系统配置目录配置网络

cd /etc/sysconfig/network-scripts/

一般默认第一个就是你电脑的网卡,我这边是 ifcfg-ens33

vi ifcfg-ens33

修改配置信息并保存退出

# 需要修改的配置
BOOTPROTO=static #将dhcp修改为静态IP地址
ONBOOT=yes

# 需要添加配置
# 设置IP地址
IPADDR0=192.168.175.100
# 设置子网掩码
PREFIXO0=24
# 设置网关
GATEWAY0=192.168.175.2
# 设置主DNS
DNS1=8.8.8.8
# 设置备DNS
DNS2=114.114.114.114

修改完配置后要重启网络系统

service network restart

然后测试是否已经可以连上网络

ping www.baidu.com

如果 ping 成功了就说明已经可以连上网络了

可以查看此时的 ip 地址

ip addr

ip地址

安装常用命令

安装vim命令

  • yum -y install vim*

安装telnet命令

  • yum -y install telnet-server
  • yum -y install telnet

防火墙常用命令

  • 启动 -> systemctl start firewalld
  • 关闭 -> systemctl stop firewalld
  • 查看状态 -> systemctl status firewalld
  • 开机禁用 -> systemctl disable firewalld
  • 开机启用 -> systemctl enable firewalld
  • 查看所有打开的端口 -> firewall-cmd --zone=public --list-ports
  • 打开一个端口
    • firewall-cmd --zone=public --add-port=80/tcp --permanent
    • firewall-cmd --reload
  • 关闭一个端口 -> firewall-cmd --zone= public --remove-port=80/tcp --permanent

设置时间同步

yum install -y ntp // 安装ntp服务
systemctl enable ntpd // 开机启动服务
systemctl start ntpd // 启动服务
timedatectl set-timezone Asia/Shanghai // 更改时区
timedatectl set-ntp yes // 启用ntp同步
ntpq -p // 同步时间
date -R // 查看时间
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值