Install & Uninstall NVM and Node.js globally in a Linux based system

Note: You should be a sudoer.

  1. Enter into root user
    $ sudo -s 
  2. Install nvm globally accessible by all the users:
    $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | NVM_DIR=/usr/local/nvm bash
  3. Install node:
    For specific version of node.js
    $ nvm install <version of node>
    eg: nvm install 10.10.0
                ——— OR ———-
    For latest version of node.js
    $ nvm install node
  4. Create a file called nvm.sh in /etc/profile.d with the following contents:
    export NVM_DIR="/usr/local/nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  5.  Install Angular CLI(Command Line Interface)
    $ npm install -g @angular/cli
  6. Install pm2 (For running on Server. Skip this step if you are doing local setup):
    $ npm install -g pm2

Uninstalling NVM follow the steps

rm -rf ~/.nvm
rm -rf ~/.npm
rm -rf ~/.bower
rm -rf $NVM_DIR ~/.npm ~/.bower

Remote Debugging Play Framework

At times it is required to debug the code, debugging can be easy with any IDE. Running a play framework app and remote debug the application is possible by attaching the process and placing appropriate break points which would hit the breakpoint when the process is attached.

Start sbt-shell

Run Command clean compile test

This would result in starting a process with PID which can be traced from the sbt-shell window

opt/jdk1.8.0_181/bin/java -agentlib:jdwp=transport=dt_socket,address=localhost:35226,suspend=n,server=y -Xdebug -server -Xmx1536M -Didea.managed=true -Dfile.encoding=UTF-8 -Didea.runid=2018.2 -jar /home/sufia/.IdeaIC2018.2/config/plugins/Scala/launcher/sbt-launch.jar idea-shell
Listening for transport dt_socket at address: 35226

[sufia@sufia informis-server]$ lsof -i:35226
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 5981 sufia 4u IPv4 668592 0t0 TCP localhost:35226 (LISTEN)

In InteliJ->Run->Attach to Process, select the PID: 5981

This would hit the breakpoint and you would be able to debug through

Upgrade Ubuntu from 16.04 to 18

If you are on Ubuntu 16.04 and need to move to 18, the following steps would help you achieve that. The upgrade is large and you would be inquired with a few questions while the up-gradation is happening.

First update the current distribution, with the following command

$ sudo apt update

$ sudo apt upgrade

This makes sure your Ubuntu is up to date. Next, upgrade the distribution of ubuntu

$ sudo apt dist-upgrade

This handles changing software dependencies with new versions of packages.

I then follow this up with:

$ sudo apt-get autoremove

This removes dependencies from uninstalled applications. You can do the same thing from the GUI desktop with the utility application Bleachbit. After that, it’s time to get things ready for the big upgrade with:

$ sudo apt install update-manager-core

Finally:

$ sudo do-release-upgrade

This will start upgrading your system to 18.04. Along the way, Ubuntu will ask you several questions about how to handle the upgrade.

Installing Protos

Type the following commands in the terminal to install protos in ubuntu

1) PROTOC_ZIP=protoc-3.3.0-linux-x86_64.zip
2) curl -OL https://github.com/google/protobuf/releases/download/v3.3.0/$PROTOC_ZIP
3) sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
4) rm -f $PROTOC_ZIP