xhsell鏈接虛擬機
第一步:關掉防火牆:
[root@ken ~]# setenforce 0 #臨時關閉selinux
[root@ken ~]# systemctl stop firewalld #當即關掉firewalld
[root@ken ~]# systemctl disable firewalld #firewalld開機不自啓
永久關閉selinux
[root@ken ~]# vim /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=disabled #把enforcing改爲disabled
# SELINUXTYPE= can take one of three two values:
# targeted – Targeted processes are protected,
# minimum – Modification of targeted policy. Only selected processes are protected.
# mls – Multi Level Security protection.
SELINUXTYPE=targeted
第二步:查看虛擬機IP
[root@ken ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:e3:93:4b brd ff:ff:ff:ff:ff:ff
inet 192.168.64.4/24 brd 192.168.64.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
第三步:xshell鏈接
關掉httpd:
方法1、systemctl stop httpd
方法2、kill -9 pid
方法3、pkill 服務名
[root@ken ~]# pkill httpd
查看系統負載:
方法1、top
方法2、uptime
[root@ken ~]# uptime
11:41:56 up 1 day, 14:36, 1 user, load average: 0.01, 0.07, 0.08 #表示1分鐘,5分鐘,15分鐘的平均負載
系統負載越低越好
查看端口以及佔用的進程名:
第一步:使用ss -tnl查看全部端口
[root@ken ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 127.0.0.1:9000 *:*
LISTEN 0 50 *:3306 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:81 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::10050 :::*
LISTEN 0 128 :::10051 :::*
第二步:查看10050端口是被那個進程佔用的
[root@ken ~]# lsof -i :10050
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
zabbix_ag 13546 zabbix 4u IPv4 1494050 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13546 zabbix 5u IPv6 1494051 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13547 zabbix 4u IPv4 1494050 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13547 zabbix 5u IPv6 1494051 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13548 zabbix 4u IPv4 1494050 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13548 zabbix 5u IPv6 1494051 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13549 zabbix 4u IPv4 1494050 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13549 zabbix 5u IPv6 1494051 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13550 zabbix 4u IPv4 1494050 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13550 zabbix 5u IPv6 1494051 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13551 zabbix 4u IPv4 1494050 0t0 TCP *:zabbix-agent (LISTEN)
zabbix_ag 13551 zabbix 5u IPv6 1494051 0t0 TCP *:zabbix-agent (LISTEN)
命令學習:
ps aux / ps -ef
top
uptime
ss
lsof