The $PATH variable does not change after installing DB2 in openSUSE - linux

I try to install DB2 in openSUSE.(success in Centos)
After installation the $PATH does not change and I can't use db2start, db2set commands.
I don't know the $PATH for DB2.
The openSUSE version: leap-42.1
The DB2 batabase version: V9.7x64
Here is my $PATH:
echo $PATH
/home/mylinux/bin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/games

DB2-specific environment variables are set by the db2profile script that is installed in the directory called sqllib in the instance home. You need to execute (source) this script to set the variables in your shell session:
$ source /home/db2inst1/sqllib/db2profile
You can also add execution of the profile to your shell .profile.

Related

dotnet-install.sh not adding dotnet command on Ubuntu

I am not a Linux user so this might be a easy fix but I have tried the following:
first I install it using the command curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin for which I get the following result:
dotnet-install: .NET Core SDK version 2.1.403 is already installed.
dotnet-install: Adding to current process PATH:
/home/<!username!>/.dotnet. Note: This change will be visible only when sourcing script.
dotnet-install: Installation finished successfully.
I do . ~/.profile to reload the profile,
but even after this when I run dotnet I get the following error:
Command 'dotnet' not found, but can be installed with:
sudo snap install dotnet-sdk`
I was expecting the script to do everything and make dotnet available.
TLDR: curl | bash can not modify PATH so it will not add dotnet to your PATH. You need to add dotnet to your path manually. Add export PATH="$PATH:/home/<!username!>/.dotnet" to your ~/.profile (or ~/.bashrc or equivalent) and log out and log back in.
Long version:
When you run a command in the shell (for example, bash), the shell tries to find an executible with the name in the all the paths listed in the environment variable PATH. PATH is generally set to something like /bin:/usr/bin. So when you type a command like curl, your shell looks in both /bin and /usr/bin for an executible file named curl.
You can see what your PATH is by doing env | grep PATH or echo $PATH.
The other important piece of information is how environment variables propagate. It's quite simple, actually:
A program (or process) can only modify its own set of environment variables.
Any child processes that a process creates inherit its environment variables.
What this means is that a program that you execute can not modify the environment variables of another random program. The shell actually provides a special command, export to set its own environment variables (and any child processes it later creates will inherit those).
Note the output at the end of step 1.
Note: This change will be visible only when sourcing script.
If you run curl | bash, it runs bash as a child process. That child process can not modify the environment variables of the program that started it (the shell that invoked curl | bash). So it can not modify PATH to add the location of dotnet to it. It even (helpfully) tells you that it can't.
In step 2, you are reloading ~/.profile. But does it contain any commands to add dotnet to PATH? I dont think so. I know the dotnet-install.sh script has not historically added it. You need to add a line like
export PATH="$PATH:/home/<!username!>/.dotnet"
To your ~/.profile (or ~/.bashrc, or equivalent) manually.
Actually, I would write it as follows to make the change more portable to other users:
export PATH="$PATH:$HOME/.dotnet"
Try running this again:
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2

Linux environment variable is not accessible in bash script run by supervisor

OS: ubuntu 14.x
Environment variable is defined at /etc/environment
export MY_VAR="Fom Xong"
my_bash.sh
#!/bin/bash
echo "My_VAR Value: $MY_VAR"
if the I run the script using ./my_bash it works perfectly.
But if given in supervisor it dont work
command = /var/www/myapp/web/bash/my_bash.sh
Any clue?

mkvirtualenv in current directory (windows)

I am working on a Windows (10) environment using command prompt. I created a project directory here c:\users\myproject. In command prompt, I type
C:\users\myproject>mkvirtualenv myenv .
virtuanenv "." already exists
If I leave out the "." at the end of the command, it creates a virtual environment in C:\users\Envs\ directory.
How do I create a virtual environment in my project directory itself?
You have to set the WORKON_HOME environment variable name and value.
The name is simply: WORKON_HOME
The value is the path where you want your virtual env directory to be created when you type mkvirtualenv venv
"venv" above is nothing special; it's just a name you choose. If you don't specify the WORKON_HOME variable, when you run mkvirtualenv venv on Windows, a directory named %USERPROFILE%\Envs where %USERPROFILE% translates to C:\Users\your.name.
See my more verbose, step-by-step answer here.
On Linux and MacOS I use the following command:
mkvirtualenv -a [full path to directory] [name of project]
I am not sure if this is the same for Windows but please give it a try and let me know.
In your example it would be:
mkvirtualenv -a C:\users\myproject myenv

How to get default installation directory for IBM MQ in linux and unix?

`I have used MQ_INSTALLATION_PATH in linux
when i execute above in the path /opt/mqm/bin via root it cannot display nothing but when i execute it in the path /opt/mqm/samp/bin it displays MQ_INSTALLATION_PATH .. before i should execute crtmqenv -p command
So what a solution to get installation path of IBM MQ?
MQ v7.1 and higher support multiple installations on the same server. The command setmqenv when sourced will setup some environment variables to allow you to use a specific installation. One of the variables that is set by setmqenv is $MQ_INSTALLATION_PATH. You can display the value of this variable with the command echo $MQ_INSTALLATION_PATH.
$ echo $MQ_INSTALLATION_PATH
/opt/mqm
If the installation has been setup as default using the setmqinst command, then various symlinks will be created under /usr/bin pointed back to the mq installation directory. You can display the installation directory by running the /usr/bin/dspmqver command and looking for InstPath in the output.
You can also directly call the command dspmqver -f 128 to have it return just the installation path:
InstPath: /opt/mqm
If the install is not setup as the default install and you do not know which directory MQ is installed in you can look at the /etc/opt/mqm/mqinst.ini file which will have a stanza for each installation on the server. The installation path is listed after FilePath= under each Installation stanza.
$ cat /etc/opt/mqm/mqinst.ini
Installation:
Name=Installation1
Description=
Identifier=1
FilePath=/opt/mqm

CDH4 JAVA_HOME Ubuntu

I have installed CDH4 in pseudo distributed mode on CentOs without any problems, but when I am installing it on Ubuntu 12.04 I am getting some errors with setting my JAVA_HOME environment variable.
I installed JDK and and have JAVA_HOME set correctly in /etc/profile.d and in ~/bash.rc using the following lines:
export JAVA_HOME=/usr/local/java/latest
export PATH=${JAVA_HOME}/bin:$PATH
I know that is redundant to define it in both places, but apparently setting it in /etc/profile.d wasn't working. From my user, when I type $echo $JAVA_HOME I get:
/usr/local/java/latest
From sudo, I run $ sudo -E echo $JAVA_HOME, I get:
/usr/local/java/latest
If you are wondering, I am specifying the -E option for sudo to preserver my environment.
So my real problem is when I am trying to start HDFS, using the following command:
for x in `cd /etc/init.d ; ls hadoop-hdfs-*` ; do sudo service $x start ; done
I get the following error:
* Starting Hadoop datanode:
Error: JAVA_HOME is not set and could not be found.
Running the same command with the -E option gives me the same result. Has anyone had this problem?
Thanks in advance.
After some research, I found the answer to my question.
I am using CDH4 and have hadoop installed in pseudo-distributed mode.
To fix my JAVA_HOME problems, I created a the hadoop-env.sh file in /etc/hadoop/conf.pseudo.mr1
The file contained the line:
export JAVA_HOME=/usr/local/java/latest
Where /usr/local/java/latest is the path to my installation of JAVA_HOME

Resources