Does CentoOS/Yum restart services after updating them with yum? - centos

Simple enough question. When I run yum update on a CentOS box, do I need to manually restart mysqld, httpd, ... and so on if they have been updated, or do they get restarted automatically?
Does anyone know where to find a source to back this up?

It depends on what's in the %post scripts of the .spec file for each package.
Generally, they don't always do so as I recall.
httpd at least does; see http://pkgs.fedoraproject.org/cgit/httpd.git/tree/httpd.spec?id=ea6aac8abd84867119fd84a057daceb75e160bc1 and take a look at the %posttrans scriptlet.
Looks like that was added in Fedora 10: http://pkgs.fedoraproject.org/cgit/httpd.git/tree/httpd.spec?h=f10
because of this bug: https://bugzilla.redhat.com/show_bug.cgi?id=491567

Related

How I can open pgadmin4 in fedora 36?

Good evening people, I am trying to install pgadmin4 on fedora 36, I followed all the steps in the documentation and pgadmin4 and its dependencies were installed correctly but I do not know how to start it, or open it and it does not let me configure it on the web because I do not create the directory described in the final step to configure the web version.
I had the same problem. I solved it installing pgadmin4 from linux-pachages
https://linux-packages.com/fedora-36/package/pgadmin4-qtx86-64
I followed the same instructions but mistakenly changing "yum" to "dnf" out of force of habit. I found I got an install out of it which seemed OK at a glance, but it was just documentation and not an executable, and there was no shortcut added to run pgAdmin. Perhaps you might have inadvertently done something similar? After uninstalling, I tried again using "yum" exactly as documented and the latest executable installed without any issue. So the steps to install that would work for me were as follows. (Desktop version in my case.)
sudo rpm -e pgadmin4-fedora-repo
sudo rpm -i https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/pgadmin4-fedora-repo-2-1.noarch.rpm
sudo yum install pgadmin4-desktop
The QT workaround also mentioned as an answer worked for me, but I wanted to avoid that since it is an earlier release (6.9) than the current 6.11, isn't officially supported and fires a warning about that every time on start up saying some functionality may be missing, which is not good for clients to see potentially in my case.
Same problem - couldn't open it after installing. You have to install pgadmin4-desktop not pgadmin4.

VSCode is not installed although I use the recommended rpm way - Fedoa 29

I use the described way for Fedora 29 but when I type sudo dnf install code I receive a long list of - nothing provides and , for example libgconf-2.5.4 (64 bit) ...etc etc.
I have tried to use nogpgcheck, but that also does not work.
If it is relevant when it starts after dnf check-update it says Failed to set locale, defaulting to C.UTF-8
I have previously installed VSCode on this laptop but then when I wanted to use another file, using File the path is shown a the top but there is no list of files. I then deleted VSode from the laptop and now I cannot install it again.
Thank you for your attention. I am awaiting your answer, thank you.
James Gibbens
So, I use Fedora, and I always do it like so:
Go to: https://code.visualstudio.com/docs/?dv=linux64_rpm (hopefully this triggers a download for you)
Then I just double click to install, through nautilus. That works like a charm for me. You should also be able to do sudo dnf install code-*.rpm in the command line, but I tend not to bother since I'm running gnome and chrome anyway, so it's pretty seamless to just use the UI provided.

How can i install two different version perl on my linux?

