So I understand that the "right way" to get google chrome is to simply hit the button to download and install it from their web page. That said I like the idea of having all my basic setup requirements in a script so that if I ever have to start on a fresh install of Ubuntu I can simply run that script and have all my favorite software. That said when I took the bash commands listed here and put them in a script (as seen below) running the script as sudo user did not result in google-chrome-stable installing... What gives?

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update 
apt-get install google-chrome-stable -y

I ran the script by typing it's fully qualified location into the terminal.

  • How did you run your script? What commands did you use to run it? You could be missing a shebang in your script. – edwinksl Sep 23 '16 at 8:09
  • 1
    What happened when you ran the command? What errors did you see? Please edit your question and clarify. And why are you using sh -c ' echo . .. instead of just echo ...? – terdon Sep 23 '16 at 8:36

Try this.

cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb

If you get errors, use sudo apt-get -f install

  • The trouble is that I have already installed it at this point by jsut bashing the commands through terminal rather than running the script, I am really just trying to better understand why it didn't work as is. The Nuances between writing something line by line into the terminal and having the same the verbatim in a script are still a bit beyond me. Thanks for the input though! I'm curious, why do you think changing directory would help? I didn't think any of those commands were sensitive with the present working dir... – kpie Sep 23 '16 at 8:05
  • What error did your script give? How did you run it? Can't give much thought without knowing those. I didn't realize that you were trying to install it via script, my answer was for classic shell installation. – Mustafa Yılmaz Sep 23 '16 at 8:21
  • No errors, I ran it and nothing happened. – kpie Sep 23 '16 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.