Best way to install rpms

Here I am installing vs code
0. Add dnf bundle
…> sudo swupd bundle-add dnf

  1. Add the official rpm repo
    …> sudo mkdir /etc/yum.repos.d/
    …> sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
    …> sudo sh -c ‘echo -e “[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc” > /etc/yum.repos.d/vscode.repo’
    …> dnf check-update

  2. Download rpm
    …> sudo dnf download code

  3. Install rpm
    …> sudo rpm -U --nodeps ./code*.rpm

Now we can keep track of updates just with a single command

…> dnf check-update
if this do not work
…> dnf check-update --refresh

If new updates available we can repeat above steps

Hope this helps

Correct me if I am wrong

update:
recently I found that a new version of vs code released, but dnf check-update was unable to sync that.
use
→ dnf check-update --refresh
instead

edit:
There are many steps to do so, even better ones. The above steps will help us to keep track of updates, so that we won’t have to visit their websites to get rpms every week, or to check for updates.

1 Like

That’s one way to do it. Quite a few recommend rpm2cpio. Personally I prefer using make and curl with rpm, in place of dnf. Using a makefile controlled “recipe based” approach allows me to reuse some the same code on other distros (or other recipes), or even to just get a tarball (when available) with curl (and jq) and skip the rpm step in some environments. I think the actually “recommended” line is use bundle of possible, otherwise compile from source (/usr/local prefix) or extract an archive when available, or convert rpm to cpio archive. Everyone will do of course what works best for them.

So inmanturbo:
How would your approach to install rpm compare line by line taking one common example of installing chrome, vs. process outlined above by UbitoUchiha, also process utilizing rpm2cpio and process published by Mattia Verticchio in Clear Linux Tutorials?
In result of using this simple example of installing Chrome from rpm we would have four different processes leading to the same result.
Truly worth documenting… Certainly would be greatly beneficial to so many users of Clear Linux so it would be more accessible to larger population of CL fans, not just system admins…
Thanks and Regards…

Actually, TBH on new systems I use MattiaVerticchio’s example for chrome when I’m in a hurry and in the wild with no other tools onhand (and can’t remember the download url). It comes up first in a google search and when I’m in a hurry I need chrome fast, because I use chrome to speed up other workflows. I may make a few changes later, but that is a good quick way to just go and quickly get it. The only immediate change I make is to add --prefix=/opt to put it in a little better location. And the line

sudo tee -a /etc/profile.d/fonts.sh <<'EOF'
#!/bin/bash
export FONTCONFIG_PATH=/usr/share/defaults/fonts
EOF

Many of my zsh scripts use google with chrome to grab documents and resources. Anyway that is actually already a good example of using native curl without bothering to define a repo for dnf.

Thanks for the insight.
So, in addition to process outlined above by UbitoUchiha the process example for Chrome published by MattiaVerticchio would in general be good for other than Chrome rpms? Perhaps with some adjustments to location you outlined?
By the way, the addition of ‘–prefix=/opt’, on which line would this be added?
Thanks and Regards…

You would add it to this line here:

rpm -U --nodeps --prefix=/opt google-chrome*.rpm

This is not possible with all RPM packages. You can check if an RPM package is relocatable with

rpm -qpi [rpm package] | grep Relocations

i.e

rpm -qpi google-chrome-stable_current_x86_64.rpm|grep Relocations
Relocations : /opt 
rpm -qpi vscode-latest.rpm|grep Relocations
Relocations : (not relocatable)

You can get more information if you do not pipe through grep:

❯ rpm -qpi google-chrome-stable_current_x86_64.rpm
Name        : google-chrome-stable
Version     : 83.0.4103.116
Release     : 1
Architecture: x86_64
Install Date: (not installed)
Group       : Applications/Internet
Size        : 235742337
License     : Multiple, see https://chrome.google.com/
Signature   : DSA/SHA1, Fri 19 Jun 2020 04:41:19 PM EDT, Key ID a040830f7fac5991
Source RPM  : google-chrome-stable-83.0.4103.116-1.src.rpm
Build Date  : Fri 19 Jun 2020 04:12:17 PM EDT
Build Host  : vm7-h0.official.chromium.org
Relocations : /opt 
Packager    : Chrome Linux Team <chromium-dev@chromium.org>
Vendor      : Google LLC
URL         : https://chrome.google.com/
Summary     : Google Chrome
Description :
The web browser from Google

Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.
1 Like

Thanks inmanturbo.
This is great info. Such info as well as processes to install rpms are important pieces worth documenting in tutorials… Hopefully others will add more info to this discussion as well…
Greatly appreciated.

Hello, thanks for looking into this. And just because I feel lost after browsing through this thread, would anyone care to summarize the topic of “RPM installation in Clear Linux” in a concise post please (esp. since it’s been a while since this thread emerged)?