I'm trying to install netcat using cloud-init.
As soon as I SSH'd to my vm, with all my keys configured correctly via cloud-init (meaning, it's executing), I try to run netcat and it doesn't work;
I'm using Container-Optimized OS (cos) as they refer to use it for cloud-init, and as of research I found cos is based on ChromiumOS kernel;
All I add to my cloud-init file is
packages:
- nano
- netcat
And none of them work.
Is there anything I'm missing to be able to add these packages?
Assuming you want to run tools like nano and netcat interactively in that session, you can use the CoreOS toolbox in Container-Optimized OS to install and run these tools.
$ toolbox apt-get install -y nano netcat
$ toolbox nano
Related
I have a dilemma, I am trying to set up the Microsoft slqsrv drivers for PHP and a laravel project so that it can connect to an RDS service and do my migrations, however, the Microsoft page dictates that the supported versions for the Ubuntu Server are 18, 20 and 21. The following snippet is the exact commands for an Ubuntu server from the official Microsoft page.
if ! [[ "18.04 20.04 21.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list >
/etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
Trying to run the commands without the if statement installs "something" but it ends up with errors, moreover, the pdo_sqlsrv and sqlsrv extensions do show up in the extensions list of PHP, running the command "php -m" shows that they are indeed loaded, but if I try to run the migration it shows the alert that the OBDC driver is missing.
What makes me think this is not working is that my EC2 instance has the Ubuntu 22 version, which would make sense since the drivers are not supported at the moment and are not installed properly. The options I concluded are that either somehow downgrade my Ubuntu version from my EC2 server or create a new instance with a version that supports the sqlsrv drivers. I don't know if there's a third option for the installation to work properly in this version, but I assume the previous two are the more sensible.
My question is, is it possible or recommended to downgrade the Ubuntu version of the EC2 server? or should I create a new instance with a compatible version?
One of the main benefits of the cloud is resource provisioning speed.
It takes seconds to create a new EC2 instance, it's much easier & quicker to just create a new instance with the Ubuntu 20.04 LTS or Ubuntu 18.04 LTS AMIs available.
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).
How to install FFMPEG in Google Cloud Shell. is that possible?
screenshot of error
sorry for my bad language
You can install FFmpeg on Cloud Shell using the following commands. However, your Cloud Shell machine is ephemeral and no system-wide change will persist beyond session end.
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg
Customize Cloud Shell
Background:
I created a sandbox VM with VirtualBox on my macOS. It correctly spins up a VM (with CentOS7 running on it) on which I can access to.
Inside this sandbox vm, I want to spin up several vms in order to test Ansible Playbooks with Kitchen CI & Vagrant, thus I installed VirtualBox by downloading it from the following link: https://download.virtualbox.org/virtualbox/5.2.8/VirtualBox-5.2-5.2.8_121009_el7-1.x86_64.rpm
After the installation I executed the command:
[david#vmkitchen-env ansible-test]# VBoxManage --version
It returned:
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (3.10.0-693.2.1.el7.x86_64) or it
failed to load. Please recompile the kernel module and install it
by
sudo /sbin/vboxconfig
You will not be able to start VMs until this problem is fixed.
5.2.8r121009
I installed the Development tools, but I keep getting the same issue.
I don't think I need to recompile any kernel module. Any idea?
Thanks in advance for your help.
So, after searching on the internet, and not just on the VirtualBox website, I found the solution, and I was right: I did not need to compile any module.
The following is the reference to the CentOS wiki page:
https://wiki.centos.org/HowTos/Virtualization/VirtualBox
In a few words, I had to install dkms and kernel-devel packages. In order to do so, I needed to install EPEL repository; but personally I prefer to install and enable the IUS repository.
The following are the set of commands that worked for me:
yum groupinstall "Development tools"
yum install https://centos7.iuscommunity.org/ius-release.rpm
yum install dkms
yum install kernel-devel
reboot
After the machine had rebooted, I was able to get VirtualBox working fine.
I verified by the command line:
[david#vmkitchen-env ansible-test]# VBoxManage --version
And it returned the correct value:
5.2.8r121009
Below steps fixed the issue for me.
1.sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-957.10.1.el7.x86_64
2.This website has the kernel module - website
wget https://linuxsoft.cern.ch/cern/centos/7/updates/x86_64/Packages/kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm
4.yum localinstall kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm -y
5.sudo /sbin/vboxconfig
Issue resolved
On Fedora 36, I only had to run
sudo /sbin/vboxconfig
I am new to AWS.
I created a Linux free tier instance and its up and running as i am able to access it via ssh putty as i am a windows user.
Now, I wanted to RDP the Linux Instance to see the interface but i am unable to do so. I am unable to find any option for that.
As per my understanding by reading online forms, it is not possible to RDP LinuxInstance on AWS.
If anyone can give there expert opinion if it is possible to RDP the Linux Instance? If not then Is there any way I can access the graphical interface for Linux Instance in AWS or I just have to work with command line interface from my local machine?
Amazon had a page that described how to do this with various linux versions but they took it down. Here are the steps for Linux 16.04. I just did this on a new ubuntu ec2 instance and it worked fine.
sudo apt update && sudo apt upgrade
sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
sudo passwd ubuntu
sudo apt install xrdp xfce4 xfce4-goodies tightvncserver -y
echo xfce4-session> /home/ubuntu/.xsession
sudo cp /home/ubuntu/.xsession /etc/skel
sudo sed -i '0,/-1/s//ask-1/' /etc/xrdp/xrdp.ini
sudo service xrdp restart
RDP is a proprietary protocol developed by Microsoft, Linux servers do not come in with GUI, you need to SSH into Linux box and then install packages to enable desktop GUI functionality
Here is an article from AWS
https://aws.amazon.com/premiumsupport/knowledge-center/connect-ec2-centos-windows/
Note: Amazon Linux does not provide any desktop GUI functionality
try install GNOME packages i.e.,
$sudo yum -y groupinstall "Server with GUI"
$sudo systemctl enable xrdp; systemctl start xrdp
now try login from your windows machine using "windows remote desktop or any vnc client