目录
一、创建虚拟机
记录几个关键选择,其他按需求选择,或者按默认推荐选择
选择系统映像
选择NAT模式网络
配置虚拟网络
二、安装CentOS8.5映像
开机
选择语言,Boot版本对中文的支持不是很好,建议直接选择English(US)的,这里选择中文以进行对照演示
1.安装位置
2.网络配置(VM虚拟网络配置对应)
3.设置安装源
4.软件选择
直接选择最小安装
5.设置根密码(密码如果过于简单,需要点击两次完成确认)
三、配置yum源
1.去配置文件夹,备份原repos文件夹
cd /etc
mv yum.repos.d/ yum.repos.d.bak
touch yum.repos.d
cd yum.repos.d
2.下载阿里云CentOS-Base.repo文件
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
非阿里云用户修改:
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
3.清除缓存,建立新缓存
yum -y clean all
yum -y makecache
yum repolist # 查看yum仓库信息
4.安装必要软件进行测试
yum -y installwget
yum -y installvim
yum info vim# 查看软件的版本等信息
5.阿里云CentOS-Base.repo文件内容(如有需要可以根据其内容自行发挥)
# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# 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-8.5.2111 - Base - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/BaseOS/$basearch/os/
gpgcheck=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that may be useful[extras]name=CentOS-8.5.2111 - Extras - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/extras/$basearch/os/
gpgcheck=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
#additional packages that extend functionality of existing packages[centosplus]name=CentOS-8.5.2111 - Plus - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/centosplus/$basearch/os/
gpgcheck=0enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[PowerTools]name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/PowerTools/$basearch/os/
gpgcheck=0enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
[AppStream]name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
baseurl=http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/$basearch/os/
gpgcheck=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
四、网卡配置文件位置
/etc/sysconfig/network-scripts/ifcfg-ens33
重启虚拟机,重启网卡
五、远程连接配置
防火墙配置
firewall-cmd --state # 查看防火墙状态
或
systemctl status firewalld # 查看防火墙详细状态
systemctl stop firewalld # 关闭防火墙(启动start,重启restart)
firewall-cmd --reload # 刷新防火墙
firewall-cmd --query-port=3306/tcp # 查看3306端口是否开放
firewall-cmd --zone=public --add-port=3306/tcp --permanent # 开放3306端口,刷新或重启防火墙生效
firewall-cmd --zone=public --add-port=xxxx-xxxx/tcp --permanent # 开放一段端口,刷新或重启防火墙生效
firewall-cmd --zone=public --remove-port=3306/tcp --permanent # 关闭3306端口,刷新或重启防火墙生效
firewall-cmd --zone=public --remove-port=xxxx-xxxx/tcp --permanent # 关闭一段端口,刷新或重启防火墙生效
firewall-cmd --zone=public --list-ports # 查看开放端口列表netstat -lnpt # 查看监听的端口netstat -lnpt |grep3306# 查看3306端口被哪一个进程占用
六、服务配置
systemctl enableservice# 设置服务自启动
systemctl disable service# 禁止服务自启动
七、权限管理
# 递归修改文件权限chmod -R 777 dir/
本文转载自: https://blog.csdn.net/weixin_43789456/article/details/131571588
版权归原作者 林木无可栖 所有, 如有侵权,请联系我们删除。
版权归原作者 林木无可栖 所有, 如有侵权,请联系我们删除。