Install rsync 3.1.1 on systemd

I have CentOS 7 and it comes with Rsync 3.0.9. I downloaded the 3.1.1 el7 rpm and installed with rpm -Uvh.

Now the daemon refuse to start. I tried to create :

/usr/lib/systemd/system/rsyncd.service

[Unit]
Description=A program for synchronizing files over a network
After=syslog.target network.target
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=-/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"

[Install]
WantedBy=multi-user.target

No luck :

/bin/systemctl status  rsyncd.service
● rsyncd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: failed (Result: exit-code) since Thu 2016-04-21 15:27:00 EDT; 56min ago
 Main PID: 1452 (code=exited, status=20)

Note those referenced file in the configuration exist:

-rw-r--r-- 1 root root 1699 Feb  4 14:27 /etc/rsyncd.conf
-rw-r--r-- 1 root root 11 Apr 21 16:09 /etc/sysconfig/rsyncd

I've got 3.1.1 under fedora 22.

The requisite config files for rsyncd are in the rsync-daemon package. I've listed the files in each package below.

I'd just install the extra package.

But, I did notice a typo in your config file ...

Change:

EnvironmentFile=-/etc/sysconfig/rsyncd

Into:

EnvironmentFile=/etc/sysconfig/rsyncd

Here's a list of files in the rsync package:

/usr/bin/rsync
/usr/share/doc/rsync
/usr/share/doc/rsync/NEWS
/usr/share/doc/rsync/OLDNEWS
/usr/share/doc/rsync/README
/usr/share/doc/rsync/support
/usr/share/doc/rsync/support/Makefile
/usr/share/doc/rsync/support/atomic-rsync
/usr/share/doc/rsync/support/cvs2includes
/usr/share/doc/rsync/support/deny-rsync
/usr/share/doc/rsync/support/file-attr-restore
/usr/share/doc/rsync/support/files-to-excludes
/usr/share/doc/rsync/support/git-set-file-times
/usr/share/doc/rsync/support/instant-rsyncd
/usr/share/doc/rsync/support/logfilter
/usr/share/doc/rsync/support/lsh
/usr/share/doc/rsync/support/lsh.sh
/usr/share/doc/rsync/support/mapfrom
/usr/share/doc/rsync/support/mapto
/usr/share/doc/rsync/support/mnt-excl
/usr/share/doc/rsync/support/munge-symlinks
/usr/share/doc/rsync/support/rrsync
/usr/share/doc/rsync/support/rsync-no-vanished
/usr/share/doc/rsync/support/rsync-slash-strip
/usr/share/doc/rsync/support/rsyncstats
/usr/share/doc/rsync/support/savetransfer.c
/usr/share/doc/rsync/tech_report.tex
/usr/share/licenses/rsync
/usr/share/licenses/rsync/COPYING
/usr/share/man/man1/rsync.1.gz

Here's a list of files in the rsync-daemon package:

/etc/rsyncd.conf
/etc/sysconfig/rsyncd
/usr/lib/systemd/system/rsyncd.service
/usr/lib/systemd/system/rsyncd.socket
/usr/lib/systemd/system/[email protected]
/usr/share/man/man5/rsyncd.conf.5.gz

UPDATE:

I tried to force install rsync-daemon on my Centos 7, given that it's just text file, I took a chance and ignored the dependency.

I'm not sure what dependency you mean, but I looked at the rpm's .spec file and it lists systemd-units, but I can't find an rpm for that.

No luck.

Not quite sure what this means. Did the files extract/install or not? Can you do ls -l on them? As a last resort, did you try rpm --nodeps --force?

Given an .rpm file, it is possible to manually extract files using rpm2cpio [should be part of the already installed rpm package] and either cpio or pax [which is very similar to tar, but understands both tar and cpio format archives].

I've usually had better luck using pax. It has its own rpm [to install: yum install pax]. In fact, I've never gotten the rpm2cpio/cpio combination to work correctly for extraction.

To list an rpm file using pax:

rpm2cpio rpmfile | pax -v

To extract an rpm file using pax:

rpm2cpio rpmfile | pax -v -r

I also tried to extract the file directly, but it still refuses to start.

You may have to consult some logfiles, such as /var/log/messages, /var/log/audit/audit.log, /var/log/secure, and may have to use the journalctl program to view the systemd log.

You might have some [silly] selinux security restriction that has to be fixed. You may have to run restorecon on the config files.

Also, you may have to add something to the /etc files as it may be rsync itself that doesn't want to start (vs. systemd not starting rsync).

Below are the contents of the rsync-daemon files, except for the man page file [which is way too large to include here]. The man page file can be found here: http://linux.die.net/man/5/rsyncd.conf


/etc/rsyncd.conf

# /etc/rsyncd: configuration file for rsync daemon mode

# See rsyncd.conf man page for more options.

# configuration example:

# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

# [ftp]
#        path = /home/ftp
#        comment = ftp export area

/etc/sysconfig/rsyncd

OPTIONS=""

/usr/lib/systemd/system/rsyncd.service

[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"

[Install]
WantedBy=multi-user.target

/usr/lib/systemd/system/[email protected]

[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf

[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"
StandardInput=socket

/usr/lib/systemd/system/rsyncd.socket

[Unit]
Description=Rsync Server Socket
Conflicts=rsyncd.service

[Socket]
ListenStream=873
Accept=yes

[Install]
WantedBy=sockets.target

I found out that systemctl daemon-reload is required to load the service. After doing that, it worked right away.