Ubuntu – Install google-chrome-stable with apt on 16.04

aptgoogle-chromepackage-managementsoftware installation

I'm learning about the differences between apt and apt-get.

I read another answer that they are essentially the same but apt aims at providing a more pleasant user experience. Also from reading the wiki it sounds look both tools use the same repositories.

The list are repositories are available in the following etc file:

/etc/apt/sources.list

Running the following apt command seems like another way to simply open that file in a text editor like vim:

sudo apt edit-sources

Now, I'd like install the google-chrome-stable package. But my goal is to take this as a specific example to help me:

  • Learn more about how package management works with on Ubuntu 16.04
  • Be able to use apt for all my package management needs
  • Be able to translate apt-* commands into apt commands

I'm pretty sure the main problem is the google-chrome-stable package lives in a third party repository which isn't inside my /etc/apt/sources.list file by default. Also, I think both apt and apt-get share the same config file. Is this right?

I found a blog post that describes how to go through the installation process with apt-get:

Setup key with:

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 

Setup repository with:

sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'

Setup package with:

sudo apt-get update 
sudo apt-get install <package name>

where is the name of the package you want to install.

How would I do the same thing with the apt command? For example, I see they're apt-key and apt-get, are there corresponding commands with apt?

Edit:

Please refer to the comments below and these two blog posts by Joel and Jeff to learn more about asking specific questions about tools that have been generally asked about.

To add two examples illustrating that this question is more specific:

  • Go to the linked question and ctrl-f for config file. There will be zero results, while in this question and answer you will find several occurrences.
  • Go to the linked question and ctrl-f for apt-key. There will be zero results, while in this question and answer you will find several occurrences.

Best Answer

apt and apt-get share the same config files. apt-key is a separate command, apt doesn't have any of apt-key's functionality. The steps from the blog post will remain the same, except that you can replace apt-get with apt for the last two commands.

It might be easier to just download the Google Chrome package from its website, and then install it using:

sudo apt install ./google-chrome-stable_current_amd64.deb

Chrome's package adds both the key and the repository, so I think this is the simplest way. Note that this wouldn't be directly possible with apt-get, since apt-get doesn't support installing deb files directly, and if you used dpkg, you'd have to run apt-get install -f later to fix dependency issues.

Related Question