EC2 Amazon Linux: uninstalled Python2.7 by mistake and yum didn't work - amazon-ec2

I got a new EC2 amazon Linux server and a stupid action i was taken is to deinstalled python2.7.
As a result my yum didn't work.
What I still have is python3.7.
I tried to edit /usr/bin/yum to change the quote of python to python3 but there are more issues popped up.
I tried to get my python2.7 back using rpm -ivh. I downloaded the rpm packages to my local directory and it took ages to mange the dependancies. and i couldn't get it back successfully
Can someone please give me some light with regards to what should I do in this case?
after all i need Yum

Related

pgadmin3 install on CentOS7

I am using CentOS7 and PostgreSQL-13. As it is very difficult to work database-related queries in the command line I want to install pgadmin3. Aas it is available on the yum repository and in my CentOS, I do not have any internet connection. So I have installed pgadmin3 with the following installation command only: yum install pgadmin3.
I have seen in some tutorials they modified the sudo /usr/pgadmin4/bin/setup-web.sh file. But I did not find such a file in my CentOS machine after pgadmin3 installation. Now I have no idea how to configure it with my already installed PostgreSQL-13 and httpd and how I can use this. I have not found any documentation regarding this.
PostgreSQL-13 not supported for pgadmin3, you must install pgadmin4

ansible installation fails on control node, but not fails on local host itself?

Description: Ansible yum module doesn't install through control host, but local yum install works perfectly? What could cause such issue? I appreciate any response. Thank you guys. I worked on this 8 hours, I have researched various of things, and tried very different approaches. No success.
Node: Centos7 (newly installed), Control-Node: Ubuntu-LTS18.
Command:
ansible ansitest2 -i ../inv -b -m yum -a "name=epel-release state=present"
it can be any package though.
This fails, however at the bottom I can see that it found the package and tried to install it. ()
If I go to host itself and try to install it, it is successful. :
yum install epel-release -y
After spending almost 2 days on this, finally found answer, /etc/resolve.conf file needed to be updated with option rotate timeout:1,
So, if you have such issue, it is mainly about resolve.conf
man resolve.conf will give very good description.

Offline Ansible Control Machine installation

I need to install Ansible Control Machine behind a corporate firewall with no internet access. I can't find documentation for an offline install. I have access on my workstation to download anything I want and can copy it to the target machine. I have tried searching online but have not been able to find examples on how to do this. My server is Ubuntu 14.04 but if anyone has documentation for Red Hat or another distro that would also help.
I did a testing on my RH6, so if you have a RH6 with Internet access to download all required installation file, and a RH6 installation ISO. You should be able to achieve this.
Assuming you have a RH6 which has Internet access, let's call it A. And another one doesn't have access: B.
download Ansible and Jinja2 from A, and copy the files to B.
For Ansible: http://docs.ansible.com/ansible/intro_installation.html
Jinja2 is required for Ansible, download it here:
https://pypi.python.org/pypi/Jinja2
Mount the RH6 installation ISO to your RH6 B, then install the required RPM.
In my case, i installed PIP as well:
rpm -ivh python-paramiko-1.7.5-2.1.el6.noarch.rpm libyaml-0.1.3-4.el6_6.x86_64.rpm PyYAML-3.10-3.1.el6.x86_64.rpm perl-TermReadKey-2.30-13.el6.x86_64.rpm perl-Error-0.17015-4.el6.noarch.rpm python-six-1.9.0-2.el6.noarch.rpm
//following required for Git
rpm -ivh --force --nodeps perl-Git-1.7.1-3.el6_4.1.noarch.rpm
rpm -ivh git-1.7.1-3.el6_4.1.x86_64.rpm
Note: i didn't install httplib2 here, you can do it later.
install MarkupSafe (required for Jinja2)
//install MarkupSafe
tar -xvf MarkupSafe-0.23.tar.gz
cd MarkupSafe-0.23/
sudo python setup.py install
install Jinja2
//install Jinjia2
tar -xvf Jinja2-2.8.tar.gz
cd Jinja2-2.8/
sudo python setup.py install
On RH6 B, you should be able to run Ansible now:
tar -zxvf ansible.tar.gz
source ./hacking/env-setup
echo "127.0.0.1" > ~/ansible_hosts
export ANSIBLE_INVENTORY=~/ansible_hosts
ansible --version
I know this is a very old question, but I've found the answer in this blog post and I believe that could help someone out there.
Although this post aproach is on a CentOS/RHEL machine, I believe the procedure is very similar to other distros:
Download the packages (RPM) dependencies
Download the Ansible packages
Upload the downloaded packages to the target machine
Install it using yum localinstall
Or you could also install it from the source.

