thin-send-recv Guide: Building and Installing thin-send-recv RPM on CentOS 7 1. Set Up the Build Environment on CentOS 7 First, install the necessary development tools and dependencies: sudo yum groupinstall 'Development Tools' sudo yum install rpm-build flex gcc make git 2. Set Up the RPM Build Directory Structure Create the required directory structure for RPM building: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} 3. Clone the thin-send-recv Repository Next, clone the repository and prepare the source tarball for the v1.1.2 tag (or the desired version): cd ~ git clone https://github.com/LINBIT/thin-send-recv.git cd thin-send-recv git archive --format=tar.gz --prefix=thin-send-recv-1.1.2/ -o ~/rpmbuild/SOURCES/thin-send-recv-1.1.2.tar.gz v1.1.2 4. Create the Spec File Create a spec file in ~/rpmbuild/SPECS/thin-send-recv.spec : nano ~/rpmbuild/SPECS/thin-send-recv.spec Add the following content: Name: thin-send-recv Version: 1.1.2 Release: 1%{?dist} Summary: Send/receive tool for thin provisioning metadata License: GPLv2 URL: https://github.com/LINBIT/thin-send-recv Source0: %{name}-%{version}.tar.gz %description Thin-send-recv is a tool for sending and receiving thin provisioning metadata. %prep %setup -q %build make %install mkdir -p %{buildroot}/usr/bin install -m 755 thin_send_recv %{buildroot}/usr/bin/ ln -sf thin_send_recv %{buildroot}/usr/bin/thin_send ln -sf thin_send_recv %{buildroot}/usr/bin/thin_recv %files /usr/bin/thin_send_recv /usr/bin/thin_send /usr/bin/thin_recv %changelog * Tue Oct 01 2024 Your Name - 1.1.2-1 - Initial RPM release This file defines the package, how it is compiled, and where the binaries should be installed. 5. Build the RPM With the spec file in place and the source tarball prepared, build the RPM: rpmbuild --nodeps -ba ~/rpmbuild/SPECS/thin-send-recv.spec This will compile the software and generate the RPM package. 6. Verify the Build Once the build is complete, you’ll find the RPM files in: Binary RPM: ~/rpmbuild/RPMS/x86_64/ Source RPM: ~/rpmbuild/SRPMS/ List the files with: ls ~/rpmbuild/RPMS/x86_64/ 7. Transfer and Install the Binary RPM Transfer the built RPM (e.g., thin-send-recv-1.1.2-1.x86_64.rpm ) to your target system, then install it: sudo rpm -i ~/rpmbuild/RPMS/x86_64/thin-send-recv-1.1.2-1.x86_64.rpm 8. Verify Installation The binary thin_send_recv should now be available in /usr/bin/ , which is included in your system’s PATH . Run the following command to verify: thin_send_recv -- help If you prefer to use the command thin-send-recv , create a symlink to the binary: sudo ln -s /usr/bin/thin_send_recv /usr/bin/thin-send-recv Now you can run: thin-send-recv -- help 9. Troubleshooting If you cannot find the binary after installation, ensure it was installed in /usr/bin/ by running: rpm -ql thin-send-recv If the binary is in a different directory, you can add that directory to your PATH or update the spec file to install the binary in /usr/bin/ . Building thin-send-recv RPM on Ubuntu This guide walks through the steps to build the thin-send-recv package from source as an RPM on an Ubuntu system. 1. Install Required Tools First, you need to install the tools required to build RPMs on Ubuntu: sudo apt-get update sudo apt-get install rpm build-essential flex gcc make 2. Manually Set Up the RPM Build Environment Since rpmdevtools is not available on Ubuntu, manually set up the directory structure required for RPM building: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} 3. Clone the Repository Clone the thin-send-recv source code from the official repository: git clone https://github.com/LINBIT/thin-send-recv.git cd thin-send-recv 4. Create a Source Tarball Create a source tarball from the v1.1.2 tag (or whichever version you want to build): git archive --format=tar.gz --prefix=thin-send-recv-1.1.2/ -o ~/rpmbuild/SOURCES/thin-send-recv-1.1.2.tar.gz v1.1.2 5. Create the Spec File Create a spec file in the ~/rpmbuild/SPECS/ directory to define the RPM package. The spec file will control how the package is built and installed. nano ~/rpmbuild/SPECS/thin-send-recv.spec Add the following content to the spec file: Name: thin-send-recv Version: 1.1.2 Release: 1%{?dist} Summary: Send/receive tool for thin provisioning metadata License: GPLv2 URL: https://github.com/LINBIT/thin-send-recv Source0: %{name}-%{version}.tar.gz %description Thin-send-recv is a tool for sending and receiving thin provisioning metadata. %prep %setup -q %build make %install mkdir -p %{buildroot}/usr/bin install -m 755 thin_send_recv %{buildroot}/usr/bin/ ln -sf %{buildroot}/usr/bin/thin_send_recv %{buildroot}/usr/bin/thin_send ln -sf %{buildroot}/usr/bin/thin_send_recv %{buildroot}/usr/bin/thin_recv %files /usr/bin/thin_send_recv /usr/bin/thin_send /usr/bin/thin_recv %changelog * Tue Oct 01 2024 Your Name - 0.1-1 - Initial RPM release 6. Build the RPM With the spec file and source tarball in place, build the RPM package using rpmbuild : rpmbuild --nodeps -ba ~/rpmbuild/SPECS/thin-send-recv.spec 7. Locate the Built RPMs After a successful build, the RPM packages will be located in the following directories: Binary RPM (for installation on target systems): ~/rpmbuild/RPMS/x86_64/ Source RPM (for distribution of source code): ~/rpmbuild/SRPMS/ You can list the files with: ls ~/rpmbuild/RPMS/x86_64/ ls ~/rpmbuild/SRPMS/ 8. Install the RPM (Optional) To test the RPM on your system (or transfer it to another system), install the generated RPM: sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/thin-send-recv-1.1.2-1.x86_64.rpm   Issues Past commands. wget https://piraeus.daocloud.io/linbit/rpms/7/x86_64/thin-send-recv-1.0.1-1.x86_64.rpm --no-check-certificate rpm -i thin-send-recv-1.0.1-1.x86_64.rpm thin-send-recv --help thin-send-recv-1.0.1-1.x86_64.rpm   No longer able to download from the url https://piraeus.daocloud.io/linbit/rpms/7/x86_64/thin-send-recv-1.0.1-1.x86_64.rpm is unreachable.  These 403 https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/   https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm   [19:17 ovbh-pprod-xen01 ~]# wget https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm --2024-10-01 19:17:43-- https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm%C2%A0 Resolving packages.linbit.com (packages.linbit.com)... 94.177.8.207, 2a0d:f302:119:f7b8::1 Connecting to packages.linbit.com (packages.linbit.com)|94.177.8.207|:443... connected. HTTP request sent, awaiting response... 403 Forbidden 2024-10-01 19:17:44 ERROR 403: Forbidden. --2024-10-01 19:17:44-- https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm%C2%A0 Reusing existing connection to packages.linbit.com:443. HTTP request sent, awaiting response... 403 Forbidden 2024-10-01 19:17:44 ERROR 403: Forbidden. [19:17 ovbh-pprod-xen01 ~]# wget https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm --no-check-certificate --2024-10-01 19:17:59-- https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm%C2%A0--no-check-certificate Resolving packages.linbit.com (packages.linbit.com)... 94.177.8.207, 2a0d:f302:119:f7b8::1 Connecting to packages.linbit.com (packages.linbit.com)|94.177.8.207|:443... connected. HTTP request sent, awaiting response... 403 Forbidden 2024-10-01 19:17:59 ERROR 403: Forbidden. --2024-10-01 19:17:59-- https://packages.linbit.com/yum/sles12-sp2/drbd-9.0/x86_64/Packages/thin-send-recv-1.1.2-1.x86_64.rpm%C2%A0--no-check-certificate Reusing existing connection to packages.linbit.com:443. HTTP request sent, awaiting response... 403 Forbidden 2024-10-01 19:18:00 ERROR 403: Forbidden.