If you enter the IP address of this machine into the address bar of the browser after the machine with the given image is started, the control panel will appear, which will guide you to the shellinabox and webmin administration tools. You can find further information regarding these tools in the description of the TKL core image or in the particular separate manuals. The adminer tool is not available inside the given image.
However, there is n, the node.js version manager available, which allows to carry out updates, installation of a particular version or switching between particular available versions of Node.js really easily. The broader description of this utility is beyond the scope of this manual, however, we state some commands regarding the desired version of node.js in an attempt to make the process of getting up and running faster.
- The node –version command will show the currently used version of the node.js
- The n list command will list all the version of node.js available for installation
- The n <version> command will install the particular desired version of the node.js (replace the <version> string with the expression denoting the desired version)
- The n stable command will install the last stable version of node.js available
- The n latest command will install the last version of node.js available
- The n lts command will install the last long term support version of node.js available
- The n rm <version> command will uninstall the particular version of node.js (replace the string <version> with the expression denoting the desired version); it is possible to use – instead of rm
If we enter just the n command into the shell, a list of available installed versions of node.js will be shown (the currently used version is denoted by a bullet) and we can use the arrow keys to choose the version we want to use, confirming it by hitting Enter key; we can verify the successful transition to the desired version of the node.js using thenode -version command.
There is also the pm2 command available inside the given image, that is the production process manager for node.js, which allows to run and manage the particular node.js applications both manually and automatically. The pm2 service file is located in /etc/systemd/system/pm2- node.service, so that it spawns all the node.js applications located in the respective pm2 directory, after the machine is started. The official documentation of the pm2 tool is available on GitHub and on the official website . We will state only a few basic commands regarding the management of the node applications using pm2:
- The pm2 command will show the basic help of the given utility
- The pm2 list command will list the running node.js applications and basic information regarding these
- The pm2 <application> command will show the list (table) and basic information regarding the running node.js applications (replace the <application> string with the title or id of the given app)
- The pm2 show <application> command will show the detail information regarding the running node.js application (replace the <application> string with the title or id of the given app)
- The pm2 logs <application> command will show the log of the running node.js application (replace the <application> string with the title or id of the given app) in a real time; use Ctrl + c for exiting the view of the log
- The pm2 start <application> command will run the given node.js application (replace the <application> string with the title or id of the given app)
- The pm2 stop <application> command will stop the given node.js application (replace the <application> string with the title or id of the given app)
The TurnKey Linux node.js image contains all the components mentioned in the description of the TKL core version and on top of that:
- Nginx – web server, currently the version 1.10.3
- n – node.js version manager
- npm with the support for installing packages globally
- pm2 – the node.js processes and applications manager
- node.js application examples in /opt/node-examples
- the control panel of the given TKL image as a node.js application located in /opt/tklweb-cp
- Node.js modules pre-installed globally:
- pm2 – node.js process and application manager, run on boot as a systemd service
- forever – simple CLI utility for applications continual operation
- grunt – a scheduler for the planning tasks allowing for the automation of the desired tasks, such as compilation , testing, etc.
- Postfix – email server, bound to localhost
- The Webmin modules for the configuration of Postfix
- Python – programming and scripting language, currently the version 3.5.3
- SSL support
The official documentation of the TKL node.js image is available at: https://www.turnkeylinux.org/nodejs .