Getting the Error "Required option '-K, --private-key KEY' missing (-h for usage)"

I am using an Ubuntu 12.04. I have downloaded the EC2 CLI tools from the Amazon website. The following are the steps that I have done..
Unzipped the file and put it in a directory.
Set the Java class path properly (My Tomcat is working).
Set the EC2 home path, after that set the EC2 Home and bin path in bashrc
Set the access and secret key in bashrc.
When I am trying to trying to start an instance or do anything for that matter from the terminal, I am getting the error
Required option '-K, --private-key KEY' missing (-h for usage)
Could someone please help me with this?
Posting this so it might be helpful for others. The problem was happening because when I installed Ubuntu I had installed the ec2-tools using the apt-get from terminal.
This version of ec2 which Ubuntu has is an outdated version (it was last updated in 2011).
When I found this out, I removed it. And reconfigured the path to the current version of ec2 cli tools I had downloaded and it worked!!! :)
The way to install newer versions of the ec2-api-tools, as suggested by https://help.ubuntu.com/community/EC2StartersGuide, is to simply add the aws-tools PPA:
sudo apt-add-repository ppa:awstools-dev/awstools
sudo apt-get upgrade
and then a simple apt-get install ec2-api-tools will install the correct version. :)

Installing CouchDB in AWS EC2 Free Tier

