Answers: <h1>Workaround with <a href="https://cloudinit.readthedocs.io/en/latest/reference/examples.html#run-commands-on-first-boot" rel="nofollow noreferrer"><code>runcmd</code></a></h1>
  <p>One method to work around this, if the feature doesn't exist is to use <a href="https://cloudinit.readthedocs.io/en/latest/reference/examples.html#run-commands-on-first-boot" rel="nofollow noreferrer"><code>runcmd</code></a>,</p>
  <p>You can use this to <code>yum install</code> or <code>curl</code> and hand the package to <code>dpkg</code>,</p>
  <pre class="lang-yaml prettyprint-override"><code>runcmd:
   - [ ls, -l, / ]
   - [ sh, -xc, &quot;echo $(date) ': hello world!'&quot; ]
   - [ sh, -c, echo &quot;=========hello world=========&quot; ]
   - ls -l /root
   # Note: Don't write files to /tmp from cloud-init use /run/somedir instead.
   # Early boot environments can race systemd-tmpfiles-clean LP: #1707222.
   - mkdir /run/mydir
   - [ wget, &quot;http://slashdot.org&quot;, -O, /run/mydir/index.html ]
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2024-08-05T17:50:06.527Z
Answers: 2024-08-05T17:50:06.527Z
Answers: Evan Carroll
Body: <p>I have a package hosted remotely as either a deb or rpm. Does cloud-init support installing packages from hard-coded remote locations. I'm wanting to install <a href="https://gitlab.com/gitlab-org/cli/#installation" rel="nofollow noreferrer">GitLab CLI</a> on machines I spin up but GitLab doesn't provide a repository.</p>
  
Tags: <cloud-init>
Title: Can cloud-init install a remotely hosted package with a url that's not in a repository?
UserDisplayName: Evan Carroll
ThreadText: # Can cloud-init install a remotely hosted package with a url that's not in a repository?
  
  (Asked by: username_0 on 2024-08-05)
  
  I have a package hosted remotely as either a deb or rpm. Does cloud-init support installing packages from hard-coded remote locations. I'm wanting to install [GitLab CLI](https://gitlab.com/gitlab-org/cli/#installation) on machines I spin up but GitLab doesn't provide a repository.
  
  **Tags:** cloud-init
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-08-05. Score: 0
  
  # Workaround with [`runcmd`](https://cloudinit.readthedocs.io/en/latest/reference/examples.html#run-commands-on-first-boot)
  
  One method to work around this, if the feature doesn't exist is to use [`runcmd`](https://cloudinit.readthedocs.io/en/latest/reference/examples.html#run-commands-on-first-boot),
  
  You can use this to `yum install` or `curl` and hand the package to `dpkg`,
  
  ```yaml
  runcmd:
   - [ ls, -l, / ]
   - [ sh, -xc, "echo $(date) ': hello world!'" ]
   - [ sh, -c, echo "=========hello world=========" ]
   - ls -l /root
   # Note: Don't write files to /tmp from cloud-init use /run/somedir instead.
   # Early boot environments can race systemd-tmpfiles-clean LP: #1707222.
   - mkdir /run/mydir
   - [ wget, "http://slashdot.org", -O, /run/mydir/index.html ]
  
  ```
  
  
  ---
  
  