永久关闭SELinux
[root@centos ~]# vi /etc/selinux/config #将enforcing改为disabled
# 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
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
"/etc/selinux/config" 13L, 457C written
[root@centos ~]# setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@centos ~]# setenforce 0
[root@centos ~]# getenforce
Permissive
永久关闭iptables
对于iptables关闭或开启建议
1)服务器可以被外界访问(公网/外网ip),iptables开启
2)内部环境(局域网/没网ip)iptables关闭
3)高并发的iptables关闭
a) 临时关闭iptables
通过脚本关闭: /etc/init.d/iptables stop
通过服务关闭: service iptables stop
查看当前iptables的状态:/etc/init.d/iptables status
脚本和服务关闭等价,但脚本关闭支持tab补全,建议使用脚本关闭。
b) 永久关闭iptables
注:管理开机自启动服务(软件)-chkconfig
查看iptbales是否开机自启动:chkconfig |grep iptable或者chkconfig --list|grep iptables,两者等价
关闭iptbales:chkconfig iptables off,更精细的关闭是chkconfig --level 3 iptables off
[root@centos ~]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@centos ~]# service iptables stop
[root@centos ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@centos ~]# chkconfig --list|grep iptables
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@centos ~]# chkconfig |grep iptables
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@centos ~]# chkconfig --level 3 iptables off
[root@centos ~]# chkconfig |grep iptables
iptables 0:off 1:off 2:on 3:off 4:on 5:on 6:off
修改字符集
字符集显示不正常可能是客户端(xshell/secureCRT/putty)或虚拟机端字符集设置问题。针对虚拟机
查看字符集:echo $LANG
临时修改字符集(立即生效,重新登录系统失效):export LANG=zh_CN.UTF-8或LANG=zh_CN.UTF-8
注:只要修改环境变量就必须在前面加“export”
中文字符集:zh_CN.UTF-8
英文字符集:en_US.UTF-8
永久修改字符集(source或.或重启生效):修改配置文件/etc/sysconfig/i18n
修改完后:使用source /etc/sysconfig/i18n 使其生效
[root@centos ~]# echo $LANG
en_US.UTF-8
[root@centos ~]# echo $(LANG)
-bash: LANG: command not found
[root@centos ~]# export LANG=en
[root@centos ~]# echo $LANG
en
[root@centos ~]# LANG=en
[root@centos ~]# echo $LANG
en
[root@centos ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[root@centos ~]# vi /etc/sysconfig/i18n
[root@centos ~]# source /etc/sysconfig/i18n
[root@centos ~]# cat /etc/sysconfig/i18n
LANG="zh_cn.UTF-8"
SYSFONT="latarcyrheb-sun16"
命令行参数补齐
最小化安装centos6.9,无法直接使用yum安装bash-completion。先安装EPEL (Extra Packages for Enterprise Linux)
yum provides epel* *completion 查找
yum install epel-release -y 安装epel源
yum install bash-completion -y
退出登录,重新登录即可使用