VMware 设置

  • NAT 模式
  • 最小化安装(这会很多软件需要手动安装)
  • 静态 IP 地址配置
  • 主机名 hostname 配置

静态 IP 地址和主机名 hostname 可以在安装过程中直接通过图形化界面进行配置。

假如 IPv4 地址为 192.168.248.101,那么网关为 192.168.248.2,子网掩码为 255.255.255.0,DNS 服务器为 223.5.5.5223.6.6.6

CentOS 设置

修改成静态 ip

命令

# 修改文件内容
vim /etc/sysconfig/network-scripts/ifcfg-ens32

# 刷新网络设置
systemctl restart network

# 查看网络设置
ip address

文件内容

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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="ens32"
UUID="5bce0633-e13e-4d3a-a835-93e049c4aa55"
DEVICE="ens32"
ONBOOT="yes"
PREFIX="24"
IPV6_PRIVACY="no"
DNS1="223.5.5.5"
DNS2="223.6.6.6"
# 唯二可能需要修改的地方
IPADDR="192.168.248.101"
GATEWAY="192.168.248.2"

更换成 alibaba 的 yum 源

命令

# 最小化安装没有vim, 只能使用vi命令
vi /etc/yum.repos.d/CentOS-Base.repo

# 安装额外的软件仓库epel-release, 大多数rpm包在官方的仓库中找不到
yum install -y epel-release

# 安装网络工具包
yum install -y net-tools

# 修改完成后安装vim
yum install -y vim

文件内容

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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

修改主机名

命令

# 修改主机名
vim /etc/hostname

文件内容

hostname 文件

hadoop001

修改主机名映射(自定义域名)

命令

vim /etc/hosts

文件内容

hosts 文件

192.168.248.101 hadoop001
192.168.248.102 hadoop002
192.168.248.103 hadoop003

关闭防火墙

命令

# 关闭防火墙
systemctl stop firewalld

# 关闭防火墙开机自启动
systemctl disable firewalld.service

# 查看防火墙状态, 确保关闭
systemctl status firewalld

   转载规则


《》 熊水斌 采用 知识共享署名 4.0 国际许可协议 进行许可。
 上一篇
架构演变垂直应用架构MVC分布式服务架构RPC 页面与业务的分离(页面经常发生改变, 设计模式的体现) 页面所在的服务器和业务所在的服务器可能不在同一台服务器上, 此时需要在服务与服务之间的调用. 不同服务器之间的调用成为远程过程调用RPC
2022-11-11
下一篇 
SpringCloud项目中使用到的SQL表payment表CREATE TABLE `payment` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
2022-11-11
  目录