| 1 | # How to build and install rsync |
| 2 | |
| 3 | When building rsync, you'll want to install various libraries in order to get |
| 4 | all the features enabled. The configure script will alert you when the |
| 5 | newest libraries are missing and tell you the appropriate `--disable-LIB` |
| 6 | option to use if you want to just skip that feature. What follows are various |
| 7 | support libraries that you may want to install to build rsync with the maximum |
| 8 | features (the impatient can skip down to the package summary): |
| 9 | |
| 10 | ## Ubuntu users: skip the build, use the PPA |
| 11 | |
| 12 | If you are on a currently supported Ubuntu series (jammy 22.04 LTS, noble |
| 13 | 24.04 LTS, questing 25.10, resolute 26.04 LTS) and just want the latest |
| 14 | upstream rsync, the rsync project maintains a Launchpad PPA that tracks |
| 15 | stable releases: |
| 16 | |
| 17 | > sudo add-apt-repository ppa:rsyncproject/rsync |
| 18 | > sudo apt update && sudo apt install rsync |
| 19 | |
| 20 | See [the PPA page][ppa] for current build status across architectures. |
| 21 | |
| 22 | [ppa]: https://launchpad.net/~rsyncproject/+archive/ubuntu/rsync |
| 23 | |
| 24 | To test the upcoming release instead, there is also a [`rsync-latest` |
| 25 | PPA][ppa-latest] that is rebuilt from the tip of the git master branch. These |
| 26 | are development snapshots whose version numbers (such as |
| 27 | `3.5.0~git20260601...`) deliberately sort below the matching stable release, so |
| 28 | the stable PPA above will never silently move you from a release onto a |
| 29 | snapshot. Use it for testing only -- it may contain unreleased changes: |
| 30 | |
| 31 | > sudo add-apt-repository ppa:rsyncproject/rsync-latest |
| 32 | > sudo apt update && sudo apt install rsync |
| 33 | |
| 34 | [ppa-latest]: https://launchpad.net/~rsyncproject/+archive/ubuntu/rsync-latest |
| 35 | |
| 36 | The rest of this document covers building from source. |
| 37 | |
| 38 | ## The basic setup |
| 39 | |
| 40 | You need to have a C compiler installed and optionally a C++ compiler in order |
| 41 | to try to build some hardware-accelerated checksum routines. Rsync also needs |
| 42 | a modern awk, which might be provided via gawk or nawk on some OSes. |
| 43 | |
| 44 | ## Autoconf & manpages |
| 45 | |
| 46 | If you're installing from the git repo (instead of a release tar file) you'll |
| 47 | also need the GNU autotools (autoconf & automake) and your choice of 2 python3 |
| 48 | markdown libraries: cmarkgfm or commonmark (needed to generate the manpages). |
| 49 | If your OS doesn't provide a python3-cmarkgfm or python3-commonmark package, |
| 50 | you can run the following to install the commonmark python library for your |
| 51 | build user (after installing python3's pip package): |
| 52 | |
| 53 | > python3 -mpip install --user commonmark |
| 54 | |
| 55 | You can test if you've got it fixed by running (from the rsync checkout): |
| 56 | |
| 57 | > ./md-convert --test rsync-ssl.1.md |
| 58 | |
| 59 | Alternately, you can avoid generating the manpages by fetching the very latest |
| 60 | versions (that match the latest git source) from the [generated-files][6] dir. |
| 61 | One way to do that is to run: |
| 62 | |
| 63 | > ./prepare-source fetchgen |
| 64 | |
| 65 | [6]: https://download.samba.org/pub/rsync/generated-files/ |
| 66 | |
| 67 | ## ACL support |
| 68 | |
| 69 | To support copying ACL file information, make sure you have an acl |
| 70 | development library installed. It also helps to have the helper programs |
| 71 | installed to manipulate ACLs and to run the rsync testsuite. |
| 72 | |
| 73 | ## Xattr support |
| 74 | |
| 75 | To support copying xattr file information, make sure you have an attr |
| 76 | development library installed. It also helps to have the helper programs |
| 77 | installed to manipulate xattrs and to run the rsync testsuite. |
| 78 | |
| 79 | ## xxhash |
| 80 | |
| 81 | The [xxHash library][1] provides extremely fast checksum functions that can |
| 82 | make the "rsync algorithm" run much more quickly, especially when matching |
| 83 | blocks in large files. Installing this development library adds xxhash |
| 84 | checksums as the default checksum algorithm. You'll need at least v0.8.0 |
| 85 | if you want rsync to include the full range of its checksum algorithms. |
| 86 | |
| 87 | [1]: https://cyan4973.github.io/xxHash/ |
| 88 | |
| 89 | ## zstd |
| 90 | |
| 91 | The [zstd library][2] compression algorithm that uses less CPU than |
| 92 | the default zlib algorithm at the same compression level. Note that you |
| 93 | need at least version 1.4, so you might need to skip the zstd compression if |
| 94 | you can only install a 1.3 release. Installing this development library |
| 95 | adds zstd compression as the default compression algorithm. |
| 96 | |
| 97 | [2]: http://facebook.github.io/zstd/ |
| 98 | |
| 99 | ## lz4 |
| 100 | |
| 101 | The [lz4 library][3] compression algorithm that uses very little CPU, though |
| 102 | it also has the smallest compression ratio of other algorithms. Installing |
| 103 | this development library adds lz4 compression as an available compression |
| 104 | algorithm. |
| 105 | |
| 106 | [3]: https://lz4.github.io/lz4/ |
| 107 | |
| 108 | ## openssl crypto |
| 109 | |
| 110 | The [openssl crypto library][4] provides some hardware accelerated checksum |
| 111 | algorithms for MD4 and MD5. Installing this development library makes rsync |
| 112 | use the (potentially) faster checksum routines when computing MD4 & MD5 |
| 113 | checksums. |
| 114 | |
| 115 | [4]: https://www.openssl.org/docs/man1.0.2/man3/crypto.html |
| 116 | |
| 117 | ## Package summary |
| 118 | |
| 119 | To help you get the libraries installed, here are some package install commands |
| 120 | for various OSes. The commands are split up to correspond with the above |
| 121 | items, but feel free to combine the package names into a single install, if you |
| 122 | like. |
| 123 | |
| 124 | - For Debian and Ubuntu (Debian Buster users may want to briefly(?) enable |
| 125 | buster-backports to update zstd from 1.3 to 1.4): |
| 126 | |
| 127 | > sudo apt install -y gcc g++ gawk autoconf automake python3-cmarkgfm |
| 128 | > sudo apt install -y acl libacl1-dev |
| 129 | > sudo apt install -y attr libattr1-dev |
| 130 | > sudo apt install -y libxxhash-dev |
| 131 | > sudo apt install -y libzstd-dev |
| 132 | > sudo apt install -y liblz4-dev |
| 133 | > sudo apt install -y libssl-dev |
| 134 | |
| 135 | Or run support/install_deps_ubuntu.sh |
| 136 | |
| 137 | - For CentOS (use EPEL for python3-pip): |
| 138 | |
| 139 | > sudo yum -y install epel-release |
| 140 | > sudo yum -y install gcc g++ gawk autoconf automake python3-pip |
| 141 | > sudo yum -y install acl libacl-devel |
| 142 | > sudo yum -y install attr libattr-devel |
| 143 | > sudo yum -y install xxhash-devel |
| 144 | > sudo yum -y install libzstd-devel |
| 145 | > sudo yum -y install lz4-devel |
| 146 | > sudo yum -y install openssl-devel |
| 147 | > python3 -mpip install --user commonmark |
| 148 | |
| 149 | - For Fedora 33: |
| 150 | |
| 151 | > sudo dnf -y install acl libacl-devel |
| 152 | > sudo dnf -y install attr libattr-devel |
| 153 | > sudo dnf -y install xxhash-devel |
| 154 | > sudo dnf -y install libzstd-devel |
| 155 | > sudo dnf -y install lz4-devel |
| 156 | > sudo dnf -y install openssl-devel |
| 157 | |
| 158 | - For FreeBSD (this assumes that the python3 version is 3.7): |
| 159 | |
| 160 | > sudo pkg install -y autotools python3 py37-CommonMark |
| 161 | > sudo pkg install -y xxhash |
| 162 | > sudo pkg install -y zstd |
| 163 | > sudo pkg install -y liblz4 |
| 164 | |
| 165 | - For macOS: |
| 166 | |
| 167 | > brew install automake |
| 168 | > brew install xxhash |
| 169 | > brew install zstd |
| 170 | > brew install lz4 |
| 171 | > brew install openssl |
| 172 | |
| 173 | - For Cygwin (with all cygwin programs stopped, run the appropriate setup program from a cmd shell): |
| 174 | |
| 175 | > setup-x86_64 --quiet-mode -P make,gawk,autoconf,automake,gcc-core,python38,python38-pip |
| 176 | > setup-x86_64 --quiet-mode -P attr,libattr-devel |
| 177 | > setup-x86_64 --quiet-mode -P libzstd-devel |
| 178 | > setup-x86_64 --quiet-mode -P liblz4-devel |
| 179 | > setup-x86_64 --quiet-mode -P libssl-devel |
| 180 | |
| 181 | Sometimes cygwin has commonmark packaged and sometimes it doesn't. Now that |
| 182 | its python38 has stabilized, you could install python38-commonmark. Or just |
| 183 | avoid the issue by running this from a bash shell as your build user: |
| 184 | |
| 185 | > python3 -mpip install --user commonmark |
| 186 | |
| 187 | ## Build and install |
| 188 | |
| 189 | After installing the various libraries, you need to configure, build, and |
| 190 | install the source: |
| 191 | |
| 192 | > ./configure |
| 193 | > make |
| 194 | > sudo make install |
| 195 | |
| 196 | The default install path is /usr/local/bin, but you can set the installation |
| 197 | directory and other parameters using options to ./configure. To see them, use: |
| 198 | |
| 199 | > ./configure --help |
| 200 | |
| 201 | Configure tries to figure out if the local system uses group "nobody" or |
| 202 | "nogroup" by looking in the /etc/group file. (This is only used for the |
| 203 | default group of an rsync daemon, which attempts to run with "nobody" |
| 204 | user and group permissions.) You can change the default user and group |
| 205 | for the daemon by editing the NOBODY_USER and NOBODY_GROUP defines in |
| 206 | config.h, or just override them in your /etc/rsyncd.conf file. |
| 207 | |
| 208 | As of 2.4.7, rsync uses Eric Troan's popt option-parsing library. A |
| 209 | cut-down copy of a recent release is included in the rsync distribution, |
| 210 | and will be used if there is no popt library on your build host, or if |
| 211 | the `--with-included-popt` option is passed to ./configure. |
| 212 | |
| 213 | If you configure using `--enable-maintainer-mode`, then rsync will try |
| 214 | to pop up an xterm on DISPLAY=:0 if it crashes. You might find this |
| 215 | useful, but it should be turned off for production builds. |
| 216 | |
| 217 | If you want to automatically use a separate "build" directory based on |
| 218 | the current git branch name, start with a pristine git checkout and run |
| 219 | "mkdir auto-build-save" before you run the first ./configure command. |
| 220 | That will cause a fresh build dir to spring into existence along with a |
| 221 | special Makefile symlink that allows you to run "make" and "./configure" |
| 222 | from the source dir (the "build" dir gets auto switched based on branch). |
| 223 | This is helpful when using the branch-from-patch and patch-update scripts |
| 224 | to maintain the official rsync patches. If you ever need to build from |
| 225 | a "detached head" git position then you'll need to manually chdir into |
| 226 | the build dir to run make. I also like to create 2 more symlinks in the |
| 227 | source dir: `ln -s build/rsync . ; ln -s build/testtmp .` |
| 228 | |
| 229 | ## Make compatibility |
| 230 | |
| 231 | Note that Makefile.in has a rule that uses a wildcard in a prerequisite. If |
| 232 | your make has a problem with this rule, you will see an error like this: |
| 233 | |
| 234 | Don't know how to make ./*.c |
| 235 | |
| 236 | You can change the "proto.h-tstamp" target in Makefile.in to list all the \*.c |
| 237 | filenames explicitly in order to avoid this issue. |
| 238 | |
| 239 | ## RPM notes |
| 240 | |
| 241 | Under packaging you will find .spec files for several distributions. |
| 242 | The .spec file in packaging/lsb can be used for Linux systems that |
| 243 | adhere to the Linux Standards Base (e.g., RedHat and others). |
| 244 | |
| 245 | ## HP-UX notes |
| 246 | |
| 247 | The HP-UX 10.10 "bundled" C compiler seems not to be able to cope with |
| 248 | ANSI C. You may see this error message in config.log if ./configure |
| 249 | fails: |
| 250 | |
| 251 | (Bundled) cc: "configure", line 2162: error 1705: Function prototypes are an ANSI feature. |
| 252 | |
| 253 | Install gcc or HP's "ANSI/C Compiler". |
| 254 | |
| 255 | ## Mac OS X notes |
| 256 | |
| 257 | Some versions of Mac OS X (Darwin) seem to have an IPv6 stack, but do |
| 258 | not completely implement the "New Sockets" API. |
| 259 | |
| 260 | [This site][5] says that Apple started to support IPv6 in 10.2 (Jaguar). If |
| 261 | your build fails, try again after running configure with `--disable-ipv6`. |
| 262 | |
| 263 | Apple Silicon macs may install packages in a slightly different location and require flags. |
| 264 | CFLAGS="-I /opt/homebrew/include" LDFLAGS="-L /opt/homebrew/lib" |
| 265 | |
| 266 | [5]: http://www.ipv6.org/impl/mac.html |
| 267 | |
| 268 | ## IBM AIX notes |
| 269 | |
| 270 | IBM AIX has a largefile problem with mkstemp. See IBM PR-51921. |
| 271 | The workaround is to append the following to config.h: |
| 272 | |
| 273 | > #ifdef _LARGE_FILES |
| 274 | > #undef HAVE_SECURE_MKSTEMP |
| 275 | > #endif |