Answer the question
In order to leave comments, you need to log in
How to properly install NodeJS on Ubuntu 14.04.03 LTS server?
Instead of an epigraph:
This note is a cheat sheet on the competent installation of NodeJS on the server for people who, like me, practically understand nothing not only in programming, but also in Linux as such. But we will try to reduce your communication with Linux to literally poking one single button, at least until you get comfortable.
It is compiled using answers not only from the Toaster community, but also from the Linux community as a whole, Google and personal practice.
In particular, they helped me: lem_prod , Anton Ulanov , inf (the list will be expanded as we work on the cheat sheet)
The current version of the cheat sheet: (v. 0.0.9)
As a person just starting to learn nodejs and rather superficially familiar with Linux, I, in particular, did not find ANY mention of how to install NodeJS step by step and easily on an Ubuntu 14.04.03 LTS server.
A short list of issues I've encountered and some of which I'm currently digging around like crazy:
Q: Is it possible to create a project folder in a separate folder in Linux?
O: Yes. In general, as I understand it - even desirable.
Q: Is it necessary (if there is a python 2.7 in the system, for example) to set for the node apt-get install python-software-properties
?
A: No, if you use the current cheat sheet.
Q: Do I need to do it apt-get install npm
if it is considered to be ALREADY included in Nodejs?
O:No, this cheat sheet gives you the fifth version of Noda, which already includes npm.
Q: Why, when I try to install apt-get install express
, does the system tell me what it needs apt-get install node-express
and is it the same as expressjs?
A : Q
: What SPECIFIC folders does the node itself and its modules fall into? Is it necessary for them to define a specific installation path relative to the place that is prepared for the project (it is obvious that it is not worth doing the project in the folder with the node itself, here we will omit at least part of the CEP)?
A :
Q: Is it necessary in EVERY folder (for example, if there is a folder in the myapp folder, a folder for a separate chat is created), being in it to speak the console npm install --save
?
O:
These, and a huge number of other questions arise before beginners. Yes, most will ask even more questions. For example -
"Why do you need to deploy the project immediately on a server in the network? Isn't it easier to do everything on your computer?"
useradd vasya
// Let's agree with you that we perform all further operations on behalf of a simple user Vasya Pupkin, which we will create on behalf of the root. sudo apt-get update
// This will update the update source lists for the server. sudo apt-get ugrade
// Let's update the server! sudo apt-get install htop
// Very handy to see processes, memory consumption and so on. we write in the console htop
and use it. sudo apt-get install mc
//A very handy file. We want to use - we write in the console mc
. curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
apt-get install -y nodejs --save
npm install -g supervisor --save
// Install the module that tracks changes in the files and folders of your project. npm install -g forever --save
// Install a module that allows you to create/(re)launch the main file (for example, the same app.js)npm install -g express-generator --save
// Install a template engine that expands the project with primary folders. Answer the question
In order to leave comments, you need to log in
- is it possible to create a project folder in a separate folder in linux?of course the node variable is global
- is it necessary (if there is a python 2.7 in the system, for example) to install apt-get install python-software-properties for the nodedon't know, but why?
- do I need to install apt-get install npm if it is considered to be ALREADY included in nodejsNo
- why, when I try to install apt-get install express, the system tells me that it needs apt-get install node-express and is it the same as expressjsexpress is installed via npm: sudo npm install -g express
- what SPECIFIC folders does the node itself and its modules fall into? Is it necessary for them to determine a specific installation path relative to the place that is prepared for the project (it is obvious that it is not worth doing the project in the folder with the node itself, here we will omit at least part of the CEP)I don’t remember, now I’m sitting under Windows, I won’t say, but in fact it doesn’t matter, look at the first releases of Kantor’s screencast on the node, he explains well how modules are searched and how to organize the structure
I put it quite simply
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
I currently prefer to score on apt and install from raw. The inertia of Noda and Debian is generally a different level of things.
$ cd /usr/local/src
$ wget http://nodejs.org/dist/v5.7.0/node-v5.7.0.tar.gz # <= latest version here
$ tar -xvzf node-v5.7.0.tar.gz
$ cd node-v5.7.0
$ ./configure
$ make
$ sudo make install
$ which node
$ node -v
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question