liunx问题集

关闭防火墙 (不关闭则远程访问会被拒绝)

因为CentOS7版本后防火墙默认使用firewalld,因此在CentOS7中关闭防火墙使用以下命令

systemctl disable firewalld   # 禁止开机启动

查看防火墙状态: systemctl status firewalld.service

执行关闭命令: systemctl stop firewalld.service

执行开机禁用防火墙自启命令  : systemctl disable firewalld.service

启动:systemctl start firewalld.service

防火墙随系统开启启动  : systemctl enable firewalld.service

 

如果安装了iptables-service,也可以使用下面的命令

yum install -y iptables-services   # 安装iptables

service iptables stop  # 关闭防火墙

service iptables status  # 查看防火墙状态

 

1、firewalld的基本使用
启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld 
开机禁用  : systemctl disable firewalld
开机启用  : systemctl enable firewalld
 
 
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务: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

3.配置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
 
那怎么开启一个端口呢
添加
firewall-cmd  --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone= public --query-port=80/tcp
删除
firewall-cmd  --zone= public --remove-port=80/tcp --permanent

 

用yum 安装salt-master出现未找到软件 # No package salt-master available

首先安装epel

#wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

#rpm -ivh epel-release-latest-7.noarch.rpm

#yum repolist      ##检查是否已添加至源列表

yum -y install salt-master 

 

yum安装软件出现用户取消而退出的解决办法

vim /usr/libexec/urlgrabber-ext-down

将/usr/bin/python改为/usr/bin/python2.7

 

vim /usr/bin/yum-config-manager

解决办法同上: #!/usr/bin/python换成 #!/usr/bin/python2.7  

 

mysql的一些操作指令

1、systemctl start mysqld.service  #启动mysql

2、systemctl status mysqld.service  #查看mysql的启动状态

3、mysql -uroot -p  #进入mysql

 

 

CentOS 7.X 关闭SELinux

 查看

[root@dev-server ~]# getenforce
Disabled
[root@dev-server ~]# /usr/sbin/sestatus -v SELinux status: disabled

永久关闭

vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled 
设置后需要重启才能生效

 

centos 开启telnet服务

安装telnet服务

yum install telnet-server.x86_64
yum install telnet.x86_64

安装xinetd

yum install xinetd.x86_64

将xinted和telnet加入自启动服务

systemctl enable xinetd.service
systemctl enable telnet.socket

重启服务

systemctl start telnet.socket
systemctl start xinetd

 

设置静态ip

vim /etc/sysconfig/network-scripts/网卡名字

IPADDR=192.168.1.122 #本机地址
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.1.1 #默认网关
ONBOOT="yes"
systemctl restart network # 重启网卡
 

 

/var/run/yum.pid 已被锁定,PID 为 

直接在终端运行 rm -f /var/run/yum.pid 将该文件删除,然后再次运行yum

 

转载于:https://www.cnblogs.com/shizhengquan/p/10695819.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值