On some Centos VMs, I have a few MySQL packages to remove (via yum) and then install MariaDB (via rpm), all in a shell script. I use yum for removal:
yum remove -y mysql-community-client yum remove -y mysql-community-release yum remove -y mysql-community-libs yum remove -y mysql-community-common Now, on some VMs, maybe the client package is not installed, so yum says:
No Match for argument: mysql-community-client Determining fastest mirrors Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was 14: PYCURL ERROR 7 - "couldn't connect to host" I know that connection failure is because of our FireWall and such.
My question is:
Can yum be told to ignore missing packages?
Or at least simply fail with No Match for argument, without connecting to mirrors and such?
Question title refers to the fact that yum remove -y mysql-community-client followed by yum remove -y mysql-community-client will make it connect to mirrors, whereas I want it to say "package uninstalled" followed by "package already uninstalled".
Rephrasing the problem: Issue is not with RPM ( I only mentioned that for completeness of my problem ), the problem is with yum. yum remove X will remove X, if it is installed. If it is not installed, it will search in the mirrors which I want to avoid. I want yum to say "X not installed" and exit.
yum list | grep mysqland if it showsmysql, then only callyum remove....