Development Tools Notes

General development tools setup notes about tools like: git, p4merge, eclipse, cygwin, etc.


Last Updated: December 31, 2018 by Pepe Sandoval



Want to show support?

If you find the information in this page useful and want to show your support, you can make a donation

Use PayPal

This will help me to create more stuff and fix the existent content... or probably your money will be used to buy beer


Common Development Tools Linux

  • atom

    1. Download .deb file from Atom page
    2. Install the package:
      • sudo dpkg -i ~/Downloads/atom-amd64.deb
    3. Modify keymap file
      '.editor':
          'shift-ctrl-i': 'window:toggle-invisibles
  • p4merge

    1. Download p4merge .tgz from page
    2. Uncompress and untar it:
      • sudo tar --no-same-owner --extract --ungzip --file ~/Downloads/p4v.tgz --directory /opt
    3. Create symbolic link:
      • sudo ln --symbolic /opt/p4v-.../bin/p4merge /usr/bin/p4merge

        The ... symbolize the p4v version, use the appropriate one.

  • git

    1. Install git:
      • sudo apt-get install git
    2. In ~/.gitconfig add:
      [user]
          email = j_sandoval_chavez@hotmail.com
          name = Jose Manuel Sandoval Chavez
      [merge]
          tool = p4merge
      [mergetool]
          prompt = false
      [diff]
          tool = p4merge
      [difftool]
          prompt = false
      [core]
          editor = atom --wait
  • g++

    1. Install g++:
      • sudo apt-get install g++
    2. Install latest version or specific version
      • sudo add-apt-repository ppa:ubuntu-toolchain-r/test
      • sudo apt-get update
      • sudo apt-get install gcc-5 g++-5
  • pandoc

    • Install pandoc using apt-get
      • sudo apt-get install pandoc
    • Install pandoc using .deb package
      • wget https://github.com/jgm/pandoc/releases/download/1.17.2/pandoc-1.17.2-1-amd64.deb
      • sudo dpkg -i pandoc-1.17.2-1-amd64.deb
    • Test
      • pandoc --standalone -f markdown_github -t html md_input.md -o html_output.html

Java JDK

  • java open jdk
    1. Add repo and update
      • sudo add-apt-repository ppa:openjdk-r/ppa
      • sudo apt-get update
    2. Install java using openjdk-<ver_num>-jdk format. Example:
      • sudo apt-get install openjdk-8-jdk
  • java open jdk windows
    1. go to Java SE Downloads page
      • search in google java jdk download link
    2. Look for JDK download button/option
    3. It will take you to a page to select the type of OS to download the specific JDK version (Ex. Java SE Development Kit 8u65)
    4. select your OS, accept terms, download the .exe file, run it and just use all the defaults
  • java oracle jdk
    1. Add repo and update
      • sudo add-apt-repository ppa:webupd8team/java
      • sudo apt-get update
    2. Install java using oracle-java<ver_num>-installer format. Example:
      • sudo apt-get install oracle-java8-installer
    3. Check java version:
      • java -version
    4. Selecting default versions:
      • sudo update-alternatives --config java
      • sudo update-alternatives --config javac

Eclipse

Remote System Explorer

This allows you to edit files that are on an external server on eclipse locally to be automatically uploaded

  1. Go to eclipse download page and get Eclipse IDE for C/C++ Developers
  2. Unzip it to a accessible location I usually unzip it to C:/eclipse, tin the eclipse.exe file and select a workspace location
  3. Open Remote System Explorer Perspective. go to Window -> Perspective -> Open Perspective -> Other
  4. Select Remote System Explorer
  5. Create a new connection
    1. Select SSH Only
    2. Fill Host Name (can be IP of the server)
    3. Fill Connection Name Any name to identify the connection
    4. Uncheck Verify host name option
    5. Everything else leave as it is, you can click on Finish
  6. when asked for you password use the one you use to login into that server

Install Eclipse on Linux from .tar

  1. Get tar from eclipse download page
  2. Change to the directory you download the tar.gz file and untar it into /opt folder
    • sudo tar -zxvf eclipse-cpp-mars-1-linux-gtk-x86_64.tar.gz -C /opt/
  3. Create eclipse.desktop file executing the following command:
    • sudo vim /usr/share/applications/eclipse.desktop
  4. Put the following contents on the eclipse.desktop file:

     [Desktop Entry]
     Name=Eclipse
     Type=Application
     Exec=/opt/eclipse/eclipse
     Terminal=false
     Icon=/opt/eclipse/icon.xpm
     Comment=Integrated Development Environment
     NoDisplay=false
     Categories=Development;IDE;
     Name[en]=Eclipse
  5. Install desktop file executing the following command

    • sudo desktop-file-install /usr/share/applications/eclipse.desktop
  6. Create a symlink in /usr/local/bin
    • sudo ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse
  7. If you are using Ubuntu it should now show up on the Unity Dash search results

Cygwin

  1. Install Cygwin. Recommended Packages:
    • bash-completion
    • bash-completion-devel
    • git
    • git-gui
    • git-svn
    • rsync
    • gvim
    • vim
    • vim-common
    • gnome-terminal
    • curl
    • python and python3
    • tar
    • apt-cyg
    • make
    • zip/unzip
    • cygutils and cygutils-extra
    • wget
    • openssh ssh/ssh-agent
    • findutils
  2. Install Java JDK as usual and add the following lines to your .bashrc
    export JAVA_HOME=/cygdrive/c/Program\ Files/Java/<jdh_version_here>/
    export PATH=$PATH:$JAVA_HOME/jre/bin:$JAVA_HOME/bin

Visual Studio Code

Sync files with remote system ftp-sync

  1. Install git for windows and make sure it works by doing git --version in a cmd prompt
  2. Install ftp-kr plugin in Visual Studio Code
  3. Open folder you want to sync in Visual Studio Code
  4. Click F1 to open the commands input and enter ftp-kr: Init to open the ftp-kr.json config file
  5. Fill the remotePath (Make sure a folder with the same name you put in here exists in the remote system), host, username, password,protocol and port. For example
     {
         "host": "192.168.1.94",
         "username": "myuserhere",
         "password": "mypasswordhere",
         "remotePath": "/home/jose/jms-box",
         "protocol": "sftp",
         "port": 22,
         "fileNameEncoding": "utf8",
         "autoUpload": true,
         "autoDelete": true,
         "autoDownload": false,
         "ignore": [
             ".git",
             "/.vscode"
         ]
     }
  6. Type F1 and enter ftp-kr: Upload All in the command input and you should see if uploads files in the Output, every time you save a file it should be uploaded automatically as well

Use bash as terminal on Visual Studio Code

  1. Install git for Windows

  2. Opens User Settings file (File -> Preferences -> Settings) then click on the brackets icon ({}) to open in JSON

    • To open User Settings file you can also do Ctrl+Shift+P or F1 to open the commands input and type Preferences: Open Settings
  1. On the user settings side (right-side) add to the JSON file: "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe". For example it may look like this:

    {
       "editor.detectIndentation": false,
       "files.trimTrailingWhitespace": true,
       "diffEditor.renderSideBySide": true,
       "git.autofetch": true,
       "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
       "window.zoomLevel": 0
    }
  2. (Optional) Add a .bashrc in your home (~) for your aliases and stuff, execute: cd; echo alias ll=\'ls -alF\' >> .bashrc

Notepad++ Tricks

Install a plugin

  1. Run Notepad++ as administrator (sometimes it gives problems if its not run as admin)
  2. Go to menu Plugins-> Plugin Manager -> Show Plugin Manager
  3. On the Available tab search for the wanted plugin, select it and click on the install button to install it

Useful Notepad++ Plugins

  • Explorer: plug in to have a file explorer window
  • Remote file upload NppFTP: plugin to auto-upload files
  • LocationNav: Plug in for history and track changes.
  • SourceCookifier
  • Compare: plug-in to compare files
  • JSON Viewer: plug-in to format JSON files

Set server keys and Notepad++ to auto-upload files

As an alternative to work with files on a server you can set up Notepad++ to automatically upload files to a server so you can edit them and work on Notepad++ on Windows and they can be automatically uploaded to a server.