Does anyone know of a step by step installation guide for CouchDB in the free tier 32bit AWS EC2 instance?
Keep in mind that YUM is limited by default and I would need to add yum.repos to get extra stuff. I've tried all different articles and RPMs but none seem to work.
I also tried couchbase but it has extremely poor post-install instructions. The server start but then what? I couldn't find the files, configs, or install directories. And, how do I access it?
CouchDB sounds like such a great database but it really needs to break these barriers of entry. MongoDb has better docs, although I couldn't get that to work either (I spent a fraction of the time trying, though).
Thanks :)
The apache team put together this quick script that installs CouchDB (thanks #_jhs
for build-couchdb!) on an Amazon Linux AMI:
https://gist.github.com/1171217
If you are using cloudinit + the EC2 command line tools, simply use
ec2-run-instances with --user-data-file (you will need some mods to
the script to save the password or locally generate one) and voila'.
Relaxing FTW.
Worked like a charm for me!
Enable the EPEL repository first and then install it with yum install couchdb
You can enable EPEL using the instructions here.
EDIT:
More information at http://wiki.apache.org/couchdb/Installing_on_RHEL5. Keep in mind that the Linux EC2 AMI is a cut down version of CentOS and you can add custom repositories and install as you wish.
Here is a quick run down of the steps I use to install couchdb 1.5.1 on Amazon Linux 2014.03.1. See also this post on my blog http://www.everyhaironyourhead.com/installing-couchdb-1-5-1-on-amazon-linux-ami-2014-03-1/.
Core deps and dev tools.
Enable the EPEL Repo by editing the file /etc/yum.repos.d/epel.repo and setting it to enabled.
Next install the deps and tools.
sudo yum install gcc gcc-c++ libtool libicu-devel openssl-devel autoconf-archive erlang python27 python-sphinx help2man
Get the SpiderMonkey JS Engine and build it...
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xvfz js185-1.0.0.tar.gz
cd js-1.8.5/js/src
./configure
make
sudo make install
You should see it installed under /usr/local/lib
Build CouchDB.
Download the source package for CouchDB, unpack it and cd in.
Point it to the required libs and configure.
./configure --with-erlang=/usr/lib64/erlang/usr/include --with-js-lib=/usr/local/lib/ --with-js-include=/usr/local/include/js/
make
sudo make install
Prepare the CouchDB installation.
Make a couchdb user.
sudo useradd -r -d /usr/local/var/lib/couchdb -M -s /bin/bash couchdb
Set the file ownerships.
sudo chown -R couchdb:couchdb /usr/local/etc/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb
sudo chmod 0775 /usr/local/etc/couchdb
sudo chmod 0775 /usr/local/var/lib/couchdb
sudo chmod 0775 /usr/local/var/log/couchdb
sudo chmod 0775 /usr/local/var/run/couchdb
Prepare the init scripts.
Link the init script and copy the log rotate script to /etc.
sudo cp /usr/local/etc/logrotate.d/couchdb /etc/logrotate.d
sudo ln -s /usr/local/etc/rc.d/couchdb /etc/init.d/couchdb
This and most other linux distros don’t include /usr/local/lib in ld, so CouchDB will have problems finding the SpiderMonkey libs we installed there earlier. One way to solve this is to add the following line to the top of the /etc/init.d/couchdb startup script.
export LD_LIBRARY_PATH=/usr/local/lib
See man page for ldconfig for more info, and please comment with a better solution.
You may want to edit /usr/local/etc/default/couchdb to turn off the auto respawn.
To get it to autostart, just use the standard linux setup tools for running service scripts.
sudo chkconfig --add couchdb
It should pick up the default run levels needed from the script, but in case it doesn’t, you can do it manually like this...
sudo chkconfig --level 3 couchdb on
sudo chkconfig --level 4 couchdb on
sudo chkconfig --level 5 couchdb on
You can sudo chkconfig —list to confirm its there. See man chkconfig for more details.
Relax.
Finally reboot (or just start couchdb from the script) and confirm its running with curl http://127.0.0.1:5984/
Comments, corrections, improvements, and criticisms are appreciated.
Add the EPEL repository first and then install it with yum install couchdb
Yeah, not exactly. I'm running AWS Free Tier standard and installing couch has been hell on earth - lots and lots of dependency issues around erland various graphics libs, I'll report back here when I get a process that works
okay, the issue for me was wxGTK.x86_64 - It had a list of 15 or so dependencies that wouldn't install through yum (even with epel) and I had to manually install the rpms and dependencies before yum install couchdb would work.
Not sure the default AMI is a good idea if you want couch!
I googled: "build couchdb"
and followed the steps
I am installing it.
I can tell you it is very painful. After pressing "rake", you need to wait 2, maybe 3 hours until all the dependencies are compiled. I am still installing it right now in my free tier server. You have to make sure you have that time to keep your terminal busy out there!
However, it is the only working solution so far for me. It is installing automatically for real.
I also tried couchbase but it has extremely poor post-install instructions. The server start but then what? I couldn't find the files, configs, or install directories. And, how do I access it?
Sorry for hearing about the experience you are having! We have been focused on making Couchbase highly performant and scalable recently so understand the developer experience pain such as documentations. Hopefully these two step by step guides would help!
This is on how to install the Couchbase Server and Couchbase Sync Gateway Amazon AMI on AWS and then how to connect Couchbase Sync Gateway to a mobile application:
Part 1 : Database on Amazon: Installing Couchbase AMI on AWS
The first part goes over how to install and access the Couchbase Web Console.
Part 2 : Database on Amazon: Connecting Couchbase Sync Gateway to Couchbase AMI on AWS
The second part goes over how to access the Couchbase contents/directory
You mentioned CouchDB and Couchbase together in this thread and they have different APIs but the Couchbase Sync Gateway component would be able to sit in front of CouchDB through the REST APIs as another option.
For those specifically installing on AWS Linux 2
Installing Couchdb on AWS Linux 2
This page uses Apache Couchdb binary installation
Instructions
Using the Centos installation instructions.
Create the bintray-apache-couchdb-rpm.repo file in the /etc/yum.repos.d directory
Fill in the full path to the repository list rather than using the Relver and Architecture macros.
[bintray--apache-couchdb-rpm] name=bintray--apache-couchdb-rpm baseurl=http://apache.bintray.com/couchdb-rpm/el7/x86_64/
gpgcheck=0
repo_gpgcheck=0
enabled=1
Yum install after enabling epel
sudo yum update && sudo yum install -y couchdb
Continue with the Couchdb and configuration as normal

Resources