Error on install SSL in EC2 with Let's Encrypt - amazon-ec2

I'm pretty new on aws ec2, I'm trying to get a free ssl with Let's Encrypt. I've watched a video in youtube to learn it, but I have a problem, my terminal says sudo: add-apt-repository: command not found, always when I type the command add-apt-repository ppa:certbot/certbot
I'm using Amazon Linux AMI 2018.03.0 (HVM), is it the problem? If it is the problem, how can I fix it? Which command I need to use to install?

apt is the package manager for Debian-based Linux distros. Amazon Linux is CentOS/RHEL-based distro, it uses yum as package manager.
To install Let's Encrypt SSL certificate on Amazon Linux you can follow the step-by-step tutorial by AWS: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-2.html#letsencrypt
You will have to import EPEL repository from Fedora (instead of PPA), then install Certbot from Let's Encrypt and issue an SSL certificate using Certbot.
Minimal command set for Amazon Linux:
sudo wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/
sudo rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm
sudo yum-config-manager --enable epel*
sudo yum install -y certbot python2-certbot-apache
sudo certbot

Related

Ansible offline installation on Redhat Linux 8.1 with all dependencies

I’m installing ansible on offline red hat Linux machine 8.1 with the help of rpm’s but they’re failing and requires more dependencies.
Is there any way or method, from using which I’m able to install ansible on it
In other rhel machine, with internet and the ansible repository configured, install yumdownloader with
yum install yum-utils
Download ansible with its dependencies:
yumdownloader ansible --destdir /tmp/ansible_rpm --resolve
Note: change /tmp/ansible_rpm by a directory in the rhel machine.
Adding on to this answer by #gary-lopez:
On other connected RHEL box to obtain Ansible:
sudo subscription-manager repos --enable ansible-2.9-for-rhel-8-x86_64-rpms
sudo yumdownloader ansible --destdir /tmp/ansible_rpm --resolve
Repeat below for any additional dependencies you come across. These
are the two dependencies my offline install asked for:
sudo yumdownloader python3-jinja2 --destdir /tmp/ansible_rpm --resolve
sudo yumdownloader python3-pyyaml --destdir /tmp/ansible_rpm --resolve
Then package it up into a gzipped tar-ball for transport to the offline machine:
cd /tmp
sudo yum install tar -y
tar zcvf ansible_tar.tgz /tmp/ansible_rpm
Transfer the tar gzipped file to the disconnected/offline machine
via some method (USB, etc). For example, if it's at least accessible
to your connected machine, then you could secure copy to it:
scp ansible_tar.tgz <user>#<disconnected-target>:/tmp
On disconnected/offline target:
cd /tmp
tar zxvf ansible_rpm.tgz
cd ansible_rpm
yum localinstall python3-jinja2-2.10.1-2.el8_0.noarch.rpm
yum localinstall python3-pyyaml-3.12-12.el8.x86_64.rpm
Finally, use yum localinstall ansible-2.9.24-1.el8ae.noarch.rpm to install Ansible rpm. But if for some reason there's a final dependency you REALLY need to by-pass that you do not want to install, here's the work-around.
In my example, our customer would not allow sshpass to be installed no matter what (because reasons). Use rpm (instead of yum localinstall to override need for dependency sshpass because yum localinstall --nobest --skip-broken skips ansible install due to missing sshpass dependency.
rpm -i --nodeps ansible-2.9.24-1.el8ae.noarch.rpm

ejabberdctl not found in bash Ubuntu(installing ejabberd)

I was trying to install ejabberd with applying the tutorials in many site to my VM which is ubuntu but I am stuck in the beginning. After I wrote
sudo apt-get update
sudo apt-get -y install ejabberd
it installs ejabberd. But when I try to write the following
ejabberdctl register admin localhost mypassword
it says ejabberdctl not found. I also tried to restart it with but it is still same.
sudo service ejabberd restart
Note: I did not install erlang seperately. Can it be the problem?
Try sudo ejabberdctl,
if it didn't work, Do:
sudo updatedb
sudo locate ejabberdctl
check if the output is in your $PATH variable.

How to install ansible on amazon aws?

Having trouble running Ansible on the latest version of amazon linux.
[root#ip-10-0-0-11 ec2-user]# yum install ansible --enablerepo=epel
[root#ip-10-0-0-11 ec2-user]# ansible-playbook
Traceback (most recent call last):
File "/usr/bin/ansible-playbook", line 44, in <module>
import ansible.playbook
ImportError: No module named ansible.playbook
Using AMI ID: ami-a10897d6.
Any ideas?
It appears that python library files do not have correct permissions by default. Running this fixed it for me.
[root#ip-10-0-0-11 ansible]# pip install ansible
Using pip (alone, not in conjunction with yum) is probably the best option right now on Amazon Linux. I'd suggest getting rid of the yum-installed copy if it's still there.
The RPM specs in epel and epel-testing (as of 1.9.2) currently handle only RHEL, Fedora, and SuSE, and the defaults are installing everything under Python 2.6, where the latest Amazon Linux has default Python 2.7. A bit of work will be required to get the RPM install working under Amazon Linux...
For Amazon Linux2 AMI:
sudo yum update
sudo yum install ansible
or
sudo amazon-linux-extras install ansible2
For Amazon Linux AMI:
sudo yum update
sudo yum install ansible --enablerepo=epel
For Ubuntu 18.04 AMI:
sudo apt-get update
sudo apt-get install ansible
Note: You can install ansible using "pip".
sudo yum install python-pip
sudo pip install ansible
Why not check out the source code from git and and checkout the latest stable version.
git clone git://github.com/ansible/ansible.git --recursive
$ cd ./ansible
$ source ./hacking/env-setup
git checkout <VERSION>
Just enable the below repo from the /etc/yum.repos.d/redhat-rhui.repo file by default is disabled.
rhui-REGION-rhel-server-extras/7Server/x86_64
This article says that you can use sudo amazon-linux-extras install ansible2 to install ansible on Amazon linux.
On Amazon Linux 2 to get the latest version of Ansible do not use yum (currently it won't give you 2.10.x), I recommend you use python3-pip.
sudo yum remove ansible
sudo yum install -y python3-pip
python3 -m pip install --user --upgrade pip # Do not run pip as sudo. Do this instead.
python3 -m pip install ansible
If you don't already have python3 you may need this step before the above:
sudo yum install -y python3.7
In my case, I needed ansible 2.10.x because it has the added benefit of requirements.yml files being able to install collections directly from git repositories.
This answer is based off of #M.Rajput's answer. I wanted to define the details so I wouldn't forget.
Warning: this was only tested on a RHEL 7.7 Community AMI (ami-029c0fbe456d58bd1).
# modify yum repo enabled
sudo vi /etc/yum.repos.d/redhat-rhui.repo
# find entry titled [rhui-rhel-7-server-rhui-extras-rpms]
# change "enabled=0" to "enabled=1"
# save and quit file (vim command is :wq)
sudo yum install ansible

Cannot install inotify on Amazon EC2

I have an AWS EC2 instance and wants to install inotify-tools. I've added the repository by executing the command: rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm then execute yum install inotify-tools but getting No package inotify-tools available.
Please help
I bumped into this issue as well. The solution below is a bit easier than grabbing an RPM or the source and compiling.
The Amazon Linux AMI comes with the EPEL repository source, but it's disabled. So you need to enable it.
Original Amazon Linux (1) AMI:
sudo yum-config-manager --enable epel
Amazon Linux 2 AMI:
sudo amazon-linux-extras install epel -y
Then run a regular yum update and install the toolset:
sudo yum update
sudo yum install inotify-tools
How do I enable the EPEL repository for my Amazon EC2 instance running CentOS, RHEL, or Amazon Linux?
Install and enable the EPEL rpm package on RHEL 7 and Amazon Linux 2
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo amazon-linux-extras install epel
sudo yum install inotify-tools
For me, none of the above answers worked. I had to install epel-release and then install inotify-tools

How do I install byobu in ec2 ami

I know it was possible usint a package manager since i did it once a time ago. But now if I try
sudo yum install byobu
it just fails ...
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, priorities, security, update-motd
Loading mirror speeds from cached hostfile
* amzn-main: packages.us-east-1.amazonaws.com
* amzn-updates: packages.us-east-1.amazonaws.com
amzn-main
amzn-updates
Setting up Install Process
No package byobu available.
Error: Nothing to do
Not sure why, but the EPEL repo is installed, but disabled by default. You can enable it permanently by changing the setting "enabled=1" in the [epel] stanza of /etc/yum.repos.d/epel.repo
Or you can leave it disabled and still install byobu:
sudo yum install --enablerepo=epel byobu
You can have a look at what packages are available in the epel repo with:
sudo yum list --disablerepo=\* --enablerepo=epel
For Amazon Linux 2:
You would need to install the EPEL release package for EL7 based AMI and enable the EPEL repository.
You may execute below: ⤵︎
sudo amazon-linux-extras install epel # Install epel from Amazon's Linux Extras
sudo yum-config-manager --enable epel # Enable EPEL repo in case disabled
sudo yum install byobu -y # Install byobu
byobu -v # Verify Version
Here is the alternative source just in case Linux Extras don't work for you.
# (optional) Install EPEL repository from Fedora
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Reference: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/
Tested On
Name: Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-0323c3dd2da7fb37d (64-bit x86) / ami-0ce2e5b7d27317779 (64-bit Arm)
The error message indicates that the package byobu is not available in the amzn-main repository.
You can manually install it from another repository
cd ~
wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/5/x86_64/byobu-3.4-2.el5.noarch.rpm
sudo yum install byobu-3.4-2.el5.noarch.rpm
Maybe someone needs a new link for
byobu
So you can install it by
wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/7/x86_64/b/byobu-5.73-4.el7.noarch.rpm
sudo yum install byobu-5.73-4.el7.noarch.rpm

Resources