环境:
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