Linux系统优化1
发布时间:2020-12-14 00:24:09 所属栏目:Linux 来源:网络整理
导读:1、YUM优化 优化基础的yum源文件 通过阿里镜像源进行优化: curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 优化扩展的yum源文件 通过阿里镜像源进行优化: wget -O /etc/yum.repos.d/epel.repo http://mirrors.ali
1、YUM优化
优化基础的yum源文件 通过阿里镜像源进行优化: curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 优化扩展的yum源文件 通过阿里镜像源进行优化: wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 2、系统安全相关优化 防火墙服务程序 ○ centos6 查看防护墙服务状态 /etc/init.d/iptables status 临时关闭防火墙服务 /etc/init.d/iptables stop /etc/init.d/iptables status 永久关闭防火墙服务 chkconfig iptables off ○ centos7 查看防火墙服务状态 systemctl status firewalld 临时关闭防火墙服务 systemctl stop firewalld systemctl status firewalld 永久关闭防火墙服务 systemctl disable firewalld 补充: 查看服务状态信息简便方法 systemctl is-active firewalld --- 检查服务是否正常运行 systemctl is-enabled firewalld --- 检查确认服务是否开机运行 系统的selinux服务程序 selinux服务对root用户权限进行控制 很多企业中:selinux服务默认关闭 centos6==centos7 临时关闭: 检查确认: getenforce --- 确认selinux服务是否开启或是关闭的 如何关闭: [[email?protected] ~]# setenforce usage: setenforce [ Enforcing | Permissive | 1 | 0 ] Enforcing 1 --- 临时开启selinux Permissive 0 --- 临时关闭selinux setenforce 0 --- 临时关闭selinux服务 永久关闭: enforcing - SELinux security policy is enforced. selinux服务处于正常开启状态 permissive - SELinux prints warnings instead of enforcing. selinux服务被临时关闭了 disabled - No SELinux policy is loaded. selinux服务彻底关闭 vi /etc/selinux/config SELINUX=disabled PS: 如果想让selinux配置文件生效,重启系统 3、字符编码优化 出现乱码的原因: 系统字符集设置有问题; 远程软件字符集设置有问题;文件编写字符集和系统查看的字符集不统一 系统中字符集编码设置方法 centos6 查看默认编码信息: [[email?protected] ~]# echo $LANG --- LANG用于设置字符编码信息 en_US.UTF-8 临时修改: [[email?protected] ~]# echo $LANG en_US.UTF-8 修改命令:LANG=XXX 永久修改: 方法一: [[email?protected] ~]# tail -5 /etc/profile export LANG=‘en_US.UTF-8‘ 方法二:编辑/etc/sysconfig/i18n文件修改语言 vi /etc/sysconfig/i18n LANG=‘en_US.UTF-8 修改后需要source一下使其生效 source /etc/sysconfig/i18n centos7 查看默认编码信息 [[email?protected] ~]# echo $LANG en_US.UTF-8 临时修改: [[email?protected] ~]# echo $LANG en_US.UTF-8 修改命令: LANG=XXX 永久修改: 方法一: 更加有先 [[email?protected] ~]# tail -5 /etc/profile export LANG=‘en_US.UTF-8‘ 方法二: [[email?protected] ~]# cat /etc/locale.conf LANG="zh_CN.UTF-8" 补充:一条命令即临时设置,又永久设置 localectl set-locale LANG=zh_CN.GBK 4、加速xshell软件远程连接速度 step2:修改hosts文件 [[email?protected] ~]# vi /etc/hosts 10.1.1.200 damingli.com step3:重启ssh远程服务 systemctl restart sshd (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |