title: How to setup a private dedicated Node.js Ubuntu Server?
body: <p>I found an old PC and i want to use it as a dedicated Node.js test machine.</p>
  
  <p>Basically i wanna write my apps on a win machine then copy them over samba to the node folder and launch them via ssh. Later, I would add an upstart script and copy it with samba to the server so that when i reboot the app starts automatically every time.</p>
  
  <ol>
  <li>What do I need to install in order to properly run Node.js apps on my network on a dedicated Ubuntu server? Here is the list I came up with, please correct me if I'm wrong. Is there anything else?
  <ul>
  <li>ssh</li>
  <li>samba (ftp or sftp should be the way to go but as it's a closed internal network and i have to access it from various os's samba is the simplest way to share files not considering security issues..most of the time i use a simple text editor)</li>
  <li>"basic ubuntu server" files?</li>
  <li>"LAMP" (?)</li>
  <li>node.js</li>
  <li>node package manager.</li>
  </ul></li>
  <li>how do i install the latest Node.js, npm, and the init files on Ubuntu server. I saw that there was no simple <code>sudo apt-get install nodejs npm</code>.</li>
  <li>What kind of script do I need to launch my apps and where do i put them (prefer native scripts)?</li>
  </ol>
  
  <p><strong>EDIT</strong></p>
  
  <p>After some testing i'm at a good point now, and here is what i did:</p>
  
  <ol>
  <li>I installed ubuntu from a minimal CD</li>
  <li>when it comes to choose the packages i selected ONLY ssh &amp; samba</li>
  <li>update the system</li>
  <li>install the dependencies that u need to run node.js</li>
  <li>install latest node from git</li>
  <li>setup samba in my case i created the folder /var/nodejs for the scripts</li>
  <li>put your testApp.js in the nodejs folder</li>
  <li>start your testApp.js from ssh. *it won't work</li>
  </ol>
  
  <p>3-update the system</p>
  
  <pre><code>sudo apt-get update &amp;&amp; sudo apt-get upgrade
  </code></pre>
  
  <p>4-dependancies</p>
  
  <pre><code>sudo apt-get install g++ curl libssl-dev apache2-utils git-core make
  </code></pre>
  
  <p>5-install node</p>
  
  <pre><code>git clone git://github.com/ry/node.git
  cd node
  ./configure
  make
  sudo make install
  </code></pre>
  
  <p>6-setup samba <code>sudo nano /etc/samba/smb.conf</code></p>
  
  <pre><code>[nodejs]
  comment = nodejs
  workgroup = WG
  security = USER
  path = /var/nodejs
  server string =Node JS
  browsable = yes
  read only = no
  writeable = yes
  create mask = 0777
  </code></pre>
  
  <p>7-testApp.js</p>
  
  <pre><code>var http = require('http');
  http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello Node.js\n');
  }).listen(80, "192.168.0.1");
  console.log('Server running at http://192.168.0.1:80/');
  </code></pre>
  
  <p>8-Now everything should run...but:</p>
  
  <p><strong>You can run nodejs only as administrator</strong> appending "sudo" in front of the launch command
  else as a normal user u don't have access to most of the ports under 1000.</p>
  
  <p><strong>A. How can i lauch my app on port 80 without using sudo?</strong></p>
  
  <p>And obviously if u launch you app with the <code>command sudo node /var/nodejs/testApp.js</code>
  if u close the terminal the app will stop.</p>
  
  <p>For that we use a init script.</p>
  
  <p>After some reading i found that <strong>upstart</strong> is natively installed in ubuntu server and it's probably the best way to launch your apps.</p>
  
  <p><strong>B. I know u need to put the script into /etc/init/ with  your appname and .conf extension.but how does that work?</strong></p>