|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta content="width=device-width, initial-scale=1" name="viewport"> |
| 6 | + <meta content="Installing Rex" name="title" property="og:title"> |
| 7 | + <meta content="article" name="type" property="og:type"> |
| 8 | + <meta content="/theme/images/agile_sysadmin.webp" name="type" property="og:image"> |
| 9 | + <meta content="https://blog.ferki.it/2025/03/05/installing-rex/index.html" name="url" property="og:url"> |
| 10 | + <meta content="Ferenc Erki - agile sysadmin" name="description"> |
| 11 | + <meta content="Ferenc Erki" name="author"> |
| 12 | + <meta content="4KzbYclokErOfwrKiBpX8XCu8ckJ9A7zwueL9VAbAYE" name="google-site-verification"> |
| 13 | + <link href="/theme/images/favicon.svg" rel="icon"> |
| 14 | + <link href="/theme/css/selenized.css" rel="stylesheet"> |
| 15 | + <script data-domain="blog.ferki.it" defer src="https://plausible.io/js/script.js"></script> |
| 16 | + <title>Installing Rex</title> |
| 17 | + </head> |
| 18 | + <body> |
| 19 | + <header> |
| 20 | + <h1><a href="/">🧑💻 agile sysadmin</a></h1> |
| 21 | + <p>by Ferenc Erki</p> |
| 22 | + </header> |
| 23 | + |
| 24 | + <nav> |
| 25 | + <ul> |
| 26 | + <li><a href="/pages/about.html">About</a></li> |
| 27 | + <li><a href="/">Posts</a></li> |
| 28 | + <li><a href="https://ferki.it" target="_blank">Homepage</a></li> |
| 29 | + <li><a href="https://cal.com/ferki" target="_blank">Booking</a></li> |
| 30 | + </ul> |
| 31 | + </nav> |
| 32 | + |
| 33 | + <main> |
| 34 | + <article> |
| 35 | + |
| 36 | + <header> |
| 37 | + <h1><a href="/2025/03/05/installing-rex/">Installing Rex</a></h1> |
| 38 | + |
| 39 | + <aside> |
| 40 | + <time datetime="2025-03-05" title="published"> |
| 41 | + 🗓 2025-03-05 |
| 42 | + </time> |
| 43 | + <a href="/tag/rex/">#rex</a> |
| 44 | + </aside> |
| 45 | + |
| 46 | +</header> |
| 47 | + |
| 48 | + |
| 49 | + <section id="section-1"> |
| 50 | + <p>We briefly describe the different ways to install Rex, the friendly automation |
| 51 | +framework on the <a href="https://www.rexify.org/get/">Get Rex</a> page of our website, as |
| 52 | +well as in the |
| 53 | +<a href="https://github.com/RexOps/Rex?tab=readme-ov-file#installation">Installation</a> |
| 54 | +section of our README:</p> |
| 55 | + |
| 56 | +<ol> |
| 57 | +<li>Install from the Comprehensive Perl Archive Network (CPAN)</li> |
| 58 | +<li>Use standard, native package managers</li> |
| 59 | +<li>Build from source code</li> |
| 60 | +</ol> |
| 61 | + |
| 62 | +<p>Depending on the situation at hand, one of these often fit better than the |
| 63 | +rest.</p> |
| 64 | + |
| 65 | +<p>Let’s go through the available options in more detail to help choosing the best |
| 66 | +match.</p> |
| 67 | + |
| 68 | + </section> |
| 69 | + <section id="section-2"> |
| 70 | + <h2 id="install-from-cpan"><a href="#install-from-cpan">Install from CPAN</a></h2> |
| 71 | + |
| 72 | +<p>CPAN serves as a well-established software repository for the Perl community. |
| 73 | +As a Perl project, we feel it natural to upload our official Rex releases to |
| 74 | +CPAN, and we also consider that as the canonical source for both Rex packages |
| 75 | +and documentation.</p> |
| 76 | + |
| 77 | +<p>For these reasons, we recommend to install the latest stable Rex version from |
| 78 | +there. This approach ensures using Rex versions in the same way we expect Rex |
| 79 | +to get installed.</p> |
| 80 | + |
| 81 | +<p>On top of stable releases, we also upload trial versions to CPAN during |
| 82 | +development to provide early access, and to gain insights from <a href="https://fast2-matrix.cpantesters.org/?dist=Rex">CPAN |
| 83 | +Testers</a> about the behavior of |
| 84 | +Rex across operating systems and Perl versions.</p> |
| 85 | + |
| 86 | +<p>CPAN itself supports a set of clients, like |
| 87 | +<a href="https://metacpan.org/dist/CPAN/view/scripts/cpan">cpan</a>, |
| 88 | +<a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a>, and |
| 89 | +<a href="https://metacpan.org/dist/App-cpm/view/script/cpm">cpm</a>, offering further |
| 90 | +choices to match a wide range of preferences and circumstances.</p> |
| 91 | + |
| 92 | +<p>These clients support running the built-in test suite of Rex and its |
| 93 | +dependencies, to verify everything can function as expected on the given |
| 94 | +machine.</p> |
| 95 | + |
| 96 | +<p>In general, we also recommend to install Rex and its dependencies into a |
| 97 | +separate Perl environment, as provided by |
| 98 | +<a href="https://metacpan.org/pod/local::lib">local::lib</a>, |
| 99 | +<a href="https://metacpan.org/dist/App-perlbrew/view/script/perlbrew">perlbrew</a>, |
| 100 | +<a href="https://github.com/tokuhirom/plenv">plenv</a>, or similar. This helps to keep a |
| 101 | +clean working environment to use Rex, isolating it from the system’s own Perl |
| 102 | +installations.</p> |
| 103 | + |
| 104 | +<h2 id="use-package-managers"><a href="#use-package-managers">Use package managers</a></h2> |
| 105 | + |
| 106 | +<p>Thanks to the generous effort of package maintainers, many operating systems |
| 107 | +ship Rex through their own official package repositories. For a known list of |
| 108 | +such packages, check <a href="https://repology.org/project/rex-automation-framework/versions">our Repology |
| 109 | +page</a>.</p> |
| 110 | + |
| 111 | +<p>It provides a convenient way to install Rex system-wide through native package |
| 112 | +management tools in a way deemed appropriate for proper integration into the |
| 113 | +given operating system.</p> |
| 114 | + |
| 115 | +<p>This integration means package maintainers may decide to apply patches, use |
| 116 | +different set of dependencies, or offer different testing options in a way |
| 117 | +relevant for the used operating system. Some organizations decide to apply |
| 118 | +patches to Rex according to their specific preferences, and package that for |
| 119 | +their own users.</p> |
| 120 | + |
| 121 | +<p>Since it may potentially lead to a different experience compared to the |
| 122 | +official packages released by us, please keep this in mind for the use case at |
| 123 | +hand, or when looking for support.</p> |
| 124 | + |
| 125 | +<p>In any case, we feel more than happy to directly collaborate with downstream |
| 126 | +package maintainers to deliver a great experience with Rex to their |
| 127 | +communities. This includes supporting packagers to stay close to the official |
| 128 | +setup, for example by merging downstream patches into Rex itself, or |
| 129 | +identifying both mandatory and optional dependencies.</p> |
| 130 | + |
| 131 | +<p>When noticing differences between our official releases and their packaged |
| 132 | +versions, please let both us and the package maintainers know, so we may figure |
| 133 | +out an even more streamlined delivery together.</p> |
| 134 | + |
| 135 | +<h2 id="build-from-source"><a href="#build-from-source">Build from source</a></h2> |
| 136 | + |
| 137 | +<p>Even with publishing trial releases to CPAN during development, sometimes it |
| 138 | +fits best to use an unreleased version of Rex. For example:</p> |
| 139 | + |
| 140 | +<ul> |
| 141 | +<li>requiring a recently merged, but still unreleased change</li> |
| 142 | +<li>during development itself, especially when evaluating the whole build process</li> |
| 143 | +<li>applying a custom patch to Rex</li> |
| 144 | +</ul> |
| 145 | + |
| 146 | +<p>We host our code in the <a href="https://github.com/RexOps/Rex">RexOps/Rex</a> GitHub |
| 147 | +repository, and use |
| 148 | +<a href="https://metacpan.org/dist/Dist-Zilla/view/bin/dzil">Dist::Zilla</a> to build our |
| 149 | +releases.</p> |
| 150 | + |
| 151 | +<p>It handles the dependencies for development, runtime, and testing, including |
| 152 | +optional ones, as well as local installation.</p> |
| 153 | + |
| 154 | +<p>Follow the steps below to build Rex from source.</p> |
| 155 | + |
| 156 | +<h3 id="preparation"><a href="#preparation">Preparation</a></h3> |
| 157 | + |
| 158 | +<ol> |
| 159 | +<li>Install Git, a CPAN client (we will use <code>cpanm</code> below), and Dist::Zilla</li> |
| 160 | +<li>Clone the source code with <code>git clone https://github.com/RexOps/Rex</code></li> |
| 161 | +<li>Switch to the source code directory with <code>cd Rex</code></li> |
| 162 | +</ol> |
| 163 | + |
| 164 | +<h3 id="dependencies"><a href="#dependencies">Dependencies</a></h3> |
| 165 | + |
| 166 | +<ol> |
| 167 | +<li>Install author dependencies with <code>dzil authordeps | cpanm</code></li> |
| 168 | +<li>Install common dependencies with <code>dzil listdeps | cpanm</code></li> |
| 169 | +<li>Install optional dependencies with <code>dzil listdeps --suggests | cpanm</code></li> |
| 170 | +</ol> |
| 171 | + |
| 172 | +<h3 id="installation"><a href="#installation">Installation</a></h3> |
| 173 | + |
| 174 | +<ol> |
| 175 | +<li>Install operating system-specific dependencies and Rex itself with <code>dzil |
| 176 | +install</code></li> |
| 177 | +</ol> |
| 178 | + |
| 179 | +<h2 id="verifying-the-installation"><a href="#verifying-the-installation">Verifying the installation</a></h2> |
| 180 | + |
| 181 | +<p>After installation, check the current version with the following command:</p> |
| 182 | + |
| 183 | +<pre><code class="highlight">$ rex -v |
| 184 | +(R)?ex 1.16.0 |
| 185 | +</code></pre> |
| 186 | + |
| 187 | +<p>I also like to run an ad-hoc task locally, like printing the hostname:</p> |
| 188 | + |
| 189 | +<pre><code class="highlight">$ rex <span class="synSpecial">-e</span> <span class="synOperator">'</span><span class="synString">say run q(hostname)</span><span class="synOperator">'</span> |
| 190 | +</code></pre> |
| 191 | + |
| 192 | +<h2 id="summary"><a href="#summary">Summary</a></h2> |
| 193 | + |
| 194 | +<p>We looked at the main options to install Rex, their similarities and |
| 195 | +differences, as well as how to quickly verify the results.</p> |
| 196 | + |
| 197 | +<p>Choose the best approach according to the situation.</p> |
| 198 | + |
| 199 | + </section> |
| 200 | + |
| 201 | +</article> |
| 202 | + |
| 203 | +<ul class="pager"> |
| 204 | + <li class="prev"> |
| 205 | + <a href="/2025/02/26/virtues-of-rex/index.html" rel="prev"> |
| 206 | + ← Older |
| 207 | + </a> |
| 208 | + </li> |
| 209 | + <li class="next"> |
| 210 | + </li> |
| 211 | +</ul> |
| 212 | + |
| 213 | + |
| 214 | + </main> |
| 215 | + |
| 216 | + <footer> |
| 217 | + |
| 218 | + <ul> |
| 219 | + <li><a href="https://blog.ferki.it/index.rss" target="_blank">RSS</a></li> |
| 220 | + <li><a href="https://blog.ferki.it/index.atom" target="_blank">Atom</a></li> |
| 221 | + <li><a href="https://github.com/ferki" rel="me" target="_blank">GitHub</a></li> |
| 222 | + <li><a href="https://profile.codersrank.io/user/ferki" rel="me" target="_blank">CodersRank</a></li> |
| 223 | + <li><a href="https://www.linkedin.com/in/ferki" rel="me" target="_blank">LinkedIn</a></li> |
| 224 | + <li><a href="https://fosstodon.org/@ferki" rel="me" target="_blank">Mastodon</a></li> |
| 225 | + <li><a href="mailto:ferki@ferki.it">Email</a></li> |
| 226 | + <li><a href="/pages/impressum.html">Impressum</a></li> |
| 227 | + <li><a href="/pages/privacy_policy.html">Privacy policy</a></li> |
| 228 | + </ul> |
| 229 | + <ul> |
| 230 | + <li>© 2023–2025 Ferenc Erki</li> |
| 231 | + </ul> |
| 232 | + |
| 233 | + </footer> |
| 234 | + </body> |
| 235 | +</html> |
0 commit comments