RHEL yum update commad failed in aws ec2 instance - amazon-web-services

While running $ sudo yum -y update in RHEL, the execution failed with the error message:
Could not open: jenkins-2.249.1-1.1.noarch.rpm
error: gpg check failed.
Why do I get this error message and how can I resolve it?

Update Red Hat or its compatible operating systems using the below command:
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Then execute
$ sudo yum -y update
If the above package is out of date in the future, please click here to read more info: https://www.jenkins.io/blog/2020/07/27/repository-signing-keys-changing/

Related

how to install a package in running vm instance in GCP

while we have connect to compute engine and ssh to one of the engine
when we try to run below command
sudo apt-get packagename
error: -bash: apt: command not found
is there any way to install in the running instance
You should have chosen an Ubuntu image, when expecting apt-get to function.
The command is probably sudo dnf install - that's depending on the image.

Unable to install syslog-ng on amazon linux 2

I have started EC2 instance from L=amazon linux 2 AMI.
I am trying to install syslog-ng with yum but I am getting error.
Commands used :
$ sudo amazon-linux-extras install epel -y
$ sudo yum install syslog-ng
AND
$ sudo yum-config-manager --add-repo=https://copr.fedorainfracloud.org/coprs/czanik/syslog-ng321/repo/epel-7/czanik-syslog-ng321-epel-7.repo"
$ sudo yum install --enablerepo=epel --assumeyes syslog-ng
But I am getting following error in both the cases:
Loaded plugins: dkms-build-requires, extras_suggestions, langpacks, priorities, update-motd
215 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package syslog-ng.x86_64 0:3.23.1-1.el6 will be installed
--> Processing Dependency: libmaxminddb.so.0()(64bit) for package: syslog-ng-3.23.1-1.el6.x86_64
--> Processing Dependency: libpcre.so.0()(64bit) for package: syslog-ng-3.23.1-1.el6.x86_64
--> Running transaction check
---> Package libmaxminddb.x86_64 0:1.2.0-1.el7 will be installed
---> Package syslog-ng.x86_64 0:3.23.1-1.el6 will be installed
--> Processing Dependency: libpcre.so.0()(64bit) for package: syslog-ng-3.23.1-1.el6.x86_64
--> Finished Dependency Resolution
Error: Package: syslog-ng-3.23.1-1.el6.x86_64 (copr:copr.fedorainfracloud.org:czanik:syslog-ng323epel6)
Requires: libpcre.so.0()(64bit)
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
cloud-init-19.3-44.amzn2.noarch has missing requires of rsyslog
I wrote these instructions a year ago: https://www.syslog-ng.com/community/b/blog/posts/installing-syslog-ng-in-amazon-linux-2-including-graviton2
I do not have any AWS accounts right now, but if they do not work, the I'll try to get one...
**Update:**
First of all: I double checked your report. You mention adding a repo for EPEL 7 syslog-ng 3.21, however the error below it is about syslog-ng 3.23 for EPEL 6.
OK, I got access. I followed my own instructions and it works:
[ec2-user#ip-xxx ~]$ syslog-ng -V
syslog-ng 3 (3.29.1)
Config version: 3.29
Installer-Version: 3.29.1
Revision:
Compile-Date: Aug 29 2020 08:27:16
Module-Directory: /usr/lib64/syslog-ng
Module-Path: /usr/lib64/syslog-ng
Include-Path: /usr/share/syslog-ng/include
Available-Modules: add-contextual-data,affile,afprog,afsocket,afstomp,afuser,appmodel,basicfuncs,cef,confgen,cryptofuncs,csvparser,dbparser,disk-buffer,examples,graphite,hook-commands,json-plugin,kvformat,linux-kmsg-format,map-value-pairs,pseudofile,sdjournal,stardate,syslogformat,system-source,tags-parser,tfgetent,timestamp,xml,azure-auth-header,http
Enable-Debug: off
Enable-GProf: off
Enable-Memtrace: off
Enable-IPv6: on
Enable-Spoof-Source: on
Enable-TCP-Wrapper: on
Enable-Linux-Caps: on
Enable-Systemd: on
[ec2-user#ip-xxx ~]$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
And tried to latest version (3.35), and that works as well.
Tried with specific package and its able to install.
$ sudo yum --enablerepo=epel -y install syslog-ng-3.5.6-3.el7.x86_64

GCP METADATA OSCONFIG:TRUE casues yum check-update to fail repo not found

With the new OS Patching feature in GCP on Debian 9 Stretch>>
Having added the settings for the project metadata enable-osconfig to true and enable-guest-attributes to true, GCP Logging is showing the following error log:-
Error Applying yum changes, attempt 1, retrying in 1s: error running yum with args ["check-update" "--assumeyes"]: exit status 1, stdout: There are no enabled repos. Run "yum repolist all" to see the repos you have. You can enable repos with yum-config-manager --enable <repo>
having Run "yum repolist all" the response is repolist: 0
it appears that yum cannot find the repo that OSCONFIG metadata has attempted to add
Log entry: Writing repo file /etc/yum.repos.d/google_osconfig_managed.repo with updated contents
How do I now solve the error and get yum-config-manager to reference and install this repo that apparently exists (as above)?
I have tried variations of :
yum -config-manager --enable /etc/yum.repos.d/google_osconfig_managed.repo
but to no avail oddly the reponse is:
CRITICAL:yum.cli:Config Error: Error accessing file for config file:///home/accounts/onfig-manager
Any ideas? even the URL to the REPO might help?!
p.s. I'll need the exact syntax as I'm not familiar really with BASH
I note you are mixing Operating Systems; For Debian 9 Stretch, firs of all install the agent by running this commands [0], then you will need to add the debian repository [1], then if you are not uising "Google-provided image" you will need to import the Google Cloud public key [2]. Finally, verify the agent is running in your instance [3]:
[0]
sudo apt update
sudo apt -y install google-osconfig-agent
[1]
sudo su -c "echo 'deb http://packages.cloud.google.com/apt \ google-compute-engine-stretch-stable main'> /etc/apt/sources.list.d/google-compute-engine.list"
[2]
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ sudo apt-key add -
[3]
systemctl status google-osconfig-agent
Note: yum is used for CentOS/RedHat OS. Yoy can see detailed information and "how to" guides about this in GCP official documentation

How to install docker on Amazon Linux2

I wanna create docker image for Amazon ECR.
but yum can't find it in my Amazon Linux2.
[root#*** ~]# yum install -y docker
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
No package docker available.
Error: Nothing to do
Next, I tried to use amazon-linux-extras.
but amazon-linux-extras is not found, too.
[root#*** ~]# amazon-linux-extras install docker -y
-bash: amazon-linux-extras: command not found
[root#*** ~]# find / -name 'amazon-linux-extras'
[root#*** ~]$ cat /proc/version
Linux version 4.14.77-81.59.amzn2.x86_64 (mockbuild#ip-10-0-1-59) (gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)) #1 SMP Mon Nov 12 21:32:48 UTC 2018
How can I install amazon-linux-extras or create docker image?
Install Docker
sudo yum update -y
sudo yum -y install docker
Start Docker
sudo service docker start
Access Docker commands in ec2-user user
sudo usermod -a -G docker ec2-user
sudo chmod 666 /var/run/docker.sock
docker version
So sorry, it was my misunderstanding.
My OS is Redhat Linux.
I get to install docker by
yum-config-manager --enable rhui-REGION-rhel-server-extras
yum -y install docker
systemctl start docker
systemctl enable docker
docker version
Make sure you have amazon-linux-extras installed
[root#ip-20-0-0-112 ~]# which amazon-linux-extras
/usr/bin/amazon-linux-extras
If not install amazon-linux-extras using yum
yum -y install amazon-linux-extras
Then install docker using
amazon-linux-extras install docker
I'm on amazon linux (RHEL 7.2) - ami-035b3c7efe6d061d5,
cat /proc/version
Linux version 4.14.123-86.109.amzn1.x86_64 (mockbuild#koji-pdx-corp-builder-64004) (gcc version 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC)) #1 SMP Mon Jun 10 19:44:53 UTC 2019
Following script works without having to install amazon-linux-extras install
sudo yum -y install docker
sudo service docker start
sudo chmod 666 /var/run/docker.sock
I had to fix permission issue. Also described here How to fix docker: Got permission denied issue
Then I can check containers,
[ec2-user#ip-30-0-0-196 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
For the Amazon Linux AMI, access to the Extra Packages for Enterprise Linux (EPEL) repository is configured, but it is not enabled by default.
To install amazon-linux-extras, verify connection to the internet from within the instance then check the instance's OS:
cat /etc/os-release
If the OS is amazon linux version 2 run
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Or run sudo yum-config-manager --enable epel
To use the EPEL repository. You can now install available packages... e.g. sudo amazon-linux-extras install docker
see aws documentation for more details.
You can use the below script to install docker inside Amazon Linux 2 Instance. Also, you can mention the below script in the ec2 user data section so at the time of server bootstrap docker will be installed automatically.
#!/bin/bash
sudo yum update -y
sudo yum -y install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo chmod 666 /var/run/docker.sock
Amazon Linux 2 comes with amazon-linux-extras installed. If you think that you are running Amazon Linux 2, and amazon-linux-extras is not on the path of the ec2-user, you might be running an older version of Amazon Linux. Run this command:
grep PRETTY_NAME /etc/os-release
It should output
PRETTY_NAME="Amazon Linux 2"
If you don't see that, go back to the ec2 console and drill-down into the details of the instance. Clicking on the AMI should reveal that it corresponds to an older version of Amazon Linux. Some AWS facilities, notably CDK, currently default to Amazon Linux instead of Amazon Linux 2 when creating new instances.
I came across this question when trying to set up a docker image, based on Amazon Linux 2.
What I didn't find in the current answers is that the docker needs to be enabled in amazon-linux-extras before installing.
Dockerfile commands that worked for me:
RUN yum install -y amazon-linux-extras
RUN amazon-linux-extras enable docker
RUN yum install -y docker

AWS EC2 instance based on RHEL7.2 ami can not install Docker

I created one EC2 instance that's based on AMI: RHEL-7.2_HVM-20161025-x86_64-1-Hourly2-GP2 - ami-2265c543 , but when I wanna install docker via yum install docker -y it shows me error: No package docker available. Error: Nothing to do . So anyone know how to install docker on this ami OS?
thanks in advance.
You can install Docker-CE by setting up Docker repo.
To do So, you can follow official Documentation (Use Docker EE for RHEL).
Install required packages
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
Use the following command to set up the stable repository
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
INSTALL DOCKER CE
sudo yum install docker-ce
Start Docker
sudo systemctl start docker
AWS — RHLE7.5 Free Tier with Docker CE
Since docker is considered an “Extra” rpm with RHLE, then let's explain how you can use Centos Docker Community Edition (CE) for RHLE.
The above step of installing helped me to resolve the problem.
Below I am listing steps to install docker-ce on RHEL.
sudo yum install -y yum-utils
sudo yum-config-manager — add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum makecache fast
To avoid error “Requires: container-selinux >= 2.9”
Run following command
sudo yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
To avoid error “libtool-ltdl-2.4.2–22.el7_3.x8 FAILED” Run following command
yum install -y http://mirror.centos.org/centos/7/os/x86_64/Packages/libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm
To avoid Error: Package: docker-ce-18.03.1.ce-1.el7.centos.x86_64 (docker-ce-stable)
Run:
yum install -y http://mirror.centos.org/centos/7/extras/x86_64/Packages/pigz-2.3.3-1.el7.centos.x86_64.rpm
sudo yum -y install docker-ce
Can test the docker running with command: sudo systemctl start docker
To check to see if your service is running you can use:
sudo service docker status

Categories