I have a Linux server, and it has its own Perl whose version is not what I want. So I want to install another Perl on it.
I tried to solve it with Perlbrew, but my server can't download it. It seems like my server does not trust that website address. And I don't know whether I should download it as root. Besides, I think there is a huge difference between root and a normal user to download and install it, and I just want do it as a normal user.
Is there another way install different version Perl on my server?
I downloaded the version I want before, and I tried to install it in a usual way, but it just failed.
Here is the wrong when I tap the command
wget -O - https://install.perlbrew.pl | bash as a normal user.
Maybe I should tap it as root?
And when I try to install the Perl v5.8.8(this is version I want) in ~/bin,i run the Configure.
But I can not run make after that, it just told me that make:No rule to make target , needed by miniperlmain.o Stop.
Besides,
my Linux is Centos 7.4. I don`t how to fix it.
It seems that I find a way to let me to make.
Here is the link.
After I edit the makedepend.SH, I run make again. But I got this wrong:
The thing is really weird. Why Perl V5.8.8 is so difficult to install.
The easy answer is 'just install perl' - it'll drop by default into /usr/local/bin, and you can just use that instead.
DON'T overwrite /usr/bin/perl, as that's a recipe for pain. (Lots of stuff will have dependencies on perl versions installed via your package manager).

Configure dependencies in RPM

I have built a RPM-package for Centos 6.6 that is installed on a machine of our customer.
This package contains our own software, customized for the specific use case, but also uses the open-source package HAProxy.
HAProxy (RPM-version 1.5.4-2.el6_7.1) comes with a default-configuration in /etc/haproxy/haproxy.conf and it cannot be customized without changing this file.
But I want the configuration to be part my generated package. RPM throws an error if the /etc/haproxy/haproxy.conf file is in my package, because it is also part of the haproxy-package.
I have worked around this problem by providing a custom upstart-script which starts HAProxy with a different config file, but this does not seem to be the right way to do this.
Is there a preferred way to handle such customizations?
In cases like this, I've created an RPM which installs configuration files into a different subdirectory, and in its %post and %preun scriptlets modifies the uncooperative package's config-files:
when installing, I renamed the original config-files, and made symbolic links from those pathnames to the overwriting config-files, and
when uninstalling, the package removed the symbolic links and restored the original package's files.
Doing it that way of course meant that my config-RPM was dependent on the original RPM. A little awkward to describe, but it works.
In followup, the issue of updating was mentioned. Updating an RPM requires special handling to avoid uninstalling things. The rpm program passes a parameter $1 which you can test in the %pre and %preun scriptlets to notice that this is an upgrade and that there is no need to save the original config-files (or restore them). The rest of the scriptlet would be the same, by copying the new versions of your config-files over the others.
Further reading:
Defining installation scripts (shows the use of `$1)
RPM upgrade uninstalls the RPM
Your approach is correct. On EL6 and sysv there is no other choice than creating custom haproxy package or custom haproxy service or create script which customer runs after installation. I see creating another service as best option.
Note that on EL7 with SystemD you have much better option as you can use Drop-In feature of SystemD. For more information see:
https://coreos.com/os/docs/latest/using-systemd-drop-in-units.html
https://wiki.archlinux.org/index.php/systemd#Drop-in_snippets
https://wiki.archlinux.org/index.php/Systemd/User#Service_example
The usual way this is done is to have a drop-in configuration directory, e.g. /etc/httpd/conf.d/, where your package would drop its configuration, and you would tell the other daemon, e.g. httpd, to do a graceful restart in your %post/%postun.
I don't know anything about HAProxy, but a quick search implies that they do not support this configuration directory concept that has been around for many years. A few people have hacked it in, but unless it is out-of-the-box, you will run into your original problem again.

Why is it rare to use the %pre rpm script?

In maximum rpm under the section on the %pre install script, it mentions that it's rare to use the %pre script. In fact, it further states that (at that time anyway) none of the 400+ RedHat packages used the %pre script.
I would think the %pre script would be the ideal location to stop the existing service before installing files over top of the currently installed version.
Is my thinking wrong? How is it that RedHat got away with never using %pre during upgrade for this purpose in any of their service packages?
Yes %pre is much more commonly used than when "Maximum RPM" was written in 1997. That doesn't change the fact that %pre should be used "rarely".
The reason is that %pre prevents installation (and may cause an entire
transaction to fail if there are needed install time dependencies).
Stopping a service in %pre and restarting in %post opens a larger window
where the service is not running than simply restarting a service in %post
The already running service typically reads its configuration files
only on startup (and so rpm can replace files while daemon is running).
And running executables have a reference count on the file system and so
continue to run even if the file that was executed was removed/replaced
by a newer package.
Well, I went and did the research I should have done before asking this question. I downloaded several service packages from RedHat 7.1 and ran:
rpm -qp --scripts <package-name>.rpm
I found out 1) that it's no longer true that %pre is not used. Even among the few that I checked a couple of them used %pre, and 2) it appears that most services just allow rpm to overwrite their data files and binaries during upgrade, and then use the upgrade portion of the %postun (post uninstall) script to restart (or try-restart) the service.
I would have thought this rather unsafe, as while you're writing over data files (especially) during upgrade, the old running service might get confused. It seems to me ultimately it's safer to stop the service during upgrade on %pre and start it again on upgrade during %postun... but that's just me.