简易最小化虚拟机安装配置(CentOS-7-Minimal)

article/2025/9/21 10:49:36

文章目录

  • 镜像选择
  • 虚拟机安装(VMware Workstation)
    • 虚拟网络配置(NAT模式)
    • 虚拟网卡配置
  • 虚拟机配置
    • 静态IP配置及测试
    • 系统初始化及库安装
      • 停止防火墙 & 关闭防火墙自启动
      • 关闭 selinux 防火墙
      • 更换镜像源并重建镜像源缓存
      • 安装 ifconfig & Vim & Wget
      • 修改hostname
      • 更新yum软件包

镜像选择

选用CentOS-7-x86_64-Minimal-1810.iso最小化安装(此版本无GUI页面,仅命令行模式)
参考镜像源地址:http://mirrors.aliyun.com/centos/7/isos/x86_64/

虚拟机安装(VMware Workstation)

使用VMware Workstation 进行虚拟机创建安装,按照镜像指引进行系统安装(此部分略过,虚拟机配置可以再安装后进行调整配置)
使用192.168.2.0网段进行配置,设置好网关地址、网卡地址及子网掩码

虚拟网络配置(NAT模式)

在这里插入图片描述

虚拟网卡配置

在这里插入图片描述

虚拟机配置

静态IP配置及测试

进入系统目录:/etc/sysconfig/network-scripts/,修改如下参数并保存

  • BOOTPROTO=static
  • ONBOOT=yes
  • IPADDR=192.168.2.98复制虚拟机后,仅修改此IP即可
  • NETMASK=255.255.255.0
  • GATEWAY=192.168.2.2
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vi ifcfg-ens33 
[root@localhost network-scripts]# cat ifcfg-ens33 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=a1d937b7-1aa9-46eb-b0c0-0ce44311503a
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.2.98
NETMASK=255.255.255.0
GATEWAY=192.168.2.2

重启网络服务,查看ip addr

[root@localhost network-scripts]# service network restart
Restarting network (via systemctl):                        [  确定  ]
[root@localhost network-scripts]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:e2:a1:36 brd ff:ff:ff:ff:ff:ffinet 192.168.2.98/24 brd 192.168.2.255 scope global noprefixroute ens33valid_lft forever preferred_lft foreverinet6 fe80::f2bd:bd9d:9838:c35f/64 scope link noprefixroute valid_lft forever preferred_lft forever

配置DNS(/etc/resolv.conf)并测试(外网连通性),至此可以使用SSH终端工具进行连接

[root@localhost network-scripts]# vi /etc/resolv.conf
[root@localhost network-scripts]# cat /etc/resolv.conf
nameserver 114.114.114.114
nameserver 8.8.8.8
nameserver 8.8.4.4 
[root@localhost network-scripts]# ping www.baidu.com
PING www.a.shifen.com (220.181.38.149) 56(84) bytes of data.
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=1 ttl=128 time=19.8 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=2 ttl=128 time=13.7 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=3 ttl=128 time=17.5 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=4 ttl=128 time=15.8 ms
64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=5 ttl=128 time=14.5 ms

系统初始化及库安装

停止防火墙 & 关闭防火墙自启动

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

关闭 selinux 防火墙

  • 注释:SELINUX=enforcing
  • 注释:SELINUXTYPE=targeted
  • 添加:SELINUX=disabled
[root@localhost ~]# vi /etc/selinux/config 
[root@localhost ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
#SELINUXTYPE=targeted 
SELINUX=disabled
[root@localhost ~]# setenforce 0
[root@localhost ~]# reboot

更换镜像源并重建镜像源缓存

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2022-06-08 15:39:58--  http://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 42.101.0.238, 42.101.0.242, 42.101.0.241, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|42.101.0.238|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”100%[===============================================================================================>] 2,523       --.-K/s 用时 0.02s   2022-06-08 15:39:58 (157 KB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])[root@localhost yum.repos.d]# ls -ll
总用量 36
-rw-r--r--  1 root root 2523 12月 26 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1664 11月 23 2018 CentOS-Base.repo.bak
-rw-r--r--. 1 root root 1309 11月 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root  649 11月 23 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 11月 23 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 11月 23 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 11月 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 11月 23 2018 CentOS-Vault.repo
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; 没有到主机的路由"
正在尝试其它镜像。
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; 未知的错误"
正在尝试其它镜像。
base                                                                                                              | 3.6 kB  00:00:00     
extras                                                                                                            | 2.9 kB  00:00:00     
updates                                                                                                           | 2.9 kB  00:00:00     
(1/6): extras/7/x86_64/filelists_db                                                                               | 277 kB  00:00:01     
(2/6): updates/7/x86_64/other_db                                                                                  | 1.0 MB  00:00:04     
(3/6): extras/7/x86_64/other_db                                                                                   | 148 kB  00:00:06     
(4/6): base/7/x86_64/other_db                                                                                     | 2.6 MB  00:00:17     
(5/6): base/7/x86_64/filelists_db                                                                                 | 7.2 MB  00:00:29     
(6/6): updates/7/x86_64/filelists_db                                                                              | 8.7 MB  00:00:32     
元数据缓存已建立

安装 ifconfig & Vim & Wget

[root@localhost yum.repos.d]# yum install -y wget
[root@localhost yum.repos.d]# yum install -y vim-enhanced
[root@localhost yum.repos.d]# yum install -y iptables-services
[root@localhost sysconfig]# cat /etc/sysconfig/iptables
# sample configuration for iptables service
# you can edit this manually or use system-config-firewall
# please do not ask us to add additional ports/services to this default configuration
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

修改hostname

[root@localhost ~]# hostnamectl set-hostname evm

更新yum软件包

[root@localhost ~]# yum update

http://chatgpt.dhexx.cn/article/C3eIAuNQ.shtml

相关文章

pr双击打开图标没反应,下载ZXPSignLib-minimal.dll替换

微智启今天安装了pr cc2018&#xff0c;双击打开图标无反应 于是又试了Premiere cc2019&#xff0c;还是没反应 桌面还多出一些白色文件图标.crash结尾的 解决方案&#xff1a; 下载ZXPSignLib-minimal.dll文件&#xff0c;微智启软件工作室放到pr安装目录的根目录&#xff…

Minimal Square

文章目录 一、A. Minimal Square总结 一、A. Minimal Square 本题链接&#xff1a;A. Minimal Square 题目&#xff1a; A. Minimal Square time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Find the minimu…

出现minimal bash-like...的问题如何解决?

2021.9.4写下此文&#xff0c;以备查阅。 问题如图&#xff1a; 一般出现这个界面即为引导程序出现问题&#xff0c;根据下面两种情况看待&#xff1a; 卸载双系统之一&#xff08;比如之前是windeepin双系统&#xff0c;现在卸载了deepin系统&#xff09;重启时出现。安装新…

Centos教程,DVD、Everything、Minimal、NetInstall区别

今天给大家讲述一下在官网下载Linux中Centos7的时候遇到的版本问题。首先给大家简述一下Centos下载流程。 1.百度搜索Centos&#xff0c;点击官网。 2.点击Download&#xff0c;选择Centos7&#xff08;举例&#xff09;。 3.然后这里我们选择aliyun下载。 4.选择第一个镜像版本…

【已解决】grub引导项修复:Minimal BASH-like line editing is supported.

目录 1 问题背景2 问题探索3 问题解决4 告别Bug 1 问题背景 环境&#xff1a; Win10Ubuntu20.04 现象&#xff1a;双系统电脑向移动硬盘安装Ubuntu系统后&#xff0c;重启黑屏并显示Minimal BASH-like line editing is supported. For the first word, TAB lists possible comm…

Centos7 Minimal 版本基本配置记录

每次搭测试环境之前都需要先装一台干净的虚拟机&#xff0c;然而 Centos7 Minimal 版本快速装完之后还需要配置&#xff1a;网络、国内源、一些基础工具&#xff08;net-tools、vim&#xff09;等才能远程连接和使用。记录一下&#xff0c;方便下次快速配置使用。 目录 1、网…

详解Minimal Web API的使用

一、简介 “Minimal API 是为了创建具有最小依赖关系的 HTTP API”&#xff0c;这是官方的解释。什么意思呢&#xff0c;创建一个 API 并不需要加载许多的依赖。平时在开发 ASP.NET Core Web API 时&#xff0c;通常需要创建 Controller 来定义我们的 API 这种方式&#xff0c…

实例分割------Yolact-minimal结构详解

yolact结构图 网络backbone可以采用resnet101,resnet50甚至vgg16等。然后有3个分支,1个分支输出目标位置,1个分支输出mask系数,1个分类的置信率,所以决定目标的有4(位置)+k(mask系数)+c(分类置信率)个参数。 检测的大致步骤为: 1.从backbone中取出C3,C4,C5; 2.通…

VMware16安装CentOS 7.9操作系统(Minimal版)

记录&#xff1a;299 场景&#xff1a;使用VMware16安装CentOS 7.9操作系统。 基础环境&#xff1a; 虚拟机&#xff1a;VMware16 操作系统&#xff1a;CentOS 7.9 镜像包&#xff1a;CentOS-7-x86_64-DVD-2009.iso 镜像下载地址&#xff1a; 阿里地址&#xff1a;https…

ISO文件boot、dvd、minimal的区别

在centos的下载中&#xff0c;有分为boot、dvd、minimal的iso文件&#xff0c;那么他们之间有什么区别呢&#xff1f; boot.iso 这个版本大小不会超过1G ,只有最基本的启动引导等内容&#xff0c;各类包均需从线上下载&#xff0c;需要快速安装且有可靠网络的前提下&#xff0c…

【minimal problem】资料整理

minimal problem use as few data as to generate a system of algebraic equaIons with a finite number of soluIons 使用尽可能少的数据来生成代数系统 解数有限的方程 以往工作 基于神经网络解一元高次方程 代码实战&#xff1a;解低次方程 代码实战&#xff1a;解高次方…

自我总结:Centos7-Minimal安装后应该干什么

首先我是只小菜鸟&#xff0c;还不是很熟练&#xff0c;我也是弄了N次之后才开始慢慢总结这么一点经验 刚安装完成 ifconfig 和yum命令是不能用的&#xff0c;需要修改配置文件 我是直接将其设置为静态IP 首先点“编辑”-“虚拟机网络编辑器”-“VMnet8”,把下面的东西取消…

手把手教你centos minimal如何安装图形界面!

网上对于centos minimal安装图形界面的介绍五花八门&#xff0c;每个人遇到的情况都不一样&#xff0c;不能一味跟着别人的介绍来往下走&#xff0c;不过多看几篇博文视频&#xff0c;多踩踩坑涨涨经验才知道到底哪种解决方案才是最适用于自己的情况的&#xff0c;也是好事一桩…

安装CentOS7 Minimal后,如何安装可视化图形界面?

安装CentOS7 Minimal后&#xff0c;如何安装可视化图形界面&#xff1f; 附&#xff1a;Centos7各版本的阿里云镜像下载地址&#xff1a;http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/ 建议下载everything版本&#xff0c;安装时功能选择项较为全面&#xff0c;本文…

二手笔记本中常见三叉插头以及英标欧标和美标的区别!

本文转载至&#xff1a;http://www.litaow.com/yingjian/2013/0616/1042.html 一些原装笔记本电脑中带的插头看起来都有点不一样&#xff0c;就如图中同一款的T420机型在不同的国家地区发售出现的插头不同&#xff0c;主要的原因还是国家和地区的不一样使用的这种插头标准是有区…

计算机改显存会有啥影响,显卡显存越大越好吗?显存对电脑速度的影响有哪些?...

对于刚接触DIY领域的小白玩家来说,衡量显卡性能的指标就是GPU芯片和其频率,这也确实是显卡性能的决定性因素。但除了GPU,还有一个对显卡性能影响较大的部分,那就是显存。 显卡显存越大越好吗?显存对电脑速度的影响 显存有很多指标:类型、容量、带宽、位宽、速率等,这些指…

联想小新Pro 13新款笔记本电脑获TUV莱茵低蓝光认证

9月23日晚&#xff0c;联想集团在北京全球总部举行新款笔记本电脑小新Pro 13发布会&#xff0c;这也是联想全球首款通过权威第三方机构德国莱茵TUV&#xff08;以下简称“TUV莱茵”&#xff09;低蓝光认证的笔记本电脑&#xff0c;在低蓝光模式下&#xff0c;有害蓝光的比例会下…

LCD养生之道 液晶显示器清洁保养技巧

液晶清洁保养技巧--前言 在液晶显示器已经全面取代CRT成为主流显示器的今天&#xff0c;很多新老用户在显示器升级换代之时无疑都会选择LCD显示器&#xff0c;拥有LCD显示器的朋友也越来越多了&#xff0c;可以说现在是个液晶时代。 LCD显示器的确要比CRT显示器具有很多优势&am…

为啥程序员下班后只关显示器从不关电脑?

你下班时是不是只将显示器一关&#xff0c;揣上手机就走了&#xff1f; 曾有安保人员晚上来办公室巡查时问&#xff0c;为什么这些人不关机就下班呢&#xff1f; 作为程序员&#xff0c;你会心一笑。对方不明白如果关机了&#xff0c;第二天程序员上班可能会崩溃&#xff1a…

对计算机影响最大的是温度对吗,电脑温度太高对零件有什么危害

电脑温度太高对零件有什么危害 电脑温度太高对零件有什么危害 高温对电脑的危害主要可以分为以下两个部分: 1、对半导体电子元器件(CPU、显卡芯片、主板芯片组等)的危害(本次重点) 2、对显像管的危害 我们先来看看高温对电脑最主要的危害,也就是对半导体电子元件的危害。 根据…