在低内存的情况下安装CentOS系统的技巧

昨天想装centos 6.3在本机上测试,但是在text 模式下安装却提示我“you do not have enough ram to install system ……”。我很奇怪,不是text下安装只要180M的ram就可以了吗?但是确实是装不上,我试过将vm的内存调制512M,才能装。如何强制在低于512M内存下安装呢?google 英文半天,找到了一篇,但是我没试,英文要修改 Anaconda代码,Anaconda是redhat,centos的安装程序,下面重点说下在低内存下安装的方法。
1.从32-bit CentOS LiveCD (CentOS-6.0-i386-LiveCD.iso)启动,可以根据自己内存选择是图形界面还是文本模式

2.以root身份登录,方便后面的操作,省的每次都要su

3.编辑/usr/sbin/anaconda,在"within_available_memory"下面添加一行代码:return True,修改后的样子如下:
"within_available_memory" adding a line "return True" like this:
def within_available_memory(needed_ram):
return True
# kernel binary code estimate that is
# not reported in MemTotal by /proc/meminfo
epsilon = 15360 # 15 MB
return needed_ram < (iutil.memInstalled() + epsilon)
4.编辑/usr/lib/anaconda/storage/__init__.py,找到第四个"swapoff",将
"umountFilesystems" from:
for device in devices:
if not device.format.mountable and
(device.format.type != "swap" or swapoff):
continue
修改成
for device in devices:
if not (device.format.mountable and
(device.format.type != "swap" or swapoff)):
continue
5.运行liveinst,这样安装的时候就会有swap了,就有足够的内存运行安装程序了。

0 个评论

要回复文章请先登录注册