Apache Spark on EC2. Environment Variable problems. Mac OSX - macos

I am following the tutorial found here to get a Spark Cluster up and running. I am using a Mac OS 10.9. I am new to using a Mac. When attempting to launch the cluster I get an error:
ERROR: The environment variable AWS_ACCESS_KEY_ID must be set
I don't fully understand environment variables etc. I thought I had created a .bash_profile in my home directory but it wasn't the case, as my home directory (~) is not where it should be. As such I located .profile and .bashrc & I know I need to edit one of them however, I can't. I consistently get Access Denied. I'm pretty stumped on what to do next. Any help would be greatly appreciated.

You can create your environment variables in bash like:
export AWS_ACCESS_KEY_ID=accesskeyhere
export AWS_SECRET_ACCESS_KEY=secretkeyhere

Related

How do I execute a bash script once a specific anaconda environment is activated

I would like to for a bash script to run automatically once a specific anaconda environment is activated.
Is there a file that behaves like a bashrc for the enviroment?
I tried to look at the files in the /opt/anaconda3/envs/ENV_NAME/ folder, but I wans't able to locate a file that would be excetued every time an environment is activated.
Thank you!
E

Environment variable not getting set in Mac osx

I usually set environment variables in ~/.bash_profile in my Mac. something like:
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=$PATH:$JAVA_HOME
export M2_HOME=/opt/mvn3.3.3
export PATH=$PATH:$M2_HOME/bin
This works fine for me.
I have recently installed Anaconda from continuum. I happened to have installed it only for my own account. Thus, the environment variable which I am trying to set is like:
export PATH="/Users/<username>/anaconda/bin:$PATH"
but this is not working.
If I export the same variable for terminal session then I can access the commands for that session in terminal. I think the problem is that Anaconda is being installed only for specific user. Please help.
Do I need to re-install it for all the users?
Can not we set an environment variable pointing to a particular user's path?
The bash_profile is for the same user, then why it is not working?

Bash for Windows doesn't see environment variables

I'm trying to setup my React-Native application under Bash for Windows. Everything was going fine so far but when I tried to launch react-native run-android, I got an error ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.. I checked PATH variable that bash sees by executing env|grep PATH and it's definitely not my Windows variable.
Is there a way to make Bash for Windows get environment variables from Windows? I believed that's a default behavior as tutorials (like this one) mention nothing about it.

Why when i restart the shell, java is unavailable?

I have installed java 1.7 on my mac, and I have edited ~/.bash_profile as the following:
export JAVA_HOME=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Content s/Home
export PATH=${JAVA_HOME}/bin:$PATH
When I execute source /.bash_profile, the java become available. But when I restart the shell, I got the following error message:
No Java runtime present, requesting install.
I have to re-execute source /.bash_profile to make it available.
I am so confused, hope someone can help me.
It is because variables you export are only valid in the current ssh session.
Look here for deeper explanation:
Mac OS X 10.9 - setting permanent environment variables
As #trojanfoe stated there:
The .bash_profile is only executed for a login-shell, whereas .bashrc
is executed for every new shell instance
Check this posting out please. I don't believe your problem is a JAVA problem but it looks rather misunderstanding on BASH side.

Stardog Command not found

I am trying to get to install stardog on mac 10.8.5 using the instructions provided at http://docs.stardog.com/quick-start/.
The export path particular directory has been created and for which echo’ed to make sure that environmental variable is set up. The license key that is provided is also in the correct directory. When I try to run “$ ./stardog-admin server start” the command is not recognized. So I tried to create an export PATH to stardog’s bin, which did not work either.
I have also tried manually adding the path in the following:
- ~/.bash_profile
- ~/.profile
Still no luck, any ideas?
Using zsh I had a similar problem. For some reason, the docs suggest that from the stardog-directory-name directory you can run the command, but it didn't work until you cd into the bin directory. Once there ./stardog-admin server start should run correctly.
It sounds like you simply have something incorrect in your .bash_profile or .profile. If you run either of the stardog scripts from it's bin directory, it will work. If you're getting a command not recognized error, that sounds like bash cannot find the stardog-admin script.

Resources