安裝 VMware 17.5.1 + centos 7.9
?
1、下載資源包(虛擬機+鏡像)
- VMware-17.5.1 安裝包+秘鑰.zip
- Linux Centos 7.9 鏡像
2、centos 7.9 下載地址
1、Centos 官網
2、阿里巴巴鏡像站
3、查看網絡命令 ifconfig
或 ip addr
4、登陸服務器
ssh stark@192.168.31.131
初始化后的坑
sudo命令的坑
[stark@192 ~]$ sudo yum update -y
[sudo] password for stark:
stark is not in the sudoers file. This incident will be reported.
會有錯誤信息stark is not in the sudoers file. This incident will be reported.
,解決步驟:
1、切換到 root 用戶 輸入 之前的初始化密碼用戶的密碼之后就能登錄。
su -
2、把用戶添加到 wheel 組
CentOS 系統中,wheel 組的用戶默認擁有 sudo 權限。你可以使用以下命令將用戶stark
添加到 wheel 組:
usermod -aG wheel stark
3、確認 wheel 組是否有 sudo 權限
要保證/etc/sudoers
文件里有如下配置行(如果被注釋掉了,就取消注釋):
%wheel ALL=(ALL) ALL
4、以現有 sudo 用戶身份添加用戶到 sudo 組
sudo usermod -aG wheel stark
yum源的坑
1、臨時修改DNS服務器
編輯/etc/resolv.conf
文件,添加公共 DNS 服務器:
echo -e "nameserver 8.8.8.8\nnameserver 114.114.114.114" > /etc/resolv.conf
2、替換 CentOS 官方鏡像源為阿里云鏡像源
# 備份原鏡像源配置
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 https://mirrors.aliyun.com/repo/Centos-7.repo# 清理并生成緩存
yum clean all
yum makecache
3、處理 CentOS 7 EOL 后的鏡像源問題
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*
sed -i 's|^#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
4、額外建議
如果仍然遇到問題,可以嘗試禁用fastestmirror
插件:
sed -i 's/enabled=1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf
VMware Tools 設置時間
設置宿主機與虛擬機時間不一致的問題:
1、設置: 虛擬機 -> 設置 -> 選項
2、在虛擬機中安裝 VMware Tools
#下載
sudo yum install open-vm-tools open-vm-tools-desktop
#啟動
sudo systemctl enable --now vmtoolsd
#驗證
systemctl status vmtoolsd
#更新時間
sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime