藏宝游

 找回密码
 立即注册
查看: 1230|回复: 4

[其它] 6步骤实现CentOS系统环境精简优化

[复制链接]

 成长值: 600

  • TA的每日心情
    开心
    2024-3-24 02:35
  • 签到天数: 5 天

    [LV.2]圆转纯熟

    灌水成绩
    47583
    8
    247949
    主题
    帖子
    积分

    等级头衔

    ID : 2

    超级版主

    积分成就 威望 : 1
    贡献 : 0
    杰币 : 105182
    在线时间 : 165 小时
    注册时间 : 2022-1-8
    最后登录 : 2024-4-17

    荣誉勋章
    最佳新人热心会员大富翁龙年大吉
    发表于 2022-1-25 20:22:42 | 显示全部楼层 |阅读模式
    6步骤实现CentOS系统环境精简优化
    随着VPS主机使用的深化,老左从开始使用面板工具操作VPS,再到后来的一键安装包,现在基本上能自学自用VPS管理网站/备份网站维护。但是需要深入的运维还需要时日,比如刚才看到一篇CentOS系统环境精简优化的文章还是值得分享的。但是在操作之前,最好建议在我们安装系统之后操作,而不要在有网站运行之后操作,以免系统出现问题。
    第一步、删除不必要的自带软件包
    1. yum remove Deployment_Guide-en-US finger cups-libs cups ypbind
    2. yum remove bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils
    3. yum remove sendmail* samba* talk-server finger-server bind* xinetd
    4. yum remove nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools
    5. yum remove syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools
    6. yum groupremove "Mail Server" "Games and Entertainment" "X Window System" "X Software Development"
    7. yum groupremove "Development Libraries" "Dialup Networking Support"
    8. yum groupremove "Games and Entertainment" "Sound and Video" "Graphics" "Editors"
    9. yum groupremove "Text-based Internet" "GNOME Desktop Environment" "GNOME Software Development"
    复制代码
    第二步、升级centos系统
    1. yum update #更新系统
    2. yum clean all #清理全部缓存文件
    复制代码
    第三步、禁用seLinux
    1. sestatus #先执行看seLinux状态,如果不是disabled,就需要执行下面步骤,否则不要执行
    2. vi /etc/selinux/config
    3. SELINUX=disabled #禁用SeLinux
    4. SELINUX=enforcing #使用SeLinux
    复制代码
    第四步、禁止IPV6(执行后需要reboot重启)
    1. vi /etc/modprobe.conf #打开文件,把下面两行加到最后
    2. alias net-pf-10 off
    3. alias ipv6 off
    复制代码
    第五步、初始化防火墙
    1. touch /etc/sysconfig/iptables
    2. iptables -F
    3. iptables -X
    4. iptables -Z
    5. service iptables save
    6. service iptables restart
    复制代码
    第六步、禁止无用服务
    1. #! /bin/bash
    2. service acpid off
    3. service atd stop
    4. service auditd stop
    5. service avahi-daemon stop
    6. service avahi-dnsconfd stop
    7. service bluetooth stop
    8. service conman stop
    9. service cpuspeed stop
    10. service cups stop
    11. service dnsmasq stop
    12. service dund stop
    13. service firstboot stop
    14. service hidd stop
    15. service httpd stop
    16. service ibmasm stop
    17. service ip6tables stop
    18. service irda stop
    19. service kdump stop
    20. service lm_sensors stop
    21. service mcstrans stop
    22. service messagebus stop
    23. service microcode_ctl stop
    24. service netconsole stop
    25. service netfs stop
    26. service netplugd stop
    27. service nfs stop
    28. service nfslock stop
    29. service nscd stop
    30. service ntpd stop
    31. service oddjobd stop
    32. service pand stop
    33. service pcscd stop
    34. service portmap stop
    35. service psacct stop
    36. service rdisc stop
    37. service restorecond stop
    38. service rpcgssd stop
    39. service rpcidmapd stop
    40. service rpcsvcgssd stop
    41. service saslauthd stop
    42. service sendmail stop
    43. service setroubleshoot stop
    44. service smb stop
    45. service vncserver stop
    46. service winbind stop
    47. service wpa_supplicant stop
    48. service xfs stop
    49. service ypbind stop
    50. service yum-updatesd stop
    51. chkconfig acpid off
    52. chkconfig atd off
    53. chkconfig auditd off
    54. chkconfig avahi-daemon off
    55. chkconfig avahi-dnsconfd off
    56. chkconfig bluetooth off
    57. chkconfig conman off
    58. chkconfig cpuspeed off
    59. chkconfig cups off
    60. chkconfig dnsmasq off
    61. chkconfig dund off
    62. chkconfig firstboot off
    63. chkconfig hidd off
    64. chkconfig httpd off
    65. chkconfig ibmasm off
    66. chkconfig ip6tables off
    67. chkconfig irda off
    68. chkconfig kdump off
    69. chkconfig lm_sensors off
    70. chkconfig mcstrans off
    71. chkconfig messagebus off
    72. chkconfig microcode_ctl off
    73. chkconfig netconsole off
    74. chkconfig netfs off
    75. chkconfig netplugd off
    76. chkconfig nfs off
    77. chkconfig nfslock off
    78. chkconfig nscd off
    79. chkconfig ntpd off
    80. chkconfig oddjobd off
    81. chkconfig pand off
    82. chkconfig pcscd off
    83. chkconfig portmap off
    84. chkconfig psacct off
    85. chkconfig rdisc off
    86. chkconfig restorecond off
    87. chkconfig rpcgssd off
    88. chkconfig rpcidmapd off
    89. chkconfig rpcsvcgssd off
    90. chkconfig saslauthd off
    91. chkconfig sendmail off
    92. chkconfig setroubleshoot off
    93. chkconfig smb off
    94. chkconfig vncserver off
    95. chkconfig winbind off
    96. chkconfig wpa_supplicant off
    97. chkconfig xfs off
    98. chkconfig ypbind off
    99. chkconfig yum-updatesd off
    复制代码
    这样通过上述6步骤,就可以完成对centos精简和优化。
  • TA的每日心情
    无聊
    2023-5-5 23:34
  • 签到天数: 24 天

    [LV.4]渐入佳境

    灌水成绩
    0
    125
    333
    主题
    帖子
    积分

    等级头衔

    ID : 63

    中级会员

    积分成就 威望 : 0
    贡献 : 0
    杰币 : 208
    在线时间 : 5 小时
    注册时间 : 2022-1-22
    最后登录 : 2023-5-5

    荣誉勋章
    发表于 2022-1-26 13:48:50 | 显示全部楼层
    果断回帖,如果沉了就是我弄沉的很有成就感
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2022-12-16 08:42
  • 签到天数: 7 天

    [LV.3]略有小成

    灌水成绩
    0
    257
    315
    主题
    帖子
    积分

    等级头衔

    ID : 1394

    中级会员

    积分成就 威望 : 0
    贡献 : 0
    杰币 : 58
    在线时间 : 8 小时
    注册时间 : 2022-12-8
    最后登录 : 2022-12-16

    荣誉勋章
    发表于 2022-12-9 17:05:48 | 显示全部楼层
    添加丢失的所有技能
    回复

    使用道具 举报

  • TA的每日心情
    擦汗
    2023-1-19 05:08
  • 签到天数: 2 天

    [LV.1]登堂入室

    灌水成绩
    0
    79
    96
    主题
    帖子
    积分

    等级头衔

    ID : 1504

    初级会员

    积分成就 威望 : 0
    贡献 : 0
    杰币 : 17
    在线时间 : 2 小时
    注册时间 : 2023-1-8
    最后登录 : 2023-1-21

    荣誉勋章
    发表于 2023-1-9 00:40:24 | 显示全部楼层
    果断回帖,如果沉了就是我弄沉的很有成就感
    回复

    使用道具 举报

    该用户从未签到

    灌水成绩
    0
    109
    130
    主题
    帖子
    积分

    等级头衔

    ID : 261

    初级会员

    积分成就 威望 : 0
    贡献 : 0
    杰币 : 21
    在线时间 : 3 小时
    注册时间 : 2022-3-27
    最后登录 : 2023-2-12

    荣誉勋章
    发表于 2023-1-16 21:55:46 | 显示全部楼层
    看帖看完了至少要顶一下,还可以加入到淘帖哦!
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    小黑屋|手机版|Archiver|RSS|藏宝游 ( 豫ICP备2021017492号 )|网站地图

    GMT+8, 2024-5-4 10:39 , Processed in 0.038367 second(s), 9 queries , Redis On.

    Powered by Discuz! X3.4

    本站不储存任何资源,所有资源均来自用户分享的网盘链接。
    本站为非盈利性站点,不会收取任何费用,所有内容不作为商业行为。

    快速回复 返回顶部 返回列表