클라우드 서버 도움말

Compile Node.js with NPM from source - Ubuntu or Debian

While it is generally recommended that you use the more traditional Node.js install methods, you may want to instead compile Node.js from source if you need more direct control over your Node.js environment or you want to use a custom-compiled version.

Requirements:

  • A Ubuntu or Debian Server
  • Root or sudo permissions
  1. Update your apt repository:
    sudo apt-get update
  2. Install build essentials:
    sudo apt-get install build-essential openssl libssl-dev pkg-config
  3. Change to the src directory:
    cd /usr/local/src
  4. Make a node directory in your src folder:
    sudo mkdir node
  5. Enter the node directory:
    cd node
  6. Copy the Linux Binary from the Node.js download page and use wget to download the package. Make sure to replace the highlighted portion with node's current version:
    sudo wget https://nodejs.org/dist/v6.9.2/node-v6.9.2.tar.gz
  7. Extract the tar file:
    sudo tar zxvf node-v6.9.2.tar.gz
  8. Now that our source code has been extracted, move to the node directory where the highlighted portion is the current version you downloaded:

    cd node-v6.9.2
  9. Note: This folder contains raw files that need to be compiled specifically for your particular architecture and kernel. Most source code packages like this come with a bash script called "configure" that will create all these files and set the options for you.

  10. Run the configure script:
    sudo ./configure
  11. Note: If you don't receive any errors or warnings, the the configure script ran successfully.

  12. Compile the code:
    sudo make

    make will begin compiling the code. This will take 5-10 minutes or even longer depending on your server resources.

  13. Now that make is compiled, install it:
    sudo make install
  14. Check the Node.js version:
    node --version
    v0.10.15
  15. Check the npm version:
    npm --version
    1.3.5
  16. If you see the versions displayed for node and npm, you have successfully compiled Node.js with npm from source. You can now begin installing node modules through npm.

Next step

More info


이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.