Linux_基础优化
关闭selinux(由美国国家安全局创建)安全服务功能: 1>永久关闭selinux功能(重启系统生效) vim /etc/selinux/config 功能永久开启:enforcing 功能临时关闭:permissive 功能永久关闭: disabled sed -i "s#SELINUX=123#SELINUX=disabled#g" /etc/selinux/config 【运维修改文件三部曲】: 01:编辑文件进行备份 02:编辑文件进行修改 03: 编辑文件进行检查 2>临时关闭selinux功能(设置立即生效) setenforce [ Enforcing | Permissive | 1 | 0 ] gerenforce? 功能永久开启:enforcing |1 功能临时关闭:permissive|0 关闭iptables安全服务功能 服务器防火墙运行状态建议 开启:服务器可以被外界访问(公网/外网ip) 关闭:服务器可以被内部访问(私网/内网ip) 服务器处于高并发状态(公网/外网ip) Centos 7:? systemctl start firewalld.service 【开启】 systemctl stop? firewalld.service 【关闭】 systemctl status? firewalld.service 【查看状态】 systemctl is-active? firewalld.service systemctl is-enabled firewalld.service 【查看服务自启动状态信息】 systemctl enable firewald.service 【修改为开启自启动】 systemctl disabled firewalld.service Centos 6: /etc/init.d/iptables start 利用硬件防火墙进行规范 ?/etc/init.d/iptables stop /etc/init.d/iptables status? chkconfig/chkconfig --list? 【查看所有服务启动状态信息】 chkconfig|grep "ipt" 【查看指定服务状态信息】 chkconfig iptables off/on 【修改指定服务启动状态信息】 05.防止系统乱码优化 出现乱码情况设置 export LANG=en.US-gb2312 echo $LANG? 【查看系统当前使用字符集】 解决乱码情况设置 临时修改系统字符集信息 Xshell/SecureCRT :查看系统连接软件字符集 export LANG=en_US.utf8 :确保系统和连接软件一致 永久修改系统字符集设置 1.备份配置信息 cp /etc/locale.conf /etc/locale.conf.bak 2.编写配置文件 echo ‘LANG="zh_CN.UTF-8"‘ > /etc/locale.conf source /etc/locale.conf 3.查看配位信息 echo $LANG 同时永久临时修改字符集 localectl set-locale LANG=zh_CN.UTF-8 source /etc/locale.conf 06 下载的源信息更新 时区:可以有效设置的时间信息 时间修改方式说明: RTC:系统硬件时间信息 NTP: 网络时间同步协议 timedatectl? 查看时区信息 修改时区方法: timedatectl list-timezones? ?列出所有时区 timedatectl set-local-rtc 1 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC时间 timedatectl set-timezone Asia/Shanghai 设置系统时区为上海 时间同步设置 yum -y? install ntp ntpdate ntp1.aliyum.com? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |