Linux 服务器初始化配置 && 优化

01. 服务器基础信息验证

1.1 服务器连通性验证
1.1.1 ping 服务器地址验证
ping 10.10.200.84
1.1.2 ssh 登录服务器
ssh root@10.10.200.84
1.2 服务器 CPU、内存、磁盘大小验证
1.2.1 CPU 查看
cat /proc/cpuinfo | grep process | wc -l
1.2.2 内存大小查看
free -mh
1.2.3 磁盘大小验证
df -hT

02. 服务器初始化配置

2.1 SeLinux 关闭
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux && setenforce 0
2.2 防火墙关闭
systemctl stop firewalld && systemctl disable firewalld
2.3 主机名配置
hostnamectl --static set-hostname hessian01
2.4 普通账号创建
2.4.1 账号创建
useradd -d /home/dev -m -s /bin/bash dev
2.4.2 密码配置
echo "123456" | passwd --stdin dev
2.5 系统时间同步
2.5.1 安装 ntp 服务
yum -y install ntp
2.5.2 启动 && 配置开机启动
systemctl start ntpd && systemctl enable ntpd
2.5.3 同步时间
ntpdate ntp1.aliyun.com
2.5.4 同步到硬件
hwclock -s
2.6 系统内核优化
[root@demo ~]# cat /etc/sysctl.conf | grep -v '^#' | grep -v '^$'
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 11
net.ipv4.neigh.default.gc_stale_time = 120
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 32768
net.ipv4.tcp_max_syn_backlog = 65536
net.core.somaxconn = 32768
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 1024    65000

参考

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值