UTM在M1版本的Mac Pro 中安装CentOS7

9 min read

getutm下载地址

https://mac.getutm.app/

CentOS下载地址

http://mirror.math.princeton.edu/pub/centos-altarch/7/isos/aarch64/CentOS-7-aarch64-Minimal-2009.iso

创建虚拟机

默认参数下,给的系统配置是QEMU 6.2 ARM Virtual Machine (virt-6.2),这个并不能正常使用,需要选择:QEMU 5.2 ARM Virtual Machine (virt-5.2)

默认是共享网络,保持默认即可,系统安装之后,手动配置IP

手动分配IP

nmtui

安装后配置

# 备份已有配置
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

# 下载阿里配置
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-altarch-7.repo 

# 关闭密钥检查
vi /etc/yum.repos.d/CentOS-Base.repo
gpgcheck=0
enabled=0

# makecache
yum clean all && yum makecache

# 关闭 selinux
setenforce 0
getenforce  #查看


# 修改DNS
sed -i '7s/enforcing/disabled/g' /etc/selinux/config
 /etc/resolv.con
nameserver 202.101.172.35


#修改主机名

hostnamectl set-hostname node1
exec bash

#停止firewall
systemctl stop firewalld.service	 
systemctl disable firewalld.service 	#禁止firewall开机启动


# 修改 ssh 配置
vim /etc/ssh/sshd_config
Port 32223			#修改ssh登陆端口
PermitRootLogin no	#禁止root远程ssh登陆,根据实际需求进行配置

# 修改时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 timedatectl set-timezone Asia/Shanghai

# 配置时间同步
yum -y install ntp   &&   ntpdate -u cn.pool.ntp.org


# 加一条命令提示符颜色显示的变量 在 .bashrc最下边添加
 
PS1="\[\e[37;40m\][\[\e[36;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\$"

# 常用软件
yum -y install lrzsz vim net-tools gunzip wget curl unzip