码迷,mamicode.com
首页 > 系统相关 > 详细

Linux基础优化

时间:2020-01-15 10:08:19      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:list   text   enter   ini   基础优化   centos6   代码   orm   col   

系统优化

关闭系统安全服务

iptables --Centos6防火墙

  • 临时关闭
    /etc/init.d/iptables stop /etc/init.d/iptables status services stop iptables
  • 永久关闭
    chkconfig iptables off chkconfig --list iptables

    firewalled --Centos7防火墙

  • 临时关闭
    systemctl stop firewalld systemctl is-active firewalld
  • 永久关闭
    systemctl disable firewalld systemctl is-enabled firewalld

    SELinux安全服务

  • 临时关闭
    setenforce setenforce 0 getenforce
  • 永久关闭
    • vim /etc/selinux/config
      替换第7行的enforcingdisabled
    • 或者直接输入命令执行
      sed -i ‘7s#enforcing#disabled#g‘ /etc/selinux/config

字符集优化

  • 临时调整
    • LANG="en_US.GBK"
  • 永久调整
    • vim /etc/profileLANG="en_US.GBK"写入
    • vim /etc/locale.confLANG="en_US.GBK"写入
    • localectl set-locale LANG="zh_CN.utf8"

系统时间信息优化

  • timedatectl命令
参数 含义
status 显示时间信息
set-time 00:00 设置时间为00:00
set-timezone ZONE 设置时区为ZONE
list-timezones 显示已知系统时区信息
set-local-rtc BOOL RTC功能是否开启
set-ntp BOOL 是否设置开启网络时间同步功能

RTC : 硬件时间信息,将系统信息自动同步给硬件
BOOL : 布尔型数据

远程连接优化

  • 直接通过替换命令修改
sed -i '79s#GSSAPIAuthentication yes#GSSAPIAuthentication no#g'  /etc/ssh/sshd_config
sed -i '115s#UseDNS yes#UseDNS no#g'  /etc/ssh/sshd_config
sed -i '/^#   StrictHostKeyChecking/c StrictHostKeyChecking no' /etc/ssh/ssh_config
systemctl restart sshd

颜色代码

颜色 代码 颜色 代码
开头 \[\033[01;3nm\] 结尾 \033[0m\]
黑色 n=0 红色 n=1
绿色 n=2 黄色 n=3
蓝色 n=4 紫色 n=5
青色 n=6 白色 n=7

技术图片

Linux基础优化

标签:list   text   enter   ini   基础优化   centos6   代码   orm   col   

原文地址:https://www.cnblogs.com/magicsimba/p/12194954.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!