How Do You Install a C Compiler on Linux?

Problem scenario
You want to program in the C programming language on a Linux server.  How do you code in C and test your programs?

Solution
Overview

Install the C compiler.

Procedures
1.  To find your distribution of Linux run this command:  cat /etc/*-release | grep -i pretty

2.  Find the one option of the below three that applies to your Linux:

  • For a Red Hat distribution (e.g.,

How Do You Use “sudo npm” or “sudo node” Commands?

Problem scenario
You run “sudo npm” or “sudo node” and you get “command not found” error messages.  What should you do?

Solution
Modify the /etc/sudoers file.  Find the stanza with secure_path.  Append “:/usr/local/bin” (with no quotes) to the line.

Here is an example of how the stanza should look (it is often on line 80 of /etc/sudoers):

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

Once the /etc/sudoers file has been saved,

What Can Be Done to Enhance the Reliability and Performance of a Jira Server?

Problem scenario
You find that your Jira is very slow and sometimes stalls or hangs when it is being used.  The Linux back-end of the Jira server shows considerable CPU and memory constraints.  When Jira is up on the back end you use the Linux “top” command, you find that the CPU and RAM are being heavily utilized.  You want to optimize the system for improved performance. 

How Does Python’s Range Function Work When Three Parameters Are Passed?

Problem scenario
You see this line of Python code:  for x in range ( len(coolList), 0, -1 ): print x
You are curious how that works and what that syntax means.

Answer
The first of the three parameters is the integer that corresponds to the starting number of the iteration.  The second variable is the range position that will terminate the iteration of the range function. 

How Do You Upgrade Python 2.6 to Python 2.7 on CentOS 6?

Problem scenario
On your Linux CentOS 6.x server you run “python –version” and find that Python 2.6 is installed.  You want Python 2.7 to be installed instead.  You do not want to use binaries (e.g., .rpm packages) or yum repositories. What do you do?

Solution
Run these commands:
curl -k https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz > Python-2.7.14.tar.xz
sudo mv Python-2.7.14.tar.xz /usr/bin/
cd /usr/bin/
sudo tar xf Python-2.7.14.tar.xz
cd Python-2.7.14
sudo ./configure –prefix=/usr/local
sudo make &&

How Do You Write Your Own Custom, Importable Module in Python?

Problem scenario
You want to build your own Python module.  You want this module to be able to be imported on your Linux server with Python (e.g., with “import contint”).  How do you write such a module?

Possible Solution #1
Write a .py file for the module, and place it where Python will look.  To find the location run these three commands:

python

import sys

print(sys.path)

# This command above will display directory paths for your .py file (the module that will be able to be imported).

How Do You Troubleshoot the Spark-Shell Error “A JNI error has occurred”?

Problem scenario
You run spark-shell in a Debian distribution of Linux (e.g., Ubuntu) but you receive this error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 64
        at java.util.jar.JarFile.match(java.base@9-internal/JarFile.java:983)
        at java.util.jar.JarFile.checkForSpecialAttributes(java.base@9-internal/JarFile.java:1017)
        at java.util.jar.JarFile.isMultiRelease(java.base@9-internal/JarFile.java:399)
        at java.util.jar.JarFile.getEntry(java.base@9-internal/JarFile.java:524)
        at java.util.jar.JarFile.getJarEntry(java.base@9-internal/JarFile.java:480)
at jdk.internal.util.jar.JarIndex.getJarIndex(java.base@9-internal/JarIndex.java:114)
        at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9-internal/URLClassPath.java:640)
        at jdk.internal.loader.URLClassPath$JarLoader$1.run(java.base@9-internal/URLClassPath.java:632)
        at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
        at jdk.internal.loader.URLClassPath$JarLoader.ensureOpen(java.base@9-internal/URLClassPath.java:631)
        at jdk.internal.loader.URLClassPath$JarLoader.<init(java.base@9-internal/URLClassPath.java:606)
        at jdk.internal.loader.URLClassPath$3.run(java.base@9-internal/URLClassPath.java:386)
        at jdk.internal.loader.URLClassPath$3.run(java.base@9-internal/URLClassPath.java:376)
        at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
        at jdk.internal.loader.URLClassPath.getLoader(java.base@9-internal/URLClassPath.java:375)
        at jdk.internal.loader.URLClassPath.getLoader(java.base@9-internal/URLClassPath.java:352)
        at jdk.internal.loader.URLClassPath.getResource(java.base@9-internal/URLClassPath.java:218)
        at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:463)
        at jdk.internal.loader.BuiltinClassLoader$3.run(java.base@9-internal/BuiltinClassLoader.java:460)
        at java.security.AccessController.doPrivileged(java.base@9-internal/Native Method)
        at jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(java.base@9-internal/BuiltinClassLoader.java:459)
        at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@9-internal/BuiltinClassLoader.java:406)
        at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:364)
        at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:184)
        at java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:419)
        at sun.launcher.LauncherHelper.loadMainClass(java.base@9-internal/LauncherHelper.java:585)
        at sun.launcher.LauncherHelper.checkAndLoadMain(java.base@9-internal/LauncherHelper.java:497)

How do you solve this?