Skip already-installed packages in âyum installâ?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
It seems that if a package is already installed, "yum install" will try to update it to the latest version. This will cause "yum install" to fail if the latest version is missing dependencies. I know that I can suppress this with --skip-broken
, but I don't want to "skip broken" in case of packages which are not already installed; in that case I want it to fail.
I have seen in this answer that I can do this using an "if" statement if I am installing just one package, but I have a "yum install" statement containing some 15 packages, and don't want to run yum
multiple times (once for each package) as this adds a lot of overhead.
How can I get yum
to only install packages if they are not already present?
yum
add a comment |Â
up vote
1
down vote
favorite
It seems that if a package is already installed, "yum install" will try to update it to the latest version. This will cause "yum install" to fail if the latest version is missing dependencies. I know that I can suppress this with --skip-broken
, but I don't want to "skip broken" in case of packages which are not already installed; in that case I want it to fail.
I have seen in this answer that I can do this using an "if" statement if I am installing just one package, but I have a "yum install" statement containing some 15 packages, and don't want to run yum
multiple times (once for each package) as this adds a lot of overhead.
How can I get yum
to only install packages if they are not already present?
yum
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
It seems that if a package is already installed, "yum install" will try to update it to the latest version. This will cause "yum install" to fail if the latest version is missing dependencies. I know that I can suppress this with --skip-broken
, but I don't want to "skip broken" in case of packages which are not already installed; in that case I want it to fail.
I have seen in this answer that I can do this using an "if" statement if I am installing just one package, but I have a "yum install" statement containing some 15 packages, and don't want to run yum
multiple times (once for each package) as this adds a lot of overhead.
How can I get yum
to only install packages if they are not already present?
yum
It seems that if a package is already installed, "yum install" will try to update it to the latest version. This will cause "yum install" to fail if the latest version is missing dependencies. I know that I can suppress this with --skip-broken
, but I don't want to "skip broken" in case of packages which are not already installed; in that case I want it to fail.
I have seen in this answer that I can do this using an "if" statement if I am installing just one package, but I have a "yum install" statement containing some 15 packages, and don't want to run yum
multiple times (once for each package) as this adds a lot of overhead.
How can I get yum
to only install packages if they are not already present?
yum
edited Nov 30 '17 at 1:53
asked Nov 29 '17 at 11:18
Kidburla
5551212
5551212
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
In the end I wrote a simple bash script yum-install-if-missing.sh
based on other answers. Not sure if there is an easier way.
#!/bin/bash
yumcmd="yum install -y"
for var in "$@"
do
if ! rpm --quiet --query $var; then
yumcmd="$yumcmd $var"
fi
done
echo "ABOUT TO EXECUTE: $yumcmd"
eval $yumcmd
It can then be executed as: yum-install-if-missing.sh packageone packagetwo
and so on.
2
Userpm -q --quiet packagename
rather than piping to grep.
â Wildcard
Nov 30 '17 at 2:02
@Wildcard thanks! this really helped me. because I was runningyum-install-if-missing.sh ... file ...
and whilefile
was not installed,file-libs
was installed, sofile
got skipped. your suggestion fixed this problem
â Kidburla
Dec 6 '17 at 16:59
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
In the end I wrote a simple bash script yum-install-if-missing.sh
based on other answers. Not sure if there is an easier way.
#!/bin/bash
yumcmd="yum install -y"
for var in "$@"
do
if ! rpm --quiet --query $var; then
yumcmd="$yumcmd $var"
fi
done
echo "ABOUT TO EXECUTE: $yumcmd"
eval $yumcmd
It can then be executed as: yum-install-if-missing.sh packageone packagetwo
and so on.
2
Userpm -q --quiet packagename
rather than piping to grep.
â Wildcard
Nov 30 '17 at 2:02
@Wildcard thanks! this really helped me. because I was runningyum-install-if-missing.sh ... file ...
and whilefile
was not installed,file-libs
was installed, sofile
got skipped. your suggestion fixed this problem
â Kidburla
Dec 6 '17 at 16:59
add a comment |Â
up vote
2
down vote
In the end I wrote a simple bash script yum-install-if-missing.sh
based on other answers. Not sure if there is an easier way.
#!/bin/bash
yumcmd="yum install -y"
for var in "$@"
do
if ! rpm --quiet --query $var; then
yumcmd="$yumcmd $var"
fi
done
echo "ABOUT TO EXECUTE: $yumcmd"
eval $yumcmd
It can then be executed as: yum-install-if-missing.sh packageone packagetwo
and so on.
2
Userpm -q --quiet packagename
rather than piping to grep.
â Wildcard
Nov 30 '17 at 2:02
@Wildcard thanks! this really helped me. because I was runningyum-install-if-missing.sh ... file ...
and whilefile
was not installed,file-libs
was installed, sofile
got skipped. your suggestion fixed this problem
â Kidburla
Dec 6 '17 at 16:59
add a comment |Â
up vote
2
down vote
up vote
2
down vote
In the end I wrote a simple bash script yum-install-if-missing.sh
based on other answers. Not sure if there is an easier way.
#!/bin/bash
yumcmd="yum install -y"
for var in "$@"
do
if ! rpm --quiet --query $var; then
yumcmd="$yumcmd $var"
fi
done
echo "ABOUT TO EXECUTE: $yumcmd"
eval $yumcmd
It can then be executed as: yum-install-if-missing.sh packageone packagetwo
and so on.
In the end I wrote a simple bash script yum-install-if-missing.sh
based on other answers. Not sure if there is an easier way.
#!/bin/bash
yumcmd="yum install -y"
for var in "$@"
do
if ! rpm --quiet --query $var; then
yumcmd="$yumcmd $var"
fi
done
echo "ABOUT TO EXECUTE: $yumcmd"
eval $yumcmd
It can then be executed as: yum-install-if-missing.sh packageone packagetwo
and so on.
edited Dec 6 '17 at 16:58
answered Nov 29 '17 at 13:51
Kidburla
5551212
5551212
2
Userpm -q --quiet packagename
rather than piping to grep.
â Wildcard
Nov 30 '17 at 2:02
@Wildcard thanks! this really helped me. because I was runningyum-install-if-missing.sh ... file ...
and whilefile
was not installed,file-libs
was installed, sofile
got skipped. your suggestion fixed this problem
â Kidburla
Dec 6 '17 at 16:59
add a comment |Â
2
Userpm -q --quiet packagename
rather than piping to grep.
â Wildcard
Nov 30 '17 at 2:02
@Wildcard thanks! this really helped me. because I was runningyum-install-if-missing.sh ... file ...
and whilefile
was not installed,file-libs
was installed, sofile
got skipped. your suggestion fixed this problem
â Kidburla
Dec 6 '17 at 16:59
2
2
Use
rpm -q --quiet packagename
rather than piping to grep.â Wildcard
Nov 30 '17 at 2:02
Use
rpm -q --quiet packagename
rather than piping to grep.â Wildcard
Nov 30 '17 at 2:02
@Wildcard thanks! this really helped me. because I was running
yum-install-if-missing.sh ... file ...
and while file
was not installed, file-libs
was installed, so file
got skipped. your suggestion fixed this problemâ Kidburla
Dec 6 '17 at 16:59
@Wildcard thanks! this really helped me. because I was running
yum-install-if-missing.sh ... file ...
and while file
was not installed, file-libs
was installed, so file
got skipped. your suggestion fixed this problemâ Kidburla
Dec 6 '17 at 16:59
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407713%2fskip-already-installed-packages-in-yum-install%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password