CentOS RPM Packages - centos

When I do rpm -qa | grep nano I can see that Nano Text Editor is installed onto my CentOS box.
But when I do rpm -qpi nano-2.9.8-1.el8.x86_64.rpm in the below given directory it shows me Install Date: (not installed)
Directory: cd /run/media/root/CentOS-8-BaseOS-x86_64/BaseOS/Packages/
[root#karancentos ~]# cd /run/media/root/CentOS-8-BaseOS-x86_64/BaseOS/Packages/
[root#karancentos Packages]# rpm -qpi nano-2.9.8-1.el8.x86_64.rpm
Name : nano
Version : 2.9.8
Release : 1.el8
Architecture: x86_64
Install Date: (not installed)
Group : Unspecified
Size : 2328511
License : GPLv3+
Signature : RSA/SHA256, Mon 01 Jul 2019 08:15:52 PM EDT, Key ID 05b555b38483c65d
Source RPM : nano-2.9.8-1.el8.src.rpm
Build Date : Sat 11 May 2019 11:03:56 AM EDT
Build Host : x86-02.mbox.centos.org
Relocations : (not relocatable)
Packager : CentOS Buildsys <bugs#centos.org>
Vendor : CentOS
URL : https://www.nano-editor.org
Summary : A small text editor
Description :
GNU nano is a small and friendly text editor.
I'm not sure why does it comes up when doing rpm -qa | grep nano and then when I do rpm -qpi nano-2.9.8-1.el8.x86_64.rpm it shows me Install Date: (not installed)
Can someone please help me understand this?
Thanks!!

Using rpm -qpi <file> you're only querying a specific RPM package on the filesystem, here nano-2.9.8-1.el8.x86_64.rpm. However, without querying the RPM database (which does not happen if you use -p parameter!), the package is shown as "not installed". Only the RPM database knows if a package is installed or not. You're looking for rpm -qi <package>, thus rpm -qi nano in the specific case – this queries the RPM database and you will get the install date.

Related

How to install brew on a raspberry pi?

These are my raspberry pi OS, Kernel version and archtecture configs
Operating System: Raspbian GNU/Linux 10 (buster)
Kernel: Linux 5.10.52-v7l+
Architecture: arm
When I try to run their script(https://brew.sh/):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
I get
Homebrew on Linux is only supported on Intel processors!
and, whenever I try to run a brew command, I get:
-bash: brew: command not found
Homebrew for linux is called Linuxbrew. And the installation command that you need is:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
Please check out this link to get more info about it: https://github.com/Linuxbrew/brew
Also notice that while Linuxbrew can run on Raspberry Pi (32-bit ARM), no binary packages are available for it.
Here are my two cents on installing brew on RaspberryPi Zero W and RaspberryPi 3+ (RaspberryPi OS, bullseye).
$ # Install dependencies
$ sudo apt update -y && sudo apt upgrade -y
$ sudo apt install git
$ # Install rbenv and Ruby 2.6.8 (It takes 30-90 min.)
$ # As of 2022/06/09, ARM processors require Ruby 2.6.8.
$ # Check the gist below what is doing as well.
$ bash <(curl -sL https://gist.github.com/KEINOS/7101f542be23e5048198e2a27c3cfda8/raw/install_ruby_rpi.sh)
$ source ~/.bashrc
$ # Smoke test Ruby
$ ruby --version
ruby 2.6.8p205 (2021-07-07 revision 67951) [armv6l-linux-eabihf]
$ # Clone homebrew repo under /opt
$ sudo git clone --depth=1 https://github.com/Homebrew/brew /opt/homebrew
$ # Setup homebrew
$ sudo chown -R $(whoami) /opt/homebrew
$ echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bashrc
$ source ~/.bashrc
$ # Full update to tap homebrew/core (It takes 30-90 min.)
$ brew update --force --verbose
$ # Smoke test brew
$ brew --version
Homebrew 3.5.1
Homebrew/homebrew-core (git revision 1d9fb5dd1e6; last commit 2022-06-09)
$ # Install "hello world" package which supports both 32bit and 64 bit ARM.
$ # - Source: https://github.com/KEINOS/Hello-Cobra
$ # - Formula: https://github.com/KEINOS/homebrew-Hello-Cobra
$ brew install KEINOS/Hello-Cobra/hello-cobra
***snip***
$ hello-cobra hello world
Hello, world!
$ # Env info of RaspberryPi Zero W
$ more /proc/device-tree/model
Raspberry Pi Zero W Rev 1.1
$ cat /etc/debian_version
11.3
$ uname -a
Linux rpi-zero 5.10.92+ #1514 Mon Jan 17 17:35:21 GMT 2022 armv6l GNU/Linux
$ whoami
pi
$ echo $SHELL
/bin/bash
$ # Env info of RaspberryPi 3+
$ more /proc/device-tree/model
Raspberry Pi 3 Model B Rev 1.2
$ cat /etc/debian_version
11.3
$ uname -a
Linux rpi-3pls 5.10.92-v8+ #1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux
$ whoami
pi
$ echo $SHELL
/bin/bash
Note that everything for brew is slow on ARM6. Patience is required not only when setting up linuxbrew, but also when installing packages using brew.
However, once the package has been successfully installed, it should work as fast as expected. So, I'd say it is worth trying linuxbrew on the ARM6 and ARM64 architectures.
References
ARM | Homebrew on Linux # docs.brew.sh
Untar anywhere | Installation # docs.brew.sh
How can I check the available version of a package in the repositories? # AskUbuntu.com
Installing Ruby versions | rbenv # GitHub
Raspberry Pi
Homebrew can run on Raspberry Pi (32-bit ARM), but no binary packages
(bottles) are available. Support for Raspberry Pi is on a best-effort
basis. Pull requests are welcome to improve the experience on
Raspberry Pi.
https://docs.brew.sh/Homebrew-on-Linux
Two comments on installing Homebrew on Raspberry Pi 400 Rev 1.0, Raspbian Debian 11.5.
For an unknown reason Homebrew installer requires exactly ruby version 2.6.8. My Pi has ruby 2.7.4 but that was not accepted
After installing 2.6.8 using the above hint (ruby-build available from the regular repository does not offer it, the next after 2.6.6 being 2.7.0), the brew update --force --verbose command was still failing on not finding 2.6.8. It was so because the 'brew' script has the PATH explicitely filtered to the system one, "/usr/bin:/bin:/usr/sbin:/sbin". Only after manually adding the path for ruby 2.6.8 did the update work. NB. the script was overwritten during the process so in order to install any package I had to add the path it again.
Any idea why it is "exactly 2.6.8" and not "2.6.8 or newer"?

Problems (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on ansible-awx's Python /bin/python3

SUMMARY:
I has done the installation ansible-awx follow the instruction:
https://howto.lintel.in/install-ansible-tower-awx-centos-7/
ISSUE TYPE :
When i ran command ansible-playbook -i inventory install.yml -vv
in folder source awx /root/awx/installer
Bug Report :
TASK [local_docker : Start the containers] ********************************************************************************************************************************
task path: /root/awx/installer/roles/local_docker/tasks/compose.yml:39
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on ansible-awx's Python /bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via pip install docker or pip install docker-py (Python 2.6). The error was: No module named 'requests'"}
PLAY RECAP ****************************************************************************************************************************************************************
localhost : ok=13 changed=2 unreachable=0 failed=1 skipped=86 rescued=0 ignored=0
I try ran command with : ansible-playbook -i inventory install.yml -e 'ansible_python_interpreter=/usr/bin/python3'
But error the error appears similar above .
ANSIBLE VERSION
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
OS: CentOS Linux release 7.8.2003 (Core)
Thanks for helping !
I've got the same error and I solved it installing python36-docker and docker-componse.
yum install python3 python36-docker -y
pip3 install docker-compose
then rerun:
ansible-playbook -i inventory install.yml
I run into the same issue, the following command executed on managed node (host) helped:
$ pip3 install docker

Docker-compose: /usr/local/bin/docker-compose : line 1: Not: command not found

i'm trying to install Docker-compose on my Raspberry Pi 3+ which installed Raspbian buster.
I followed instruction on docker.com. After I entered command : sudo curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose.
It show a table for downloading
Result
It seems nothing downloaded, just have a file docker-compose saved in /usr/local/bin/docker-compose. When I opened it, it empty. Then I enter command docker-compose -v, it displayed error /usr/local/bin/docker-compose : line 1: Not: command not found.
Anyone have solution?
UPDATE:
Added the following command to my answer to download the LATEST version without specifying any version number at all so the download can be scripted.
curl -L "https://github.com/docker/compose/releases/download/$(curl https://github.com/docker/compose/releases | grep -m1 '<a href="/docker/compose/releases/download/' | grep -o 'v[0-9:].[0-9].[0-9]')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
It's a bit untidy, but it works. If you have a more elegant way than mine, ping it to me in the comments and I'll update my answer.
Just need to set the perms on the file:
chmod +x /usr/local/bin/docker-compose
Use the file command to validate that you pulled the correct arch for your system.
Intro:
Although docker-compose can be installed from a repo per the accepted answer, apt-cache show docker-compose reveals that as of 20211201 the repo version is only v1.25; about 2 years behind the current v2.1.1 release. In order to take advantage of more modern docker file versions, I needed to get the Github download working.
Short Answer:
The Docker documentation for Docker-Compose is WRONG. They forgot to preface the version number in the command with a "v"; consequently the download fails. Apparently this has been wrong for ages...
Longer Answer:
I ran the below command from the Docker-Compose documentation, and substituted the version "2.1.1" for "1.29.1" per Docker's guidance:
To install a different version of Compose, substitute 1.29.2 with the
version of Compose you want to use.
sudo curl -L "https://github.com/docker/compose/releases/download/2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
The resulting download was 9 KB for a 23 MB binary. Clearly the link was bogus. So I went to the root of the address used in the command "https://github.com/docker/compose/releases" and right-clicked on the version of Docker-Compose that I wanted and chose "Copy Link Address"
This revealed the link Docker was telling folks to use didn't have a "v" prefaced before the version number in the https:// address part of the command.
Solution:
Preface a "v" before the version number you want in the link as below and the command executes successfully:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
BTW, I too was downloading docker-compose for a Raspberry Pi using the aarch64 binary for Ubuntu 20.04 LTS. However, the missing "v" fix for the broken download address should work for any platform.
This is because on a raspberry pi the url part of the command results in
https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-armv7l
Looking at the latest stable release at https://github.com/docker/compose/releases/tag/1.24.1 you can see there is no download for the armv7l architecture so the file is empty because there is nothing to download.
Will update answer once I figured out how to install docker-compose on Raspian.
Edit:
Via apt-get. Note: Currently (Nov. 8 2019) this installs version 1.21 which is not the latest available.
sudo apt-get install docker-compose
Via pip3. (Installs latest)
sudo apt-get install python3-pip
sudo pip3 install docker-compose
And then restart your system with
sudo shutdown -r

snort installation error on centos 6.5

[root#localhost ~]# service snortd start
Starting snort: /usr/sbin/snort: error while loading shared libraries: libdnet.1: cannot open shared object file: No such file or directory
[FAILED]
But libdnet is installed:
root#localhost ~]# rpm -qa libdnet
libdnet-1.11-1.2.el6.rf.x86_64
I had a similar problem using snort-2.9.6.2-1.centos6.x86_64.rpm downloaded from snort.org.
yum install snort-2.9.6.2-1.centos6.x86_64.rpm would not work because it needed version 1.11-1.2.el6 and the current version is 1.12-6.el6 so I had to download the rpm and from http://pkgs.repoforge.org/libdnet. After installing that my snort would install.
That aside I see you are already using the right version but it still doesn't work. So try this
# find / -name 'libdnet*'
/usr/lib64/libdnet.so.1.0.1
/usr/lib64/libdnet.so.1
# cd /usr/lib64
# ln -s libdnet.so.1.0.1 libdnet.1
Snort should now start assuming everything else such as the conf files are set up ok

How to programmatically install the latest epel-release rpm, without knowing its version number?

My first post here, but I googled around and cannot find a simple way to do this.
I have a program which automatically configures new CentOS Linux servers as they come online. As part of the process it installs the latest version of epel-release rpm.
The command I use looks like this:
$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm && \
yum clean all
This works great... until they change the rpm file to epel-release-6-8.noarch, then epel-release-6-9.noarch, and so on. They seem to update the version every 3-4 months. This is a problem, because if the repository updates the epel-release version number, my scripts will fail because it has no idea what that version should be.
I failed to find a link that might redirect to the latest epel rpm file, so I have no choice but to hard-code the version into my install scripts, and change it when they fail.
Anyone know a simple (non-hard-coded) way to download the latest epel rpm without knowing the version number? I'm hoping for a way that does not involve dong a curl on the repo file list and grep'ing the url, but curious what anyone might suggest?
The following script will do the trick:
cat <<EOM >/etc/yum.repos.d/epel-bootstrap.repo
[epel]
name=Bootstrap EPEL
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-\$releasever&arch=\$basearch
failovermethod=priority
enabled=0
gpgcheck=0
EOM
yum --enablerepo=epel -y install epel-release
rm -f /etc/yum.repos.d/epel-bootstrap.repo
It should work on RHEL/CentOS 5 and 6. I didn't test version 4.
The EPEL project has recently implemented "latest" symlinks for the epel-release package.
https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
​https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
See https://fedorahosted.org/epel/ticket/8#comment:12
Do it right from the shell:
$ EPEL_BASEURL=http://dl.fedoraproject.org/pub/epel/$(awk '/rhel/ {print $2}' /etc/rpm/macros.dist)/$(uname -p)/
$ rpm -ivh $EPEL_BASEURL$(curl -s $EPEL_BASEURL | grep epel-release | awk -F'<|>' '{print $5}')
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.zRXE1U: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
I've tested this on CentOS 6.4, 6.5 and 6.6 and RHEL 6.5 and 6.6, but the contents of /etc/rpm/macros.dist and the HTML code from http://dl.fedoraproject.org should be consistent on all platforms, so this should work on all platforms.
For posterity's sake, here it is with more detail:
$ EPEL_BASEURL=http://dl.fedoraproject.org/pub/epel/$(awk '/rhel/ {print $2}' /etc/rpm/macros.dist)/$(uname -p)/
# http://dl.fedoraproject.org/pub/epel/6/x86_64/
$ EPEL_RELEASE_RPM=$(curl -s $EPEL_BASEURL | grep epel-release | awk -F'<|>' '{print $5}')
# epel-release-6-8.noarch.rpm
$ EPEL_RELEASE_RPMURL=$EPEL_BASEURL$EPEL_RELEASE_RPM
# http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -ivh $EPEL_RELEASE_RPMURL
Retrieving http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.ep6xy3: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]