zoukankan      html  css  js  c++  java
  • Linux系统调优

    linux系统安装完毕后,首先要做的就是系统调优,这样会提高系统的使用效率,接下来为大家介绍一下linux系统调优方法。

    linux系统调优linux系统调优

    关闭selinux功能

    selinux是美国国家安全局对于强制访问控制的实现,这个功能很强大,同时又很麻烦,大多是运维人员都选择将其关闭,利用其它途径增加安全性。

    命令是永久关闭selinux,执行后重启系统生效。

    [root@chao selinux]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
    
    开机自启服务

    linux系统和windows系统类似,开机也会自启一些服务,没用的服务即会占用资源又有安全隐患,需要把必须运行的服务开机自启,其他的关闭。

    需要开机自启的服务:
    • sshd,远程连接需要使用此服务
    • rsyslog,日志有关的软件
    • networ,网络相关的软件
    • crond,定时任务相关软件
    • sysstat数据分析的软件
    查看目前开机自启的服务
    [root@chao selinux]# systemctl list-unit-files|grep enabled
    abrt-ccpp.service                             enabled 
    abrt-oops.service                             enabled 
    abrt-vmcore.service                           enabled 
    abrt-xorg.service                             enabled 
    abrtd.service                                 enabled 
    atd.service                                   enabled 
    auditd.service                                enabled 
    autovt@.service                               enabled 
    chronyd.service                               enabled 
    crond.service                                 enabled 
    dbus-org.fedoraproject.FirewallD1.service     enabled 
    dbus-org.freedesktop.ModemManager1.service    enabled 
    dbus-org.freedesktop.NetworkManager.service   enabled 
    dbus-org.freedesktop.nm-dispatcher.service    enabled 
    dmraid-activation.service                     enabled 
    firewalld.service                             enabled 
    getty@.service                                enabled 
    irqbalance.service                            enabled 
    iscsi.service                                 enabled 
    kdump.service                                 enabled 
    ksm.service                                   enabled 
    ksmtuned.service                              enabled 
    libstoragemgmt.service                        enabled 
    libvirtd.service                              enabled 
    
    例如想关闭一个
    [root@chao selinux]# systemctl disable postfix.service 
    Removed symlink /etc/systemd/system/multi-user.target.wants/postfix.service.
    
    设置ssh服务

    编辑/etc/ssh/sshd_config文件 更改默认端口为Port 22222 保存退出,重启服务!
    linux系统调优linux系统调优

    linux中文设置

    查看系统是否是 zh_CN.UTF-8 如果不是手动添加一行到此文件。

    [root@chao etc]# cat locale.conf 
    LANG="zh_CN.UTF-8"
    设置账户超时时间
    [root@chao ~]# echo 'export TMOUT=300' >>/etc/profile
    [root@chao ~]# source /etc/profile
    [root@chao ~]# env |grep -i tmout
    [root@chao ~]# vim /etc/profile
    [root@chao ~]# source /etc/profile
    [root@chao ~]#  等待输入超时:自动登出
    Connection closing...Socket close.
    
    Connection closed by foreign host.
    
    Disconnected from remote host(172.16.1.16) at 11:01:36.
    
    Type `help' to learn how to use Xshell prompt.
    
    设置命令行历史记录数

    将原来的5条改成10条

    [root@chao ~]# sed -i 's/^HISTSIZE=5/HISTSIZE=10/' /etc/profile
    [root@chao ~]# source /etc/profile
    
    隐藏系统版本
    [root@chao ~]# echo redflag 5.9 >/etc/issue
    [root@chao ~]# cat /etc/issue
    redflag 5.9
    
    锁定重要文件
    [root@chao ~]# chattr -i /etc/passwd /etc/shoadow /etc/group /etc/gshadow /etc/inittab

    以上就是常用的优化步骤!

  • 相关阅读:
    Libgdx之Music Sound 音效
    [Android]Activity的生命周期
    Android开发中无处不在的设计模式——动态代理模式
    Wireshark数据抓包分析——网络协议篇
    iOS-一个弹出菜单动画视图开源项目分享
    给Java开发人员的Play Framework(2.4)介绍 Part1:Play的优缺点以及适用场景
    mybatis自己学习的一些总结
    Cocos2d-x 源代码分析 : Scheduler(定时器) 源代码分析
    exe4j打包java应用程序
    删除sql server用户时报15138错误
  • 原文地址:https://www.cnblogs.com/linuxprobe/p/14052128.html
Copyright © 2011-2022 走看看