環境:
centos 7.4
摘要說明:
本系列主要講述liunx基礎操作;
本篇文章主要基於centos7來講述liunx下常用服務如telnet等基礎服務安裝及使用;
步驟:
1.telnet(用於測試服務運行狀態)
許多liunx鏡像默認是不安裝的:
安裝和使用如下:
# yum install telnet-server
# yum install telnet
# telnet www.baidu.com 80
2.防火牆
防火牆有兩種,一種是iptables;一種是firewall;
centos6默認是iptables;centos7默認是firewall;但阿里雲最新的服務器默認不啓動防火牆而是使用虛擬的安全組來做防護;
iptables常用命令:
#service iptable status
#servcie iptables stop --臨時關閉防火牆
#chkconfig iptables off --永久關閉防火牆
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT --開放端口
#/etc/rc.d/init.d/iptables save --保存修改
CentOS 7默認使用的是firewall作爲防火牆,使用iptables必須重新設置一下
1、直接關閉防火牆
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啓動
2、設置 iptables service
yum -y install iptables-services
如果要修改防火牆配置,如增加防火牆端口3306
vi /etc/sysconfig/iptables
增加規則
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
保存退出後
systemctl restart iptables.service #重啓防火牆使配置生效
systemctl enable iptables.service #設置防火牆開機啓動
最後重啓系統使設置生效即可。
systemctl start iptables.service #打開防火牆
systemctl stop iptables.service #關閉防火牆
firewall常用命令:
#firewall-cmd --state #查看狀態
#firewall-cmd --zone=public --add-port=80/tcp --permanent #設置端口
#firewall-cmd --reload #重啓firewall
#systemctl stop firewalld.service #停止firewall
#systemctl disable firewalld.service #禁止firewall開機啓動
#firewall-cmd --state #查看默認防火牆狀態(關閉後顯示notrunning,開啓後顯示running)
3.sftp/ssh服務
這兩個服務分別基於兩個不同的協議產生的,默認22端口是同時滿足兩個服務的,詳情見https://blog.csdn.net/u010904188/article/details/81508622
4.nfs服務
NFS(Network File System)即網絡文件系統,是FreeBSD支持的文件系統中的一種,它允許網絡中的計算機之間通過TCP/IP網絡共享資源。在NFS的應用中,本地NFS的客戶端應用可以透明地讀寫位於遠端NFS服務器上的文件,就像訪問本地文件一樣
但服務器集羣時往往會使用,詳情見:https://blog.csdn.net/u010904188/article/details/80936015