VMware install Linux System Considerations
1. Turn off the firewall
[Reference link] https://www.cnblogs.com/moxiaoan/p/5683743.html
CentOS7 use firewalld turn off the firewall and open ports
The basic use of firewalld
启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 : systemctl enable firewalld
systemctl is CentOS7 service management tool in the main tool before it blends service and chkconfig functions in one
启动一个服务:systemctl start firewalld.service 关闭一个服务:systemctl stop firewalld.service 重启一个服务:systemctl restart firewalld.service 显示一个服务的状态:systemctl status firewalld.service 在开机时启用一个服务:systemctl enable firewalld.service 在开机时禁用一个服务:systemctl disable firewalld.service 查看服务是否开机启动:systemctl is-enabled firewalld.service 查看已启动的服务列表:systemctl list-unit-files|grep enabled 查看启动失败的服务列表:systemctl --failed
Configuring firewalld-cmd
查看版本: firewall-cmd --version 查看帮助: firewall-cmd --help 显示状态: firewall-cmd --state 查看所有打开的端口: firewall-cmd --zone=public --list-ports 更新防火墙规则: firewall-cmd --reload 查看区域信息: firewall-cmd --get-active-zones 查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0 拒绝所有包:firewall-cmd --panic-on 取消拒绝状态: firewall-cmd --panic-off 查看是否拒绝: firewall-cmd --query-panic
Open a port
Add to
firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)
Reload
firewall-cmd --reload
View
firewall-cmd --zone= public --query-port=80/tcp
delete
firewall-cmd --zone= public --remove-port=80/tcp --permanent
2. Network virtual network and system configuration of Vmware
[Reference link] https://www.cnblogs.com/maowenqiang/articles/7727910.html
ping: www.baidu.com: Name or service not known # This error occurs because the network system is configured correctly with VMware
View Network Configuration
记住NAT设置中的子网IP、子网掩码、网关IP三项,接下来配置文件主要是这三项。
Editing in Linux network configuration files
vi /etc/sysconfig/network-scripts/ifcfg-ens33
# Note the network configuration file name may be different, when you enter into the ifcfg, continuous double-click the tab key, get tips, such as my machine is ifcfg-ens33Content replaced by the following:
TYPE=”Ethernet” BOOTPROTO=”static” #静态连接 NAME=”ens33” UUID=”1f093d71-07de-4ca5-a424-98e13b4e9532” DEVICE=”ens33” ONBOOT=”yes” #网络设备开机启动 IPADDR=”192.168.0.101” #192.168.59.x, x为3~255. NETMASK=”255.255.255.0” #子网掩码 GATEWAY=”192.168.66.2” #网关IP DNS1= 8.8.8.8 DNS2=8.8.8.4
View Network Configuration
Network Service Restart
service network restart
Test results
ping 192.168.66.2 ping 115.239.210.27 (百度的某个IP,直接ping www.baidu.com 会出现域名解析问题,在保证网络连通后可进行配置)
DNS configuration file
vi /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4
test
ok!
3. Configure the update source
Ali (Click on the far right to find the corresponding system help) or Qinghua source (click on the top of the system to find the corresponding question mark)
Tsinghua source
Configuring SSH
[Reference link] https://blog.csdn.net/wang704987562/article/details/72722263
centos7 install SSH
1. Install OpenSSH server (CentOS system installed by default openssh)
yum install openssh-server -y
2. Configure OpenSSH service (the default configuration is working properly)
OpenSSH main configuration file: / etc / ssh / sshd_config
Common configuration options:
Port=22 设置SSH的端口号是22(默认端口号为22)
Protocol 2 启用SSH版本2协议
ListenAddress 192.168.0.222 设置服务监听的地址
DenyUsers user1 user2 foo 拒绝访问的用户(用空格隔开)
AllowUsers root osmond vivek 允许访问的用户(用空格隔开)
PermitRootLogin no 禁止root用户登陆
PermitEmptyPasswords no 用户登陆需要密码认证
PasswordAuthentication yes 启用口令认证方式
---------------------
3. Restart the OpenSSH service
service sshd restart
4. The client via the remote connection server ssh
ssh username@hostname(hostIP)
Such as: ssh [email protected]