{"id":786,"date":"2015-03-25T07:22:06","date_gmt":"2015-03-25T01:22:06","guid":{"rendered":"http:\/\/promincproductions.com\/blog\/?p=786"},"modified":"2015-06-04T01:16:55","modified_gmt":"2015-06-03T19:16:55","slug":"how-to-install-nodejs-fabricjs-on-debian-squeeze","status":"publish","type":"post","link":"https:\/\/promincproductions.com\/blog\/how-to-install-nodejs-fabricjs-on-debian-squeeze\/","title":{"rendered":"How To Install NodeJS with FabricJS on Debian Squeeze"},"content":{"rendered":"<p>Various versions of Linux have slightly different methods for installing some packages &#8211; NodeJS is one of them. \u00a0So when I had to setup a Debian Squeeze server with NodeJS I figured I&#8217;d write down my success instructions so that I can share it with all of you as well.<\/p>\n<p>This set of instructions will walk through installing NodeJS with npm (Node Package\u00a0Manager), Canvas, FabricJS, and a few other dependancies and npm packages, such as forever, on Debian Squeeze via command line.<\/p>\n<figure id=\"attachment_796\" aria-describedby=\"caption-attachment-796\" style=\"width: 500px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/promincproductions.com\/blog\/wp-content\/uploads\/2015\/03\/debian-logo-555x242.png\" rel=\"attachment wp-att-796\" data-lasso-id=\"344\" data-rel=\"lightbox-gallery-KAocRAnZ\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" class=\"size-medium wp-image-796\" src=\"https:\/\/promincproductions.com\/blog\/wp-content\/uploads\/2015\/03\/debian-logo-555x242-500x218.png\" alt=\"How to install NodeJS on Debian Squeeze\" width=\"500\" height=\"218\" srcset=\"https:\/\/promincproductions.com\/blog\/wp-content\/uploads\/2015\/03\/debian-logo-555x242-500x218.png 500w, https:\/\/promincproductions.com\/blog\/wp-content\/uploads\/2015\/03\/debian-logo-555x242-150x65.png 150w, https:\/\/promincproductions.com\/blog\/wp-content\/uploads\/2015\/03\/debian-logo-555x242.png 555w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption id=\"caption-attachment-796\" class=\"wp-caption-text\">Install NodeJS with FabricJS on Linux Debian Squeeze via command line.<\/figcaption><\/figure>\n<p>This setup was done on a Sonassi MageStack server.<br \/>Distributor ID: Debian<br \/>Release: 6.0.10<br \/>Codename: squeeze<\/p>\n<p><strong>UPDATE June 3rd, 2015<\/strong><\/p>\n<p>I found that instead calling\u00a0<em><strong>node<\/strong><\/em> didn&#8217;t work for some reason on a clean install. \u00a0Instead, call\u00a0<em><strong>nodejs<\/strong><\/em> wherever you&#8217;d typically call\u00a0<em><strong>node<\/strong><\/em>.<\/p>\n<p>I just used these same instructions for installation on Ubuntu as well. \u00a0I found that my older instructions for <a href=\"https:\/\/promincproductions.com\/blog\/installing-fabricjs-for-nodejs-on-linux\/\" data-lasso-id=\"345\">installation of NodeJS on Ubunutu<\/a> didn&#8217;t work on this version.<\/p>\n<p>Distributor ID: Ubuntu<br \/>Release: 15.04<br \/>Codename: vivid<\/p>\n<h2>Setup<\/h2>\n<h3>Set User<\/h3>\n<p>Note: it&#8217;s easiest to install while logged in as the root user.<\/p>\n<p>If you are not currently using the root user, you can switch to it with:<\/p>\n<pre><code>su root\r\n<\/code><\/pre>\n<p>You will be prompted to enter your password.<\/p>\n<p>If you are not logged in as the root user, add &#8216;sudo&#8217;\u00a0before the commands below.<\/p>\n<h3>Check Linux Version<\/h3>\n<pre><code>lsb_release -irc<\/code><\/pre>\n<h3>Set\u00a0to installation directory<\/h3>\n<pre><code>cd \/usr\r\n<\/code><\/pre>\n<h3>Install dependencies<\/h3>\n<pre><code>sudo apt-get install python-software-properties python g++ make\r\n<\/code><\/pre>\n<h3>Install Git core<\/h3>\n<pre><code>apt-get install git-core curl\r\n<\/code><\/pre>\n<h2>Install NodeJS<\/h2>\n<h3>Get the NodeJS codebase<\/h3>\n<pre><code>git clone https:\/\/github.com\/joyent\/node.git\r\n<\/code><\/pre>\n<h3>Switch to the node directory<\/h3>\n<pre><code>cd node\r\n<\/code><\/pre>\n<h3>Check NodeJS Version<\/h3>\n<p>You can check what the current version of NodeJS is at:<br \/><a href=\"http:\/\/nodejs.org\/download\/\" target=\"_blank\" data-lasso-id=\"346\" rel=\"noopener\">http:\/\/nodejs.org\/download\/<\/a><br \/>Within Linux, you can also see a list of available versions of NodeJS with:<\/p>\n<pre><code>git tag\r\n<\/code><\/pre>\n<h3>Get the repository for git.<\/h3>\n<p>Use the version number that you wish to install &#8211; for most installations this will be the most recent stable version found in the step above.<\/p>\n<pre><code>git checkout v0.10.32\r\n<\/code><\/pre>\n<h3>Configure NodeJS<\/h3>\n<pre><code>.\/configure --openssl-libpath=\/usr\/lib\/ssl --without-snapshot\r\n<\/code><\/pre>\n<h3>Make and Install NodeJS<\/h3>\n<p>You&#8217;ll see a LOT of output in the console here &#8211; that&#8217;s expected<\/p>\n<pre><code>make\r\nmake test\r\nmake install\r\n<\/code><\/pre>\n<h3>Verify NodeJS and npm\u00a0Installation<\/h3>\n<p>To verify that the install worked correctly, the following commands should output the version of NodeJS and npm<\/p>\n<pre><code>node -v\r\nnpm -v\r\n<\/code><\/pre>\n<h4>Uninstall NodeJS (OPTIONAL)<\/h4>\n<p>If for whatever reason you need to uninstall NodeJS you can do the following<br \/>#NOTE: you need to be in the directory of your NodeJS install.<br \/>In my case, it is \/usr\/node<\/p>\n<pre><code>make uninstall\r\n<\/code><\/pre>\n<p>At this point, NodeJS and npm should be installed and ready for use. \u00a0<\/p>\n<h2>Install FabricJS and npm Packages<\/h2>\n<p>FabricJS is both a browser and NodeJS library for interacting with the HTML5 canvas. \u00a0In the browser a user can configure a canvas design. \u00a0When the design is passed to a NodeJS server, you can use the npm FabricJS, Canvas, and ImageMagick packages to quickly render out images of various sizes and qualities. \u00a0This next set of instructions will walk through how to setup and test these packages on the server. \u00a0As for coding all of this fun, that&#8217;s for another day.<\/p>\n<h3>Set Directory<\/h3>\n<p>Change to the node_modules directory<\/p>\n<pre><code>cd \/usr\/local\/lib\/node_modules\r\n<\/code><\/pre>\n<h3>Install Canvas Dependencies<\/h3>\n<pre><code>apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++\r\n<\/code><\/pre>\n<h3>Install Canvas<\/h3>\n<p><a href=\"https:\/\/www.npmjs.org\/package\/canvas\" target=\"_blank\" data-lasso-id=\"347\" rel=\"noopener\">https:\/\/www.npmjs.org\/package\/canvas<\/a><\/p>\n<pre><code>npm install -g canvas\r\n<\/code><\/pre>\n<h3>Test Canvas<\/h3>\n<p>Test to see if Canvas installed correctly<br \/>To test if Canvas installed correctly,\u00a0first run\u00a0NodeJs<\/p>\n<pre><code>node\r\ntypeof require('canvas')<\/code><\/pre>\n<p>If Canvas is installed correctly, the following will be output:<\/p>\n<pre><code>#'function'\r\n#NOTE: Ctrl+C twice will exit NodeJS\r\n<\/code><\/pre>\n<h3>Install FabricJS<\/h3>\n<p><a href=\"https:\/\/www.npmjs.org\/package\/fabric\" target=\"_blank\" data-lasso-id=\"348\" rel=\"noopener\">https:\/\/www.npmjs.org\/package\/fabric<\/a><\/p>\n<pre><code>npm install -g fabric\r\n<\/code><\/pre>\n<h4>Test FabricJS<\/h4>\n<p>Test to see if FabricJS\u00a0installed correctly<br \/>To test if FabricJS\u00a0installed correctly,\u00a0first run\u00a0NodeJs<\/p>\n<pre><code>node\r\ntypeof require('fabric')\r\n<\/code><\/pre>\n<p>If FabricJS is installed correctly, the following will be output:<\/p>\n<pre><code>#'object'\r\n#NOTE: Ctrl+C twice will exit NodeJS\r\n<\/code><\/pre>\n<h3>Install Forever<\/h3>\n<p><a href=\"https:\/\/www.npmjs.org\/package\/forever\" target=\"_blank\" data-lasso-id=\"349\" rel=\"noopener\">https:\/\/www.npmjs.org\/package\/forever<\/a><\/p>\n<pre><code>npm install forever -g\r\n<\/code><\/pre>\n<h4>Test Forever<\/h4>\n<p>Test to see if Forever installed correctly, run:<\/p>\n<pre><code>forever\r\n<\/code><\/pre>\n<p>The forever help information should display,<\/p>\n<h2>Helpful Commands<\/h2>\n<h3>Install specific npm version<\/h3>\n<p>When installing an npm package, a specific version can be chosen. \u00a0This allows you to install what version you&#8217;d like, or change from one version to another.<\/p>\n<pre><code>install -g fabric@1.1.6\r\n<\/code><\/pre>\n<h3>Global Flag<\/h3>\n<p>When installing a npm package, you can choose to install it locally or globally. \u00a0The difference is whether you are running your NodeJS application from a specific folder that the local package is installed in, or if you want a NodeJS application to be run from any directory and have access to any npm package.<\/p>\n<p>To install globally, include\u00a0the -g flag. \u00a0To install locally, do not include the -g flag.<\/p>\n<pre><code>install fabric  #local\r\ninstall -g fabric  #global<\/code><\/pre>\n<h3>List the Versions of Installed NodeJS (npm) Packages<\/h3>\n<pre><code>npm ls\r\n<\/code><\/pre>\n<h2>Resources<\/h2>\n<p><a href=\"http:\/\/monicalent.com\/blog\/2014\/06\/13\/install-node-js-on-debian-squeeze\/\" target=\"_blank\" data-lasso-id=\"350\" rel=\"noopener\">http:\/\/monicalent.com\/blog\/2014\/06\/13\/install-node-js-on-debian-squeeze\/<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Various versions of Linux have slightly different methods for installing some packages &#8211; NodeJS is one of them. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":796,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wprm-recipe-roundup-name":"","wprm-recipe-roundup-description":"","_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_post_was_ever_published":false},"categories":[51,12,52],"tags":[],"class_list":["post-786","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fabricjs","category-javascript-jquery","category-nodejs"],"jetpack_featured_media_url":"https:\/\/promincproductions.com\/blog\/wp-content\/uploads\/2015\/03\/debian-logo-555x242.png","jetpack_shortlink":"https:\/\/wp.me\/p4BbcR-cG","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/posts\/786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/comments?post=786"}],"version-history":[{"count":10,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/posts\/786\/revisions"}],"predecessor-version":[{"id":849,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/posts\/786\/revisions\/849"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/media\/796"}],"wp:attachment":[{"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/media?parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/categories?post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/promincproductions.com\/blog\/wp-json\/wp\/v2\/tags?post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}