Installing Node.js on Linux from Binaries

  1. Download Node.js binaries

    Node.js binaries are available at nodejs.org. You can download the more stable LTS version or Current version with the latest features.

  2. Extract the download binary files

    You can either first extract the binary files to a temporary directory, then copy them to the /usr/local directory; or extract the files right into the /usr/local directory.

    1. Extract to temporary folder, and then copy the files to /usr/local folder.

      # cd temp
      # tar -xvJf ~/downloads/node-v7.2.0-linux-x64.tar.xz
      # cd node-v7.2.0-linux-x64
      # sudo cp -R . /usr/local
      
    2. Extract directly into the /usr/local folder. First change directory to /usr/local, and then issue the tar command.

      # sudo tar --strip-components=1 -xvJf ~/downloads/node-v7.2.0-linux-x64.tar.xz
      
  3. Check Node.js installation
    # node -v
    v7.2.0
    
  4. Check npm installation
    # npm version
    { npm: '3.10.9',
      ares: '1.10.1-DEV',
      cldr: '30.0.2',
      http_parser: '2.7.0',
      icu: '58.1',
      modules: '51',
      node: '7.2.0',
      openssl: '1.0.2j',
      tz: '2016g',
      unicode: '9.0',
      uv: '1.10.1',
      v8: '5.4.500.43'
      zlib: '1.2.8' }
    

apt-get Behind a proxy server that requires authentication

Create a new file in the /etc/apt/apt.conf.d

for example: create the file 80proxy with

sudo nano /etc/apt/apt.conf.d/80proxy

and add the following lines to configure the proxy setting:

Acquire::http::Proxy "http://<username>:<password>@<proxy IP>:<port>";
Acquire::https::Proxy "http://<username>:<password>@<proxy IP>:<port>";
Acquire::ftp::Proxy "http://<username>:<password>@<proxy IP>:<port>";

Install JDK 1.8.0_74 in Linux

This is for 64-bit installation.

  1. Download JDK from Oracle site
    http://www.oracle.com/technetwork/java/javase/downloads
    The installation file I use is jdk-8u74-linux-x64.tar.gz.
  2. Change directory to install the JDK code in /opt
    cd /opt
  3. extract the JDK files
    sudo tar -xvzf <location of downloaded JDK>/jdk-8u74-linux-x64.tar.gz 

    This will put the JDK into the newly created directory named jdk1.8.0_74

  4. Update environment variables to point to the newly installed JDK by editing the /etc/environment file.
    sudo nano /etc/environment

    Add the JAVA_HOME variable, and add JDK bin to the PATH variable.

    JAVA_HOME="/opt/jdk1.8.0_74"
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk1.8.0_74/bin" 
  5. Refresh the environment variable.
    source /etc/environment
  6. Verify that the updated environment variables are in place and the path to the JDK is valid
    $ echo $JAVA_HOME
    /opt/jdk1.8.0_74
    $ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/jdk1.8.0_74/bin
    $ javac -version
    javac 1.8.0_74
  7. Update Java alternative list. You want to set a higher priority for the new JDK. On my system this is the result when I query the alternatives:
    $ update-alternatives --verbose --query java
    Link: java
    Status: auto
    Best: /usr/lib/jvm/java-6-openjdk/jre/bin/java
    Value: /usr/lib/jvm/java-6-openjdk/jre/bin/java
    
    Alternative: /usr/lib/jvm/java-6-openjdk/jre/bin/java
    Priority: 1061
    Slaves:
     java.1.gz /usr/lib/jvm/java-6-openjdk/jre/man/man1/java.1.gz
    

    So, let’s make the new JDK our default…

    sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_74/bin/java 18074

    The response is:

    update-alternatives: using /opt/jdk1.8.0_74/bin/java to provide /usr/bin/java (java) in auto mode.

    Now, when you type java -version, you will see

    java version "1.8.0_74"
    Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)
  8. Likewise, set the new Java compiler as default with

    sudo update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_74/bin/javac 18074
  9. If you are running Firefox, you can go on to link the new JRE plugin to your Mozilla plugins folder. See my other post on how to activate the JRE plugin for Firefox.

Changing Display Font in elementary OS’s pantheon Terminal

Edit the font property in the org.pantheon.terminal.settings schema. For example:

gsettings set org.pantheon.terminal.settings font 'DejaVu Sans Mono'

Then close and reopen the terminal for the change to take effect.

You can find the correct font name with the following command:

fc-list | cut -f2 -d: | sort -u