CentOS服务器安装之后要做的几件事——网络、yum源、zabbix、selinux、文件句柄数、禁用ipv6等

本文详细介绍了CentOS6.x 64位系列服务器的基础配置步骤,包括内网IP配置、自定义yum源设置、关闭SELinux、防火墙配置、软件包安装等关键操作,帮助读者快速完成服务器的基础搭建。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我所有的服务器基本都是最小化安装,版本为CentOS 6.x  64位系列。

1、配置内网IP    (如果是外网IP,linux要修改远程端口)

2、配置自己的yum源    

yum install wget
rm -f /etc/yum.repos.d/CentOS-Base.repo
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo -O /etc/yum.repo.d/
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo

或者

curl http://mirrors.163.com/.help/CentOS6-Base-163.repo >/etc/yum.repos.d/comratings.repo
curl http://mirrors.aliyun.com/repo/epel-6.repo > /etc/yum.repos.d/epel-6.repo

3、关闭SELinux         
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
setenforce 0

4、添加zabbix监控

5、配置防火墙

service iptables stop
iptables -L
service iptables save

6、安装软件包

yum install -y vim openssh-clients ntpdate man lrzsz

7、配置定时任务
echo "10 6 * * * root (/usr/sbin/ntpdate time.nist.gov && /sbin/hwclock -w) &> /dev/null" >> /etc/crontab


8、配置主机名


9、修改文件句柄数 
#临时修改,立刻生效
ulimit -n 65535         
 
#永久修改
echo "* soft nofile 65536" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf

10、可以禁用ipv6   
    
cat >> /etc/modprobe.d/ipv6.conf <<EOF
alias net-pf-10 off
alias ipv6 off
EOF

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值