How do I install the anaconda / miniconda without prompts on Linux command line?
Is there a way to pass -y kind of option to agree to the T&Cs, suggested installation location etc. by default?
can be achieved by bash miniconda.sh -b (thanks #darthbith)
The command line usage for this can only be seen with -h flag but not --help, so I missed it.
To install the anaconda to another place, use the -p option:
bash anaconda.sh -b -p /some/path
AFAIK pyenv let you install anaconda/miniconda
(after successful instalation)
pyenv install --list
pyenv install miniconda3-4.3.30
For a quick installation of miniconda silently I use a wrapper
script script that can be executed from the terminal without
even downloading the script. It takes the installation destination path
as an argument (in this case ~/miniconda) and does some validation too.
curl -s https://gist.githubusercontent.com/mherkazandjian/cce01cf3e15c0b41c1c4321245a99096/raw/03c86dae9a212446cf5b095643854f029b39c921/miniconda_installer.sh | bash -s -- ~/miniconda
Silent installation can be done like this, but it doesn't update the PATH variable so you can't run it after the installation with a short command like conda:
cd /tmp/
curl -LO https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -u
Here -b means batch/silent mode, and -u means update the existing installation of Miniconda at that path, rather than failing.
You need to run additional commands to initialize PATH and other shell init scripts, e.g. for Bash:
source ~/miniconda3/bin/activate
conda init bash
Related
I have a bash script which installs some software with apt-get as well as download and installs miniconda3. Later I would like to utilize conda command without restarting the shell. This script is called with sudo but for all the things related to conda I want to pose as a regular user, see below:
#!/usr/bin/env bash
# we are operating in the user's home dir
sudo -u $SUDO_USER bash Miniconda3-latest-Linux-x86_64.sh -b -p miniconda3
source [path_to_the_user_home]/miniconda3/etc/profile.d/conda.sh
sudo -u $SUDO_USER -H -s eval $(conda shell.bash hook)
sudo -u $SUDO_USER conda --version
However, I get an error that the command conda is not recognized. Interestingly, if the last line would be just conda --version then it is correctly recognised. It seems that the 2nd to last line worked for root, but not the user (which is exactly what I want)
I was trying to install Node.js on Ubuntu 16.04 with the help of the following instruction
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
I was confused to see sudo "bash -" without options specified. How it can be so?
This command line uses curl to download a script from Node's site. It then pipes it in to a new shell executed as root (thanks to the sudo), and the script contains all the actions required for installing Node.
Running Debian Stretch on an r710. Using the non-free/contrib build for driver support.
When I try to use packages that I've installed (curl, zpool, etc), I have to include the path to the package... Which is a pain when I don't always know where packages install to.
Two questions:
How do I remedy the path issue in the short term?
How do I amend Debian so that when packages are installed, their paths update/install automatically?
Just install it by:
apt install curl
or sudo apt install curl
Find where the command is stored by
which <command>
Either you can try run curl from the output above for example /usr/bin/curl then try execute this:
/usr/bin/curl
For a temporary fix until you solve the real problem you can do:
cd /usr/local/bin; ln -s $(which curl) curl
Or you can just set an alias:
echo "alias curl='$(which curl)'" >> ~/.bashrc; . ~/.bashrc
Troubleshoot your problem:
Check so PATH folder has the correct paths exported:
printf "%s\n" $PATH
Modify current PATH
Use the export command to add new paths and see if that works you can then update your ~/.bashrc or ~/.bash_profile, but first you can try in shell without adding it permanent to $PATH
export PATH=$PATH:/missed/bin/folder
To format your PATH variable for easy viewing in future you can add below function to your .bashrc
function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}
I'm trying to install anaconda in my own docker container with a bash script. The problem is there's a license agreement that you need to hold down a key to agree to, and the length of which depends on your terminal window size. Is there any way to get around this so that I can run Anaconda3-5.1.0-Linux-x86_64.sh from start to finish from another bash script?
I tried echo "\n\n\n\n\n\n\n" | ./Anaconda3-5.1.0-Linux-x86_64.sh, but this only works when the installer asks for an Enter key press the very first time.
bash ./Anaconda3-5.1.0-Linux-x86_64.sh -b -p $HOME/anaconda3
-b — Batch mode with no PATH modifications to ~/.bashrc. Assumes that you agree to the license agreement. Does not edit the .bashrc or .bash_profile files.
-p — Installation prefix/path.
-f — Force installation even if prefix -p already exists.
ref: https://docs.anaconda.com/anaconda/install/silent-mode/#linux-macos
Try the yes command.
yes | ./Anaconda3-5.1.0-Linux-x86_64.sh
As for your question
What if the last option is asking if I want to install Visual Studio
Code, which I'd like to answer no to?
Try this
yes no | ./Anaconda3-5.1.0-Linux-x86_64.sh
Or replace "no" with whatever you feel is the appropriate response.
It seems you've already found the -b flag,
but for reference,
here is small, complete scrip
that installs anaconda in $HOME/anaconda3.
#!/usr/bin/env bash
_anaconda_version=2020.02
_anaconda_file="Anaconda3-${_anaconda_version}-Linux-x86_64.sh"
cd
rm -f ${_anaconda_file}*
rm -rf anaconda3/
wget https://repo.anaconda.com/archive/${_anaconda_file}
bash ${_anaconda_file} -b
echo "y" | conda update --all
rm ${_anaconda_file}
unset _anaconda_version _anaconda_file
Using a ubuntu 16.04 what I do is :
Download the .sh script using wget https://gist.githubusercontent.com/...
Turn the .sh file executable sudo chmod guo+x sysInit.sh
Execute the code through sudo ./sysInit.sh
I was wondering if it is possible to run the code directly from the web.
Would be something like: sudo ./ https://gist.githubusercontent.com/....
Is it possible to do that?
You can use cUrl to download and run your script. I don't think its installed by default on Ubuntu so you'll have to sudo apt-get install curl first if you want to use it. To download and run your script with sudo just run
curl -sL https://gist.githubusercontent.com/blah.sh | sudo sh
Be warned this is very risky and not advised for security reasons. See this related question why-using-curl-sudo-sh-is-not-advised
Yes, it is possible using curl and piping the result to sh.
Try the following command.
curl https://url-to-your-script-file/scriptFile.sh | sh
No, sudo only works from a command line prompt in a shell