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.
Related
I'm trying build an image for use on EC2 instances in an AWS Batch job. I need to use Ubuntu 18.04 because the goal is to run some Fortran software that I can only get to compile on Ubuntu 18.04. I have the Fortran software and some python scripts running well on a manually started Ubuntu 18.04 EC2 instance.
Now, I'm trying to build an image with Docker (that I'll eventually apply to 100s or 1000s of EC2 instances)... but I have to get CloudWatchAgent (CWA) installed and started, and I can't get CWA to start in the Docker build. CWA starts and runs fine in my manual EC2 development instance (Ubuntu 18.04). I initially had problems with CWA in my manual instance because CWA uses systemctl, and so I had to manually install systemd, and that worked after a reboot. But, I'm not able to replicate this in my Docker build, but always get the error:
System has not been booted with systemd as init system (PID 1). Can't operate.
unknown init system
The command '/bin/sh -c sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:amazon-cloudwatch-agent.json' returned a non-zero code: 1
I tried starting with an ubuntu 18.04 image that is supposed to have systemd already installed, and tried rebooting my EC2 instance, same error. Here's the source: https://hub.docker.com/r/jrei/systemd-ubuntu
I looked for other ideas, e.g.: Docker System has not been booted with systemd as init system
... but couldn't figure out how to make it work in a Docker build.
So,
am I using the Ubuntu 18.04 image (that has systemd) in my build wrong- how to use in a Docker build?
is there another way to start CloudWatchAgent in Ubuntu 18.04 that gets around the systemd problem?
would it work/is there a way to restart the operating system inside the Docker container, during the docker build stage?
am I stuck and will have to try recompile everything on a different Ubuntu or AMI like Amazon Linux?
Or is there something else I'm missing?
Here's my Docker file:
#version with systemd already installed
FROM jrei/systemd-ubuntu#sha256:1b65424e0ec4f6772576b55c49e1470ba506504d1033e9da5795785b1d6a4d88 as ubuntu-base
RUN apt-get update && apt-get install -y \
sudo \
wget \
python3-pip
RUN sudo apt-get -y install libgfortran3
RUN sudo pip3 install boto3
RUN wget https://s3.us-east-2.amazonaws.com/amazoncloudwatch-agent-us-east-2/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
RUN sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
COPY . .
RUN cp amazon-cloudwatch-agent.json /opt/aws/amazon-cloudwatch-agent/etc/
ENV ECS_AVAILABLE_LOGGING_DRIVERS = awslogs
RUN sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:amazon-cloudwatch-agent.json
RUN mkdir -p cpseqlogs
CMD python3 cpsequence.py
Thanks for any suggestions, ideas, or tips (I'm fairly new to Docker, but not totally green on linux).
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/
I am trying to install a scanner for my Django application which refers to this place /var/run/clamd.scan/clamd.sock but I don't have the following folder on ubuntu 18+. I tried to install it using sudo apt-get install clamav but I still have no visible folery. How can I install it on ubuntu? or maybe he is in a different place.
for the server files, you may need to install the daemon:
sudo apt-get install clamav clamav-daemon
sudo service clamav-freshclam restart
sudo service clamav-daemon restart
Im following these steps to install gRPC on my freshly launched AWS EC2 Instance:
https://jitpaul.blog/2018/04/18/grpc-on-aws/
When I try to execute this line:
sudo yum install libgflags-dev libgtest-dev
I get this error:
I don't want to mess up anything, please help.
Try instead:
sudo yum install gflags-dev
sudo yum install gtest-dev
That should install libgflags-dev and libgtest-dev.
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