Configure NppFTP

  1. Check if NppFTP plugin is installed or install this plugin
  2. Open the NppFTP plugin (Plugins -> NppTFP -> Show NppFTP Window)
  3. In the NppFTP window use the Settings (Gear icon) -> Profile Settings
    1. Create a new connection using the "Add New" button/option
    2. Give the connection a Name: Any text you want to identify this connection
    3. Select Connection type: SFTP
    4. Fill the Hostname, Username, Password and Initial remote directory (optional). Example:
  4. In the Authentication tab you can either select one of the two options:
    1. Check the "Try keyboard interactive authentication" option if you want to give it your password to connect and every time you start editing a file
    2. Check the "Try private key authentication" option if you plan to use a key file (see Create and Import private key instructions below), you will NEVER need to give your password
      • Once you have a key file give the path to this generated .ppk file in the "Private key file" field
        • If your key has a passphrase make sure to put it in the "Passphrase" field if not just leave this field blank.

Create and Import private key

  1. In the Linux Server (the one where the files will be automatically uploaded) execute the following commands to create the key
    `ssh-keygen -t rsa`
    cat id_rsa.pub >> ~/.ssh/authorized_keys
    chmod 600 ~/.ssh/authorized_keys

    If you already have a key you can skip the first command

  2. Copy the private key file (id_rsa file generated in the Linux Server) to your Windows machine

    I used F-Secure SHH File transfer program to connect to the server and copy the file to my Windows machine. The file is located in your home in the hidden folder ~/.ssh (in F-secure enable the hidden files option in the menu: View-> Show Hidden Files)

  3. In windows use puttygen to convert the private key to the format needed by Notepad++

    • Load the downloaded key file (File->Load private key)
    • Convert it (Conversion -> Export OpenSSH Key)
    • When asked to be saved without passphrase click 'Yes'
    • Save it to a location and give a .ppk name (I used npp.ppk)

      If you used a passphrase when generating the key with the ssh-keygen -t rsa command, puttygen may ask for it

Virtual Box Install and Config

  1. Install Virtual box.
  2. Create a folder to store everything related to the VM
    • put the .iso file there
    • create a shared folder
    • create folder for the snapshots
    • when asked to create a virtual HD create it in that location and create one of at least 64GB
  3. In the VM Configurations modify Processor, RAM, and Video Memory with values appropriate to your host.
  4. Create shared folder and check the auto-mount option
  5. Install VB Guest additions
    1. In VB "devices" menu select "Guest Additions" options.
    2. Click run when prompted. Install kernel modules if a kernel modules error occurs
      • sudo apt-get install linux-headers-$(uname -r)
    3. Add your user to the vbossf group if you have folder permissions error
      • sudo usermod -aG vboxsf $(whoami)
      • sudo adduser $(whoami) vboxsf

        We install this so full-screen mode and shared clipboard/copy-paste can work. Virtual machine needs a restsart so this can take effect.

Switch between gnome and fvwm2

  1. use ION Sessions Manager to open a session on the terminal that is opened and change to the /home directory (use cd ~)
  2. Do a ls -a or ls -lrfa to find the .xinitrc.user file. We need to edit this file.
  3. In the .xinitrc.user file look for Linux case to select either gnome or fvvm2. if you are using vim to edit this file you can use /** or **? to search.
  4. Uncomment the option you want, use # to comment out. It should look something like this:
    case Linux* :
          /usr/bin/X11/gnome
          #/usr/intc/bin/fvwm2
          #twm
      

    In this example we are selecting gnome and commenting fvwm2

  5. Sometimes you have to remove the session from the ION Sessions Manager manager and create a new session to the same server for the changes to take effect

Other commands

  1. Run eclipse as root
    • gksu eclipse

Windows Subsystem for Linux (WSL)

Enable SSH on WSL

  1. Edit /etc/ssh/sshd_config make sure to set Port (other than port 22), Host Keys, Password Auth... for example it may look like this:
#       $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 2222
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none
# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 2m
PermitRootLogin prohibit-password
StrictModes yes
MaxAuthTries 4
#MaxSessions 10

PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
AuthorizedKeysFile      .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem       sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server
  1. Generate host keys sudo ssh-keygen -A
  2. Restart SSH service sudo service ssh --full-restart
    • You may need to enable on boot sudo systemctl enable ssh or manually restarting every time
Want to show support?

If you find the information in this page useful and want to show your support, you can make a donation

Use PayPal

This will help me to create more stuff and fix the existent content... or probably your money will be used to buy beer