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, the effects should be seen immediately.  There is no need to log out and log back in.

If you are very conservative with security, verify you are using sudo 1.7 or higher.  Run this command to determine your sudo command version:

man sudo | grep Sudo | awk '{print $2}'

sudo -V
 # This command will also work

It is extremely unlikely, but if you have a very old Linux server or some strange configuration, your sudo could be too old for this solution.  To learn why you should be using sudo 1.7 or higher, you can research these vulnerabilities:  CVE-2005-2959, CVE-2005-4158, and CVE-2006-0151.

After Installing Jira on a RHEL Server, How Do You Access the Web UI for Jira?

Problem scenario
You installed Jira 7.x on RHEL 7.x in AWS.  You try to go to the URL to finish installing and configuring it, but the web UI does not load.  On the back-end you see that there is a service listening on port 8080 (with a sudo netstat -anlp | grep 8080 command).  You know that now AWS Security Group is blocking port 8080 from the external IP address of the server.

From the front-end you use the URL http://x.x.x.x:8080 (where x.x.x.x is the external IP address of the RHEL server) but the web browser says "Page not accessible" or "The connection was reset."  

How do you access Jira for the first time via a web browser?

Solution
Turn off firewalld or reconfigure it to allow connectivity over port 8080.  This software firewall runs by default on RHEL servers in AWS.

How Do You Install Jira on a Linux Server?

Problem scenario
How do you install Jira on any distribution of Linux (e.g., CentOS/RHEL/Fedora, Debian/Ubuntu, or SUSE)?

Prerequisite
Do you have 3 GB of RAM?  1 GB of RAM will work, but you only if you have 2 GB of virtual memory.  (With 1 GB of RAM or less and no virtual memory on the server, the installation will fail.  The catalina.out log will report an error about insufficient memory.)  If you only have 1 GB of RAM, configure 2 GB of virtual memory; see this posting for details. 

Procedures
(These directions were tested on Ubuntu 16.x, RHEL 7.x, and SUSE 12 with 1 GB of RAM and 2 GB of virtual memory.)

1.  Run these three commands:

cd /tmp
wget https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.8.1-x64.bin
sudo chmod a+x atlassian-jira-software-7.8.1-x64.bin

2.  Run this command and respond to the prompts as follows:

sudo ./atlassian-jira-software-7.8.1-x64.bin

Follow the prompts as shown below:

You wll see this prompt:
"This will install JIRA Software 7.8.1 on your computer.
OK [o, Enter], Cancel [c]"

Type "o" with no quotes and press enter.

You will see this prompt:
"Choose the appropriate installation or upgrade option.
Please choose one of the following:
Express Install (use default settings) [1], Custom Install (recommended for advanced users) [2, Enter], Upgrade an existing JIRA installation [3]"

Type "1" with no quotes and press enter.

You will see this prompt:  "Details on where JIRA Software will be installed and the settings that will be used.
Installation Directory: /opt/atlassian/jira
Home Directory: /var/atlassian/application-data/jira
HTTP Port: 8080
RMI Port: 8005
Install as service: Yes
Install [i, Enter], Exit [e]"

Type "i" with no quotes and press enter.

You will see this prompt:  "Extracting files ...
Please wait a few moments while JIRA Software is configured.
Installation of JIRA Software 7.8.1 is complete
Start JIRA Software 7.8.1 now?
Yes [y, Enter], No [n]"

Enter "y" with no quotes and press enter.

3.  When you get to a regular command prompt run this command (unless you already know the external IP address of the server):  curl icanhazip.com

4.  If you are running RHEL in AWS, turn off firewalld.  If you are running Ubuntu or SUSE in AWS, there should be no OS firewall blocking you by default.  (An AWS Security Group could always be misconfigured and cause a problem in AWS.)

5.  Open a web browser from a workstation.  Go to http://x.x.x.x:8080 (where x.x.x.x is the result of the curl icanhazip.com command above).

6.  In the web browser click "Set It Up For Me" then click "Continue to MyAtlassian"

7.  Select the License type.  We suggest "Jira Software (Server)"

8.  Enter an organization name (e.g., MySpecialEffort or Acme Inc.).

9.  For "Your instance is" check the option for "not installed yet."

10.  Click "Generate License"

11.  To the confirmation prompt, click "Yes"

12.  Enter the "Administrator account setup" information.  Enter an Email, Username and Password.

13.  After 10 or 15 minutes you will see a screen that says "JIRA is ready to go!"

14.  Click the "Let's get started" button.

15.  Choose the language for Jira.  Then click "Continue".

16.  Click "Next".

17.  Click one of these three options:  "See a project in action", "Create a new project", or "Import from another tool".   You are now done setting up Jira.

How Do You Install Jira on a Linux Server when It Is Hanging during the “Initializing the plugin system” Stage?

Problem scenario
You are trying to install Jira on Linux.  You log into the web UI to finish configuration.  The process stalls at this stage:

"    Finishing your setup

    Now sit back while we set up your JIRA instance. It will take a minute or two to complete.

    Configuring your database

    Initializing the plugin system - Don't worry, I'm still working..."

On the back-end you may notice the server's load average gets above 5.  If you are very patient and wait 30 minutes you notice it gets back down to a normal healthy level, but the web UI keeps showing the above with a circle moving near the "Initializing the plugin system..." line.

How do you get Jira to complete the installation?

Solution

Root cause
Insufficient memory.  On the back end the catalina.out file may have the word "error" near a message about insufficient memory.

