{"id":1495,"date":"2017-05-08T23:27:44","date_gmt":"2017-05-08T17:57:44","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=1495"},"modified":"2017-05-18T12:17:50","modified_gmt":"2017-05-18T06:47:50","slug":"install-multiple-version-node-linux","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/install-multiple-version-node-linux\/","title":{"rendered":"Install Multiple version of node on linux"},"content":{"rendered":"<h3>Install Multiple version of node on linux<\/h3>\n<p><strong>Date Posted: 08-05-2017<\/strong><\/p>\n<p>We want two version of node version on a single server. Alternatives is an utility which can be used to install two version of any package.<\/p>\n<h4>Assumption:<\/h4>\n<ol>\n<li>Ubuntu Host<\/li>\n<\/ol>\n<h4>Implemntation:<\/h4>\n<p>Let&#8217;s start with node installation. We will use one normal apt-get to install node version and other one from source.<\/p>\n<p><code><\/code><code>apt-get install nodejs<\/code><\/p>\n<p>Install npm(node package manager)<\/p>\n<p><code>apt-get install npm<\/code><\/p>\n<p>After successful installation of both the package, verify the node version.<\/p>\n<p><code>nodejs -v<\/code><\/p>\n<p>Now, install different version of node. Let&#8217;s create a directory for node package on\u00a0<em>\/usr\/local\/bin\/node<\/em><\/p>\n<p><code>mkdir \/usr\/local\/bin\/node<\/code><\/p>\n<p>Change the directory and download the different version of node from official website.<\/p>\n<p><code>cd \/usr\/local\/bin\/node<\/code><\/p>\n<p><code>wget https:\/\/nodejs.org\/dist\/v5.0.0\/node-v5.0.0-linux-x64.tar.gz<\/code><\/p>\n<p>Extract the downloaded file.<\/p>\n<p><code>tar -xzf node-v5.0.0-linux-x64.tar.gz<\/code><\/p>\n<p>Here comes the main part, use alternatives to configure both version<\/p>\n<p><code>update-alternatives --install \"\/usr\/bin\/node\" \"node\" \"\/usr\/bin\/node\" 100<\/code><\/p>\n<p><code>update-alternatives --install \"\/usr\/bin\/node\" \"node\" \"\/usr\/local\/bin\/nodes\/node-v5.0.0-linux-x64\/bin\/node\" 50<\/code><\/p>\n<p>To switch the version of node, use the following command.<\/p>\n<p><code>update-alternatives --config node<\/code><\/p>\n<p>Select <em>2 <\/em>to change version to use node-v5 version in this example.<\/p>\n<p>Similarly, use the below commands to configure two different version.<\/p>\n<p><code>update-alternatives --install \"\/usr\/bin\/npm\" \"npm\" \"\/usr\/bin\/npm\" 100<br \/>\nupdate-alternatives --install \"\/usr\/bin\/npm\" \"npm\" \"\/usr\/local\/bin\/nodes\/node-v5.0.0-linux-x64\/bin\/npm\" 50<\/code><\/p>\n<p>To switch the version of npm,<\/p>\n<p><code>update-alternatives --config npm<\/code><\/p>\n<p>Post your queries in comment section incase of any queries.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Multiple version of node on linux Date Posted: 08-05-2017 We want two version of node version on a single [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[336,337,338],"class_list":["post-1495","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-node","tag-nodejs","tag-npm","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-o7","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1495"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1495\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}