31

I am using a Ubuntu cloud server with limited 512MB RAM and 20 GB HDD. Its 450MB+ RAM is already used by processes.

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.

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. 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?

Will it work that way? If yes, how to pick-up all files for a package?

Regards

Man8Blue
  • 1,187
  • 6
  • 21
  • 34
  • how about adding a swap partition/file, should give you enough RAM to install lxml. – cptPH Aug 20 '13 at 12:13
  • i'm newbie to ubuntu, at-least in case of memory management. can you elaborate further? – Man8Blue Aug 20 '13 at 12:20
  • 1
    First you need to create a swap file somewhere on the filesystem with the correct size and continuous, like 'sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k'. The call 'sudo mkswap /swapfile' and 'sudo swapon /swapfile'. For a better readable answer, see https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04 – TeTeT Aug 20 '13 at 12:27
  • 1
    @TeTeT It worked well. But how do i delete it without rebooting my server. How will it effect the data already stored on it? – Man8Blue Aug 20 '13 at 16:03
  • Make sure that you don't use the swap any longer (free comes in handy) and then swapoff the file. But take care that it is no longer in use - otherwise your system might get problems. Usually it's best to reboot, though. – TeTeT Aug 20 '13 at 22:45

1 Answers1

82

Extend your RAM by adding a swap file: 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. 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

In Short:

  1. Login as root: su - or execute the commands with sudo in front
  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

To Remove the File:

  1. swapoff -v /swapfile1
  2. rm /swapfile1
cptPH
  • 2,401
  • 1
  • 29
  • 35