-1

I want to install node.js on CentOS

  • unfortunately i'm having trouble installing gcc (and all of the things that generally come with it in order to get node to even compile) on centOS via commandline.

What I've tried so far

  • sudo yum install gcc I get the following error
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
memory alloc (8 bytes) returned NULL.

and yes I have set the ulimit prefs to 'unlimited'.


  • I have also attempted installing the depencies individually although this was only possible with a couple whereas the rest (i.e glibc) require to install with dependencies and give me the same error: memory alloc (8 bytes) returned NULL..

  • I have also attempted installing the rpm's of individual dependencies (i.e glibc) however rpm throws the same error of memory alloc (8 bytes) returned NULL. which was pretty annoying.

What I have deduced

  • I think (and hope) it may be a simple preferences issue, since i am able to install smaller files ( <10mb or something ) without error.

4 Answers4

5

Honestly? In a situation like you're in, too little RAM, one of the options you need to explore is to do the compile on some other system and then bring the results to your resource-constrained server. This is what installing an RPM actually is, and you can do a similar thing without learning how to package RPMs.

  1. On a system with more resources, configure it the same as you would your wee VPS. Hardware will be different, but I don't believe that matters for node.js
    • This can be as simple as running CentOS 6.3 in VirtualBox on your laptop, or spending a few hours on a cloud-provider for a larger instance-type and doing it there.
  2. Compile node.js
    • Run the configure & make, but do NOT do make install yet.
  3. Tar up the compiled directory
  4. Transfer to your wee VPS & extract
  5. Run make install.

This should work since install scripts are typically more concerned with moving files around than they are compiling stuff, and are therefore rather RAM-light.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
3

You are on openvz which leads to me to suspect the host is being oversold. Because you cant have swap on it there normally should be burstable memory to catch a temporarily shortcome of memory. This is a known issue with openvz, but which it's not problematic unless the host has too many vms.

You will need to either order extra memory for your instance or just move the vps elsewhere.

Lucas Kauffman
  • 16,818
  • 9
  • 57
  • 92
1

One of the many annoyances I'd long since forgotten about, since I absolutely refuse to ever use OpenVZ for anything. Ever.

If you must use a VPS, use one based on KVM, VMware or Xen. (Listed in order of my personal preference.)

Back when I was stuck babysitting servers on these crappy little VPSes, I could get around this error by disabling plugins. For example:

yum --disableplugin=fastestmirror groupinstall "Development Tools"

Though sometimes that wasn't even enough, and I'd have to shut down running services to free up enough RAM to install packages. Let me tell you, THAT was fun.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • 1
    Never say never. One day you might be down on your luck and need to make a quick buck, and your choices might be either selling an organ or selling oversubscribed, underprovisioned bargain-basement VPSes to people who don't have the knowledge to understand they're being screwed... well, you can live with only one kidney, right? – womble Jul 28 '12 at 21:25
  • There are just some lines I won't cross. Besides, I know how to oversubscribe KVM VPSes. ;) – Michael Hampton Jul 28 '12 at 21:28
  • 2
    But OpenVZ is so much *more* oversubscribable... they should make it one of their marketing points... "OpenVZ is 3x more oversubscribable than the competition!" – womble Jul 28 '12 at 23:39
  • And the poor folks will only notice once they try to go over their memory, and what's the solution, buy even MORE overpriced memory of us!? *insert evil laugh here* – Lucas Kauffman Jul 29 '12 at 00:46
  • Actually the latest vesrion of OpenVZ has a fix for this. They call it vSwap. It lets the VPS use even more RAM than has been allocated (and it apparently shows up in the VPS as swap space) but then it slows down the VPS's execution to simulate the speed decrease of swapping. Combine that with an _actually_ swapping host and you've got a VPS disaster. – Michael Hampton Jul 29 '12 at 01:42
  • the plugin doesn't even exist hahaha, how would I go about shutting every service i don't need down? – Michael Zaporozhets Jul 29 '12 at 02:04
  • Now I think that's a separate question entirely :) – Michael Hampton Jul 29 '12 at 02:18
  • well it's all part of the same problem >_ – Michael Zaporozhets Jul 29 '12 at 02:58
0

It seems that your machine needs a lot more memory than what it currently has available in order to work. So try adding (even temporarily) enough swap space and try again.

adamo
  • 6,867
  • 3
  • 29
  • 58