端口
netstat -anp|grep 80 #查看端口占用(進(jìn)程)
netstat -anp|more #查看所有端口占用(進(jìn)程)
kill -s 9 472 #殺死進(jìn)程
服務(wù)
ps aux|grep sftp
Linux注冊服務(wù)(Service)
ps aux|grep sftp
卸載
rpm -q -a #所有的軟件包
rpm -e [package name] #卸載軟件包 如果因存在依賴關(guān)系而不能卸載,rpm將給予提示并停止卸載
rpm -e [package name] -nodeps #忽略依賴關(guān)系卸載
rpm -ql [package name] #查詢安裝包位置
把源碼包安裝的軟件骑祟,都指定安裝在 /opt目錄中剂买,這樣不就知道了;如果刪除丧诺,就刪除相應(yīng)的軟件目錄;有些軟件要在解壓安裝目錄中執(zhí)行 make uninstall 奄薇,這樣就卸載掉了驳阎。
iptables
service iptables status #查看防火墻狀態(tài)
service iptables start #開啟
service iptables stop #關(guān)閉
service iptables restart #重啟防火墻
vim /etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -s 171.41.16.104/32 -p tcp -m tcp --dport 6379 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
ifcfg-eth0
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0c:29:0c:1a:89 #物理地址
TYPE=Ethernet
UUID=15e42daf-8956-4f69-bca9-b02fb60ea137
BOOTPROTO=static
IPV6INIT=yes
PREFIX=10 #最大連接數(shù)
ONBOOT=yes #開機(jī)重啟
IPADDR=192.168.1.111 #局域網(wǎng)ip
NETMASK=255.255.255.0
GATEWAY=192.168.1.1 #網(wǎng)關(guān)
service network restart
VMWare克隆或復(fù)制虛擬機(jī)后找不到網(wǎng)卡,報(bào)錯(cuò)
vi /etc/udev/rules.d/70-persistent-net.rules
# 刪除eth0 將`NAME="eth0"`改為`NAME="eth1"`
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:29:b0:0
f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# 記錄`ATTR{address}=="00:0c:29:29:b0:0f"`
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# 將`HWADDR=00:0C:29:29:B0:0F #物理地址` 做更改
# 注意`IPADDR=192.168.1.113 #局域網(wǎng)ip`不要重復(fù)
# reboot 重啟
selinux
vim /etc/sysconfig/selinux
#enforcing模式
rc.local
vim /etc/rc.d/rc.local
/usr/local/tomcat/bin/startup.sh #tomcat開機(jī)自動(dòng)啟動(dòng)
sshd_config
vim /etc/ssh/sshd_config
passwordAuthentication yes