CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了centos 系统优化大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

常用软件安装 yum install -y wget vim ntPDAte   添加第三方源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo   修改SSH参数 vi /etc/ssh/sshd_config Port 7758 PermitRootLogin no UseDNS no  

常用软件安装
yum install -y wget vim ntPDAte

添加第三方源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

修改SSH参数
vi /etc/ssh/sshd_config
Port 7758
PermitRootLogin no
UseDNS no

设置别名
vi ~/.bashrc
alias vi='vim'
alias grep='egrep --color'

关闭SE
vi /etc/selinux/config
SELINUX=disabled

增加文件描述符
vi /etc/security/limits.conf
* soft nofile 32768
* hard nofile 65536

调整时区
#cenos6
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#cenos7
timedatectl set-timezone Asia/Shanghai

时间同步
crontab -e
*/8 * * * * /usr/sbin/ntPDAte time.windows.com >/dev/null 2>&1

防火墙(根据自己实际需求设置)
iptables -F #清楚防火墙规则
iptables -L #查看防火墙规则
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --dport 53 -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -P INPUT DROP
/etc/init.d/iptables save

去除版本号(如果不懂,个人建议不用操作)
echo "Welcome to Server" >/etc/issue
echo "Welcome to Server" >/etc/redhat-release

调整记录命令历史的条数
vim /etc/profile
HISTSIZE=100

热键重启系统
vi /etc/init/control-alt-delete.conf
#exec /sbin/shutdown -r Now "Control-Alt-deletepressed" #注释掉

为grub加入密码
grub-md5-crypt //生成密文密码串
password:
Retype password:
$1$oi.en1$wWH/NntT0GPYVxqk24Koh. #加密密码

vim /boot/grub/grub.conf #打开文件

……………
hiddenmenu #添加到下面
password --md5 $1$oi.en1$wWH/NntT0GPYVxqk24Koh.
title CentOS (2.6.32-358.el6.x86_64)

锁定关键的系统文件(+i 锁定 -i解锁)chattr +i /etc/passwd /etc/shadow /etc/groupp /etc/gshadow chattr -i /etc/passwd /etc/shadow/etc/group /etc/gshadow

大佬总结

以上是大佬教程为你收集整理的centos 系统优化全部内容,希望文章能够帮你解决centos 系统优化所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。