12

I've seen two ways to install packages,for example,squid on CentOS:

1.yum -y install squid

2.yum install squid

can anyone tell me what's the difference between them ? also, I'm using CentOS v.6.6

Vakho Akobia
  • 304
  • 1
  • 3
  • 13
  • For some reason on CentOS 7 the following command show "Loaded plugins:..." and exits `type -P git >/dev/null || sudo yum -y install git`. But it works if I put `-y` after install or in the end. – Winand Aug 24 '23 at 11:33

2 Answers2

20

If you supply -y it automatically chooses "yes" for future questions, i.e. are you sure you want to install squid? [Y/n]?.

It is handy if the installation takes a long time and asks multiple questions, which happens when you install multiple programs at once. In that case, having to type enter every now and again for the process to continue can be annoying.

For a full list of yum options and their definitions take a look at the help message for yum:

yum -h
Brian D
  • 2,570
  • 1
  • 24
  • 43
jmd_dk
  • 12,125
  • 9
  • 63
  • 94
5

With -y option, yum will install specified package along with its dependent package without asking for confirmation.

Without -y option, yum will show information related to specified package and its dependent packages and will ask for confirmation to install.

-y option will be useful if package is going to be installed through some scripts.

Vikas Sachdeva
  • 5,633
  • 2
  • 17
  • 26