Installing moreutils on EC2 instance - amazon-ec2

How do I install moreutils on the default image Amazon EC2 instance? The instances are built off of CentOS but presumably have their own packages repo since
sudo yum install moreutils
fails with
No package moreutils available.
What is the yum repo I need to install moreutils?

The epel repo is on the default Amazon server but in not enabled by default. You can use it as follows:
sudo yum --enablerepo epel install moreutils
Note that epel has a very old version of moreutils (0.40 when 0.61 is out), which does not include chronic.

For update amazon linux, you can run following commands
sudo amazon-linux-extras install epel
sudo yum install moreutils

The EPEL repository has it, and other things. It works with Amazon Linux as well as CentOS, Fedora etc. (see http://fedoraproject.org/wiki/EPEL). To install the config that enables that repo, yum install epel-release.

Related

CentOS 6.5 - How to upgrade HAProxy?

Can someone tell me how to upgrade HAProxy from 1.5.4 version to the latest version?
I'm using a virtual machine CentOS 6.5.
Thanks a lot ;)
HAProxy up to 1.5.4 is available for Centos via the package repository, so to get a newer version you will have to compile from source.
To upgrade to the latest version, you could follow these instructions to make your own installable package.
In summary:
sudo yum install rpmdevtools pcre-devel
rpmdev-setuptree
sudo yum groupinstall 'Development Tools'
sudo yum install openssl-devel
wget http://www.haproxy.org/download/1.6/src/haproxy-1.6.9.tar.gz
mv haproxy-1.6.9.tar.gz ~/rpmbuild/SOURCES/
git clone git://github.com/bluerail/haproxy-centos.git
cp haproxy-centos/conf/* ~/rpmbuild/SOURCES/
cp haproxy-centos/spec/* ~/rpmbuild/SPECS/
cd ~/rpmbuild/
rpmbuild -ba SPECS/haproxy.spec
The RPM should be available in ~/rpmbuild/RPMS/x86_64. You can install it like:
sudo rpm -Uvh RPMS/x86_64/haproxy-1.6-9.x86_64.rpm
Try the following yum command:
yum update haproxy
According to a quick repo search, this should update to HAProxy 1.5.4. Prove the version change with:
haproxy -v

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

Does there exist Amazon EC2 AMI preconfigured with PHP4?

I'm having a very difficult time setting up a PHP4 LAMP stack on an EC2 instance. Does anyone know of any pre-configured AMI which supports PHP4?
For the record, I do not have the option to develop in PHP5
Getting a php LAMP stack running on EC2 is rather painless, and you don't need a custom AMI. Using a standard Amazon Linux instance, log in as ec2-user and run these commands:
sudo yum update -y
sudo yum install -y mysql-server mysql-client mysql-libs mysql-devel
sudo yum install -y httpd php
Amazon does a good job of curating the packages in their yum repository, which is auto-configured with Amazon Linux. If you want to upgrade to php 5.4.8 simply execute this command instead:
sudo yum install -y php54
EDIT: Sorry, the php package is actually version 5.3.8, so if you really want to install php4, your best bet is to build it from source. It will likely be tough to support it ongoing. You'll likely need at least these standard packages installed to build it:
sudo yum install -y gcc gcc-c++ make zlib zlib-devel
sudo yum install -y openssl openssl-devel readline readline-devel
sudo yum install -y libxml2 libxml2-devel libxslt libxslt-devel

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