赵赵赵大大 發表於 2024-3-10 00:00:00

CentOS搭建LAMP服务器环境硬盘分区方案分享

<p>
        <span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>CentOS是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。两者的不同,在于CentOS并不包含封闭源代码软件。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>我们在使用Linux作为服务器的过程中,经常会对硬盘中分区如何更合理的分配而感觉疑惑,特别是刚开始接触Linux的朋友,对于服务器中硬盘空间各分区的合理分配,心中也没有底,现列出以下方案供大家来学习!当然也你也可以根据自己的需求来进行更合理的制定! </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>/boot 100MB 内核及启动文件 </font><br><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>挂载点:选择“/boot” </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>文件系统类型:使用默认“Ext4 日志文件系统” </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>大小:输入分配的大小,以 MB 为单位 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>其它大小选项:选择“固定大小”。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>swap 交换空间,一般为服务器内存的2倍 </font><br><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/ 10G </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>挂载点:选择“/” </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>文件系统类型:使用默认“Ext4 日志文件系统” </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>大小:输入分配的大小,以 MB 为单位 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>其它大小选项:选择“固定大小”。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>/usr 最起码5G,整个Linux系统基本就安装在这里了。我喜欢搞10G </font><br><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>挂载点:选择“/usr” </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>文件系统类型:使用默认“Ext4 日志文件系统” </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>大小:输入分配的大小,以 MB 为单位 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>其它大小选项:选择“固定大小”。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>/usr/loacl/ 5到10个G就够用了(Oracle别装这里,否则会不够玩的,呵呵)我们习惯把LAMP编译安装的东西放这里(这是习惯的力量,官方推荐我们装/opt目录了) </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>主要是放PHP网站的吧, </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/home就不用分出来了 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>剩下空间全部用来放PHP网站,(例:挂载在/usr/local/apache2/htdocs/ ) </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>访问量大注意及时清理临时文件,在/tmp </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>日志文件也要注意 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>总结:硬盘分区往往是在服务器开始正式投入使用就需要考虑的问题,所以在前期规划的过程中就需要考虑到后期的使用情况!本文抛砖引玉,让大家对于服务器正式的生产环境能有更清楚的认识。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>CentOS 分区 硬盘分区方案二 </strong><br><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在计算机上安装 Linux 系统,对硬盘进行分区是一个非常重要的步骤,下面介绍几个分区方案。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>( 1 )方案 1 </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/ :建议大小在 5GB 以上。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>swap :即交换分区,建议大小是物理内存的 1~2 倍。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>( 2 )方案 2 </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/boot :用来存放与 Linux 系统启动有关的程序,比如启动引导装载程序等,建议大小为 100MB 。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/ : Linux 系统的根目录,所有的目录都挂在这个目录下面,建议大小为 5GB 以上。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/home :存放普通用户的数据,是普通用户的宿主目录,建议大小为剩下的空间。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>swap :实现虚拟内存,建议大小是物理内存的 1~2 倍。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><font color="#ff0000" style='line-height: 25.2px; font-size: 14px; font-family: tahoma, arial, "Microsoft YaHei";'>( 3 )方案 3 </font><br><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/boot :用来存放与 Linux 系统启动有关的程序,比如启动引导装载程序等,建议大小为 100MB 。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/usr :用来存放 Linux 系统中的应用程序,其相关数据较多,建议大于 3GB 以上。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/var :用来存放 Linux 系统中经常变化的数据以及日志文件,建议大于 1GB 以上。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/home :存放普通用户的数据,是普通用户的宿主目录,建议大小为剩下的空间。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/ : Linux 系统的根目录,所有的目录都挂在这个目录下面,建议大小为 5GB 以上。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>/tmp :将临时盘在独立的分区,可避免在文件系统被塞满时影响到系统的稳定性。建议大小为 500MB 以上。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>swap :实现虚拟内存,建议大小是物理内存的 1~2 倍。</span></p>
頁: [1]
查看完整版本: CentOS搭建LAMP服务器环境硬盘分区方案分享