虚拟机7.5的使用
虚拟机的安装参考视频
配置ip地址和xshell的连接
-
cd /etc/sysconfig/network-scripts
-
vi ifcfg-ens33
-
将onboot的属性从no改为yes
ONBOOT=yes
-
重启机器
shutdown -r now
-
重启之后
ip address
查看端口号 -
将端口填写如 xshell中的即可使用
修改主机名
临时修改主机名 hostname xx(新的主机名)
查看主机名成 hostname
真实修改
第一种方法:
vi /etc/hostname
修改localhost.localdomain localdomain的内容即可
第二种方法:
hostnamectl set-hostname (cent7.5.x修改的名称)
修改yum源地址为阿里云镜像
- 打开centos的yum文件夹
cd /etc/yum.repos.d/
- 安装wget
yum install wget
- 备份原来的repo文件防止出现错误,先创建一个back文件夹,然后
mv *.repo ./back
- 安装镜像
wget http://mirrors.aliyun.com/repo/Centos-7.repo
- 改名
mv Centos-7.repo Centos-Base.repo
- 依次执行下列三个命令 (第三个命令需要下载大量文件)
yum clean all
yum makecache
yum update
防火墙
一、 查看防火请状态
systemctl status firewalld
二、启动防火墙
systemctl start firewalld
三、关闭防火墙
systemctl stop firewalld
四、开机禁用
systemctl disable firewalld
五、开机启动
systemctl enable firewalld
六、开机时启用一个服务
systemctl enable firewalld.service
七、开机时禁用一个服务
systemctl disable firewalld.service
八、查看服务是否开机启动
systemctl is-enabled firewalld.service
九、查看一起动的服务列表
systemctl list-unit-files|grep enabled
十、查看启动失败的服务列表
systemctl --failed
查看版本
firewall-cmd --version
查看帮助
firewall-cmd --help
显示状态
firewall-cmd --state