简体   繁体   English

在Ubuntu服务器上安装软件包时出现内存不足问题

[英]out of memory issue in installing packages on Ubuntu server

I am using a Ubuntu cloud server with limited 512MB RAM and 20 GB HDD. 我使用的是Ubuntu云服务器,内存有限,512MB RAM和20GB硬盘。 Its 450MB+ RAM is already used by processes. 它的450MB + RAM已被进程使用。

I need to install a new package called lxml which gets complied using Cpython while installation and its a very heavy process so it always exits with error gcc: internal compiler error: Killed (program cc1) which is due to no RAM available for it to run. 我需要安装一个名为lxml的新软件包,它在安装时使用Cpython进行Cpython ,并且它是一个非常繁重的过程,所以它总是以错误gcc: internal compiler error: Killed (program cc1)退出gcc: internal compiler error: Killed (program cc1) ,这是由于没有可用的RAM来运行。

Upgrading the machine is a choice but it has its own issues and few of my services/websites live from this server itself. 升级机器是一种选择,但它有自己的问题,我的服务/网站很少来自这个服务器本身。

But on my local machine lxml is already installed properly. 但是在我的本地机器上已经正确安装了lxml And since my need is lxml only, so is it possible that pick all useful files from local machine's directory and copy then into remote machine? 因为我的需要只是lxml ,所以可以从本地机器目录中选择所有有用的文件然后复制到远程机器中吗?

Will it work that way? 它会这样工作吗? If yes, how to pick-up all files for a package? 如果是,如何获取包的所有文件?

Regards 问候

Extend your RAM by adding a swap file: http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/ 通过添加交换文件来扩展您的RAM: http//www.cyberciti.biz/faq/linux-add-a-swap-file-howto/

a swap file is a file stored on the computer hard drive that is used as a temporary location to store information that is not currently being used by the computer RAM. 交换文件是存储在计算机硬盘驱动器上的文件,该文件用作存储当前未被计算机RAM使用的信息的临时位置。 By using a swap file a computer has the ability to use more memory than what is physically installed in the computer http://www.computerhope.com/jargon/s/swapfile.htm 通过使用交换文件,计算机可以使用比计算机中实际安装的内存更多的内存http://www.computerhope.com/jargon/s/swapfile.htm

In Short: 简而言之:

  1. Login as root: su - or execute the commands with sudo in front 以root身份登录: su -或者在前面执行带有sudo的命令
  2. dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
  3. mkswap /swapfile1
  4. chown root:root /swapfile1
  5. chmod 0600 /swapfile1
  6. swapon /swapfile1

Now the swap file will be activated temporarily, but will be gone after reboot. 现在交换文件将暂时激活,但重启后将会消失。 You should have enough RAM for your installing process 您应该有足够的RAM用于安装过程

To Remove the File: 要删除文件:

  1. swapoff -v /swapfile1
  2. rm /swapfile1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM