How Do You Install an rpm/yum/dnf Package in a Non-Stardard Location?

Problem scenario
A partition is filling up on CentOS/Stream/RHEL/Fedora Linux. You do not want to have a package be installed in /usr or some "normal" location. You want to uninstall a package and reinstall it elsewhere. But moving the directory won't work because the binary command will point to the old location. What should you do to get the destination of the installation to be something customized (and not the default directory)?

Solution
Use a yum or dnf command to install it with these two flags: --installroot=/destination/ --releasever=9

Replace "desination" with the directory you want it to be installed in (e.g., /opt/ or your own path). Replace "9" with the major RedHat version you are using. If you are unsure, run this: sudo cat /etc/*-release

This would install foobar in /opt if you were using RHEL version 9:
sudo dnf -y install foobar --installroot=/opt --releasever=9

This will create a full set of FHS directories. If you choose a location that has already been used as an --installroot, the …/repos.d/ file will be consulted for the location of the installation media. (Some people do not care for this functionality; see this posting https://bugzilla.redhat.com/show_bug.cgi?id=1708204 if you are interested.) You could move the relevant yum.repos.d directory to a yum.repos.d.bak directory. Then the normal yum/dnf/rpm repos will be used on the system. In newly created directories or any directory where the location has not already been the target of such the --installroot flag, there will be no problem. This does create many more files and takes up space.

You can see this for more information: https://linuxhint.com/install-package-to-a-specific-directory-using-yum/

How Do You Troubleshoot the Python Problem “TypeError: ‘module’ object is not callable”?

Problem scenario
You run a Python program with datetime, but you get the error "TypeError: 'module' object is not callable." What should you do?

Solution
Even though you may use "import datetime" at the top of the program, you should use "from datetime import datetime, timezone" at the top. If you used the syntax "datetime.datetime…", you will need to remove one of the "datetime." strings from the code. Such incorrect syntax will cause an error like "AttributeError: type object 'datetime.datetime' has no attribute 'datetime'" to be thrown.

Here is a program that will not throw any error (as long as you have a file named auth.log in the same directory):

import datetime
from datetime import datetime, timezone
log_reader = open('auth.log', 'r')
for line in log_reader:
    dt_of_log = datetime.strptime(line[:6], '%b %d')
    x = datetime(1900, 6, 15, 15, 17, 8, 132263).isoformat()
    print(x)

What Do the Terms Upstream and Downstream Mean in I.T.?

Question
What do the terms upstream and downstream mean in I.T.?

Answer
If a project B is downstream from project A, project B has evolved from project A. In the genealogy of software/code/projects, project A is said to be upstream to project B if project A is an ancestor of project B. Project D is said to be downstream to project C if project D is a descendant of project B.

For a detailed explanation, see https://reflectoring.io/upstream-downstream/

How Do You Troubleshoot “wine: could not exec wineserver”?

Problem scenario
You installed wine. You ran a command, but you got this:
"wine: could not exec wineserver"

What should you do?

Solution

1. Run this:

sudo find / -name wineserver64

2. Run this command but replace "/path/to" with the path to the wineserver64 file you found above:

export wineserver=/path/to/wineserver64

How Do You Run Code in the Eclipse IDE?

Problem scenario
You are using Eclipse for the first time. You try to to use Run, but you get an error message like this: "Unable to Launch The selection cannot be launched, and there are no recent launches." Or you try to go to "Run configuration" and you have a prototype, but the "Run" button is grayed out. What should you do?

Solution
In the Run configuration section, under the Java Application section on the left, is there a configuration? A prototype is not enough. Right click "Java Application" to create a configuration. Make sure the "Main" tab's "Main class" has something valid. Now the "Run" button should appear. You should be able to run code now.

What Are Some Songs During the American Revolution?

Question
What patriotic songs were written during the American Revolution?

Answer
"The Toast" by Francis Hopkinson
"World Turned Upside Down" (instrumental)
"The Liberty Song" by John Dickinson
"Free America" by Joseph Warren
"Chester" by William Billings; see also: https://en.wikipedia.org/wiki/William_Billings
"Yankee Doodle"


"My Days Have Been So Wondrous" by Francis Hopkinson. (This was written in the 1750s, but the lyrics are too appropriate to not include in the list.)

How Do You Find the JQuery Version from the Command Prompt of a Linux Server?

Problem scenario
You are using Linux, and you want to know what JQuery version is installed. What do you do?

Solution
JQuery is a library to work with Javascript. There are many ways to install JQuery: git, using a .tar.gz file, the YARN CLI, or the npm command.

If it was installed with npm, one way find out the version is to run one of these command:

npm view jquery versions
npm view jquery version
npm view jquery
npm info jquery
npm ls jquery

This solution was partially taken from this external page.

If it was installed with yarn, try one of these commands:

yarn info jquery
yarn list
yarn check jquery

For more information, you can see these postings:

https://nishitvmaheta.medium.com/how-to-install-jquery-ea182b21ce5c

https://unix.stackexchange.com/questions/288291/how-do-i-find-the-version-of-jquery-that-is-installed-on-a-linux-web-server

How Do You Troubleshoot a “File Not Found” Message?

Problem scenario
You run a command, but you get a message like "filenotfounderror", "file or directory does not exist" or something similar. What should you do?

Possible Solution #1 (assuming that the file exists)
Do either i. or ii.
i.a. Find the original file with a command like this: sudo find / -name foobar
i.b. Create a symbolic link or a hard link to the file.

ii. Does the user have access to enter and read the file in the desired directory? You may need to change the permissions or have a different user run the command.

Possible Solution #2 (assuming that the file does not exist)
Create the file (and if necessary the directory path) with nothing in it. This may get you further into the process.

Possible Solution #3 (only applies if you are using Windows)
Are the file path and/or file name very long? You may need to change the directory where things are installed or rename folders. For more details, see this Stackoverflow posting.

Possible Solution #4
See these postings: https://continualintegration.com/?s=file+not+found

Possible Solution #5
See this external website:
http://net-informations.com/python/err/path.htm

How Do You Troubleshoot the Error “flatpak … no version info or cannot open shared object file”?

Problem scenario
You open a terminal window in Linux. You get an error like one of the following:

flatpak: /lib64/libldap_r-2.4.so.2: no version information available (required by /lib64/libcurl.so.4)

flatpak: error while loading shared libraries: libsasl2.so.2: cannot open shared object file: No such file or directory

What should you do?

Solution
(This solution will work if the file is in a different location from where it was expected on your server.)
1. Find if another copy of the file exists on your server. Run a command like this (but substitute "foobar.so.3" in the follow draft of a command with the file in the error message): sudo find / -name foobar.so.3
(replace "foobar.so.3" with the file you need)

2. Back up the file /lib64/foobar to another location. You may want to run "ls -lh /lib64/foobar" to see if it is merely a link to another file; if it is a link, just delete the link.

3. Copy the other copy of the file if it exists to /lib64/. Now the problem should go away.