AI智能
改变未来

Centos 7克隆镜像,基本命令记录


基本设置

修改配置文件

修改配置文件 /etc/sysconfig/network-scripts/ifcfg-ens33 中的IPADDR

修改主机名

hostnamectl set-hostname   xxxx(主机名)

修改hosts文件,将名字和IP建立联系
输入命令“vim /etc/hosts”后,在配置文件中加入

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6xxx.xxx.xxx.xxx(你所修改的主机IP)   xxxxxxxx(你要的主机名字)

重启:reboot

开启SSH服务

首先,要确保 CentOS 7 安装了 openssh-server,在终端中输入 yum list installed | grep openssh-server
此处显示已经安装了 openssh-server
如果没任何输出显示表示没有安装 openssh-server
通过输入 yum install openssh-server来进行安装 openssh-server

openssh-server.x86_64                   7.4p1-16.el7                   @anaconda

修改 sshd_config 配置文件

[root@all ~]# vim /etc/ssh/sshd_config# 将文件中,关于监听端口、监听地址前的 # 号去除Port 22#AddressFamily anyListenAddress 0.0.0.0ListenAddress ::# 开启允许远程登录PermitRootLogin yes# 开启使用用户名密码来作为连接验证PasswordAuthentication yes
# 开启  sshd  服务sudo service sshd start# 检查  sshd  服务是否已经开启ps -e | grep sshd# 检查  22 号端口是否开启监听netstat -an | grep 22

基本命令

# 查看当前所在目录pwd# 查看磁盘大小df -h# 取消查询文件高光nohl# 关闭防火墙systemctl stop firewalld.service 			#停止firewallsystemctl disable firewalld.service 		#禁止firewall开机启动systemctl status firewalld.service 			#查看firewall的状态# 临时关闭防火墙systemctl stop firewalld# 禁止开机启动systemctl disable firewalld
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » Centos 7克隆镜像,基本命令记录