Procedures
Do one of the following:

1.  Resize the VM, or upgrade the physical server, to have 3 GB of RAM.  Click here for AWS resizing directions or here for GCP resizing directions.

2.   Ensure that the server has at least 1 GB of RAM and 2 GB of virtual memory.  For directions on adding or configuring virtual memory, see this posting.

Background Information
As of 3/28/18 we found that Atlassian says that Jira, for evaluation purposes, only needs 1 GB of RAM.  

Here is the external link.  We find the posted requirements for installing Jira are not completely accurate.  We find that 2 GB of virtual memory can make the installation work with 1 GB of RAM.  In the absence of virtual memory, we were not able to install Jira on a Linux server with 1 GB or less of RAM.

How Do You Install Apache Avro?

Problem scenario
You have a Linux server (a Debian/Ubuntu, CentOS/RedHat/Fedora or SUSE distribution).  You want to install Apache Avro.  What do you do?

Solution
These directions work for any type of Linux.

#1  Do one of the following (either option A or option B).

Option A
Find the latest download from here and download it.

Option B
cd /tmp
curl http://mirror.metrocast.net/apache/avro/avro-1.8.2/avro-src-1.8.2.tar.gz > avro-src-1.8.2.tar.gz

2.  Move the file to /usr/bin/.  Run a command like this: sudo mv avro-src-1.8.2.tar.gz /usr/bin/

3.  Unpack the file.  Run a command like this:  sudo tar -xzvf avro-src-1.8.2.tar.gz

4.  If you have Python 2 use option C.  If you have Python 3, use option D.  To find your version of Python, use this:  python --version

Option C

find . -name setup.py
# change directories to the setup.py file with no "2" in a subdirectory.

Option D

find . -name setup.py
# change directories to the setup.py file with the "3" in a subdirectory.

5.  Install Avro by running these commands:

sudo python setup.py build
sudo python setup.py install

6.  Test it.  Run this command: python

# then from the Python >>> prompt, run this:

import avro

# There should be no error.

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 can Jira perform well without stalling or putting as high of server load after the installation?

Solution
The official UI library for Jira includes React components.*  Some people find that React.JS performs well without excessive CPU or RAM utilization, but others say it consumes considerable CPU and memory compared to other competing technologies.**  To some extent how the UI was customized will determine its performance.  You may want to hire a Jira expert or consult with the bulleted links below in this posting.

While we know that Atlassian documentation recommends 500 MB to 1 GB of RAM for a Jira deployment, we found that even the upper recommended minimum of 1 GB of memory is not enough.  We found Jira performs best when there is 3 GB of memory available (even if 2 GB of this is merely virtual memory).  To learn how to add 2 GB of virtual memory to your Linux server, see this posting.  If you are using AWS and you need more RAM, see this posting for directions on how to upgrade the flavor of the server while retaining the hard disk, OS and files.  If you want to add RAM to your GCP server, see this posting for directions on how to resize your server while retaining your OS and files.  

If you have ample memory available in your Jira server already, see these links for further information:

*The 3/27/18 link here indicates that the design guidelines include the Atlaskit.  The Atlaskit is described as "Atlassian's official UI library, built according to the Atlassian Design Guidelines" (taken from http://atlaskit.atlassian.com).  Furthermore this link https://atlaskit.atlassian.com/packages shows that the Atlaskit includes React components.  Thus taken as a whole we know that Jira's official UI library includes React components.  This non-Atlassian link corroborates this.

**  These four links help delve into the details of React's performance:

How Do You Troubleshoot Connecting to an RDS Instance?

Problem scenario
You created a DB instance in RDS.  You cannot connect to it.  What should you do?

Solution
1.  Make sure that it is "Available."  It could have been turned off.
2.  Click on the Instance and confirm the relevant Security Group allows you to connect to it.
3.  Click on the Instance and search for "Publicly accessible".  Make sure this is set to "Yes."  If it is set to "No" you may have to take a snapshot of the instance and launch that snapshot with the "Publicly accessible" option.
4.   If you are still having problems, try this set of directions. If there is a potential network problem, you may want to view this posting.

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.  The third variable is the incremental value (e.g., -1, 1, 2, etc.).

A range will operate with a start, finish, and an incremental value (all pertaining to zero-based lists.  The len() function gets the absolute value of the list, or the length.  When you subtract 1 from this value, you obtain the index of the last item in the list.

When range is used with one variable, (e.g., for i in range(10)), it will iterate from the 0 and increment by 1 by default.  The iteration will end after it has completed x passes where x is the number provided.  You can rewrite the default "for i in range(10)" to have the same functionality with three variables.  The default functionality of range when only one integer is passed is to implicitly have a "0," to the left and a ", 1" to the right of the number.  That is because the 0 is the starting number by default and 1 is the incremental value by default.  

Here is an example of two different (two-line) programs that have identical functionality:

range3.py:

for indexnum in range (0, 10, 1):
  print indexnum

defaultrange.py:

for indexnum in range (10):
  print indexnum

The range function can iterate starting from the rightmost item in the list and work its way backward.  To do this, use the range built-in function (and reserved word) with three parameters.  Here is an example:

coolList = [ "firstItem", "SecondITEM", "3rd Item", "4th item", "FIFTH ITEM (5)", "Sixth (6th) item"]
for x in range ( len(coolList), 0, -1 ):
  print x, coolList[x-1]