linux优化

1、关闭防火墙、selinux、修改字符集

# CentOS 7

$ setenforce 0  # 可以设置配置文件永久关闭

$ systemctl stop iptables.service

$ systemctl stop firewalld.service

# 修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文

$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8

$ export LC_ALL=zh_CN.UTF-8

$ echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf

# CentOS6

$ setenforce 0

$ service iptables stop

# 修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文

$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8

$ export LC_ALL=zh_CN.UTF-8

$ echo 'LANG=zh_CN.UTF-8' > /etc/sysconfig/i18n

vim /etc/selinux/config

SELINUX=disbled

2、配置时间同步

yum install ntpdate -y

ntpdate ntp1.aliyun.com

echo 'ntpdate ntp1.aliyun.com'  >> /etc/rc.loacl

3、修该网卡配置文件

vim /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet

BOOTPROTO=dhcp

NAME=eth0

DEVICE=eth0

ONBOOT=no

4、ssh优化

vim /etc/ssh/sshd_config

GSSAPIAuthentication no

 UseDNS no

重启ssh服务


5、修改主机名

centos6

hostname  xxx

vim /etc/sysconfig/network

修改主机名

centos7

hostnamectl set-hostname controller

重新登陆


6、yum优化

6.1 备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

6.2换源

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

7、其他优化

7.1关闭图形化设置模式

systemctl stop NetworkManager.service 

systemctl disable NetworkManager.service 

7.2下载tab补全命令

yum install -y bash-completion.noarch

7.3下载常用命令

yum install -y net-tools vim lrzsz wget tree screen lsof tcpdump











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值