1、安装使用Centos7时,可以使用最小化安装。

但是没有像是vim等工具,需要自己联网安装。

2、使用Nat模式让虚拟机和物理机联网

配置虚拟机网卡

  1. # /etc/sysconfig/network-scripts/ifcfg-ens32
  2. TYPE=Ethernet
  3. BOOTPROTO=static
  4. NAME=ens32
  5. UUID=7bd3f7b2-aacb-49e1-9b0f-ab5806fdb97f
  6. DEVICE=ens32
  7. ONBOOT=yes
  8. IPADDR=192.168.2.200
  9. NETMASK=255.255.255.0
  10. GATEWAY=192.168.2.2
  11. DNS1=192.168.2.2

VMware虚拟网络配置
image.png
image.png
需要配置下DNS,否则虚拟机联网很慢。
image.png

3、配置使用国内源

文件名称:Centos-7.repo

  1. # /etc/yum.repos.d
  2. # CentOS-Base.repo
  3. #
  4. # The mirror system uses the connecting IP address of the client and the
  5. # update status of each mirror to pick mirrors that are updated to and
  6. # geographically close to the client. You should use this for CentOS updates
  7. # unless you are manually picking other mirrors.
  8. #
  9. # If the mirrorlist= does not work for you, as a fall back you can try the
  10. # remarked out baseurl= line instead.
  11. #
  12. #
  13. [base]
  14. name=CentOS-$releasever - Base - mirrors.aliyun.com
  15. failovermethod=priority
  16. baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
  17. http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
  18. http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
  19. gpgcheck=1
  20. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  21. #released updates
  22. [updates]
  23. name=CentOS-$releasever - Updates - mirrors.aliyun.com
  24. failovermethod=priority
  25. baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
  26. http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
  27. http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
  28. gpgcheck=1
  29. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  30. #additional packages that may be useful
  31. [extras]
  32. name=CentOS-$releasever - Extras - mirrors.aliyun.com
  33. failovermethod=priority
  34. baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
  35. http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
  36. http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
  37. gpgcheck=1
  38. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  39. #additional packages that extend functionality of existing packages
  40. [centosplus]
  41. name=CentOS-$releasever - Plus - mirrors.aliyun.com
  42. failovermethod=priority
  43. baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
  44. http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
  45. http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
  46. gpgcheck=1
  47. enabled=0
  48. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  49. #contrib - packages by Centos Users
  50. [contrib]
  51. name=CentOS-$releasever - Contrib - mirrors.aliyun.com
  52. failovermethod=priority
  53. baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
  54. http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
  55. http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
  56. gpgcheck=1
  57. enabled=0
  58. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
  1. yum makecache

4、配置Windows Terminal远程连接终端

  1. "profiles":
  2. {
  3. "defaults":
  4. {
  5. // Put settings here that you want to apply to all profiles.
  6. },
  7. "list":
  8. [
  9. {
  10. // Make changes here to the powershell.exe profile.
  11. "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
  12. "name": "Windows PowerShell",
  13. "commandline": "powershell.exe",
  14. "hidden": false
  15. },
  16. {
  17. // Make changes here to the cmd.exe profile.
  18. "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
  19. "name": "命令提示符",
  20. "commandline": "cmd.exe",
  21. "hidden": false
  22. },
  23. {
  24. "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
  25. "hidden": false,
  26. "name": "Azure Cloud Shell",
  27. "source": "Windows.Terminal.Azure"
  28. },
  29. // 配置SSH远程连接。
  30. {
  31. "guid": "{7e7bf29d-dff9-490b-9d64-ee9f5574b47c}",
  32. "hidden": false,
  33. "name": "192.168.2.200—centos7",
  34. "commandline":"ssh root@192.168.2.200"
  35. }
  36. ]
  37. },

如果ssh连接速度慢,那么就修改/etc/ssh/sshd_config中115行UseDNS为no。