6

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.
mbigras
  • 289
  • 1
  • 4
  • 14
  • Also see http://askubuntu.com/q/829864/15003. – edwinksl Feb 22 '17 at 02:52
  • 2
    Possible duplicate of [What is the difference between apt and apt-get?](http://askubuntu.com/questions/445384/what-is-the-difference-between-apt-and-apt-get) – user535733 Feb 22 '17 at 03:04
  • 1
    I reference an [answer](http://askubuntu.com/a/446484/382864) to a [another question](http://askubuntu.com/q/445384/382864) in my own question. This question isn't a duplicate. It's asking specifically how to solve the problem of installing a third party package using `apt`. It also highlights confusion around the differences between `apt`, `apt-get`, and `apt-key` as well as how the config files are treated. The accepted answer @user535733 links to is essentially a copy and paste of a man page. There are some folks who enjoy and gain from specific examples. That's what this question is about. – mbigras Feb 22 '17 at 18:46
  • For reference on the issue of having questions about the same tool in different specific contexts please check out these two blog posts by [Joel](https://stackoverflow.blog/2011/01/the-wikipedia-of-long-tail-programming-questions/) and [Jeff](https://stackoverflow.blog/2010/11/dr-strangedupe-or-how-i-learned-to-stop-worrying-and-love-duplication/) – mbigras Feb 22 '17 at 18:48

1 Answers1

10

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.

muru
  • 193,181
  • 53
  • 473
  • 722