How can I install xclip on an EC2 instance? - linux

I'm following Github's instructions for adding an SSH key. I've generated the id_rsa.pub file from my AWS EC2 instance, but I cannot complete the step that has me copy the contents of the file using xclip because I cannot install xclip onto the EC2 instance.
I tried to install xclip on the EC2 instance using sudo yum install
xclip, but that didn't work ("No package xclip available").
So I looked around and found more detailed install instructions, but they
didn't work either ("curl: (22) The requested URL returned error: 404 Not Found"), and the suggested correct URLs in the comments also failed.
(I also tried just copying the text contents of the id_rsa.pub file using Putty and ctl-c, but Github declared the resulting key invalid.)
So, how do I install xclip on 64-bit Amazon Linux AMI 2012.09?

I needed this today for a file larger than a ssh-key, and cat was not enough. You need to enable the EPEL repo in EC2 in order to get xclip:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo yum-config-manager --enable epel
sudo yum install xclip -y

You don't need xclip. Just ssh into the EC2 instance and cat the key to your terminal, then copy and paste it from your terminal to wherever you need it.

Use
sudo amazon-linux-extras install epel -y
sudo yum install xclip -y
Source: https://gist.github.com/kevin-kientopp/7a1dee73ab0f1bdb21fe158407a028ea

I don't mean to wake up the zombies but in case someone is still wondering you can wget the rpm (i.e. from here) and then
sudo yum localinstall xclip-0.12-1.el6.x86_64.rpm
Note: you may need to do the same for some dependencies.

Related

How to Install Postgresql 11 in Amazon Linux AMI?

How do I install Postgresql 11 on Amazon Linux 2018.03 (specifically, not AMZ Linux 2) on Elastic Beanstalk?
I want to install a package and not manually build a binary. If an autoscale machine boots and has to build the entire PG binary, it'll take significantly longer on a t2/t3.micro.
I'm looking for pg_dump.
[Edit] Making more verbose, explain why building does not work for my situation.
The key was the PGDG is no longer available to Amazon Linux's yum since 9.3 so the individual pieces must be installed.
# Remove old Postgres
yum remove -y postgresql postgresql-server
# Install Postgres 11
yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/postgresql11-libs-11.4-1PGDG.rhel6.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/postgresql11-11.4-1PGDG.rhel6.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/postgresql11-server-11.4-1PGDG.rhel6.x86_64.rpm
[edit]
Replace the 11.4 in each link above with any version you need available at https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/
sudo yum update
sudo amazon-linux-extras install postgresql11
Looks like there's no PostgreSQL 11 pre-built binary distribution for Amazon Linux. The way I solve it was to build from source code:
wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz
tar zxvf postgresql-11.5.tar.gz
cd postgresql-11.5
./configure --without-readline
make
make install
By default, it will install pg_dump into /usr/local/pgsql/bin/pg_dump.
This is an extended version of #nitsujri answer. I can't comment their comment, so I will create new answer here.
Install prerequisites:
sudo yum install readline-devel
sudo yum group install "Development Tools"
Download PostgreSQL source code and install the distro:
wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz
tar zxvf postgresql-11.5.tar.gz
cd postgresql-11.5
./configure
make
sudo make install
Add this line to your ~/.bashrc. After that relogin to an EC2 instance.
export PATH=/usr/local/pgsql/bin:$PATH

Unable to install libsasl2-devel on Amazon Linux 2 machine

I am running Ansible playbook and trying to install OS dependencies packages for python. I am trying to run the following:
sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
However, it fails at installing libsasl2-devel with the message:
"No package matching 'libsasl2-devel' found available, installed or updated"
All my instances are Amazon Linux 2 machines. Is there any alternative package for this? I tried to look into this but I found solutions for Ubuntu only.
I was able to get it to work in a series of steps. Its a yum issue after other databases are installed and not cleaned up before installing mysql
clear sasl first: sudo yum remove cyrus-sasl
if you have installed maria, there will be conflicts, remove that as well
sudo yum remove mariadb mariadb-server mariadb-libs
take note of anything uninstalled by this to re-add later. If this is too much, you can take a risk and not remove sasl, but it might not reset the availability of the package.
Start here to clean up the dependency issues: https://serverfault.com/questions/873955/how-solve-mysql-5-7-dependency follow the command given by clean all as sudo rm -rf /var/cache/yum/*
This can possibly resolve your issues right there, if not continue the installation below.
delete all data left in /var/lib/mysql/ or you may have upgrade issues.
resinstall sasl:
sudo yum install cyrus-sasl cyrus-sasl-devel and any other packages removed above.
Establish mysql5.7 with the yum services.
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
sudo yum localinstall -y mysql57-community-release-el6-11.noarch.rpm
sudo yum repolist enabled | grep "mysql.*-community.*"
sudo yum repolist enabled | grep mysql
sudo yum install -y mysql-community-common mysql-community-libs mysql-community-server mysql-community-client
if that doesn't work, re-clear the yum cache again and re-run sudo yum install -y mysql-community-server
if that works, then
sudo service mysqld start
IF the /var/lib/mysql is empty, it will have created a temporary password in the /var/log/mysqld.log (use sudo to read)
run sudo mysql_secure_installation and establish your real password and security settings.
now you should have access via mysql -u root -p

Issue "Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo"

I am trying to set up the Docker repository on CentOS, after I run the command
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
I am getting error message:
Could not fetch/save url
https://download.docker.com/linux/centos/docker-ce.repo to file
/etc/yum.repos.d/docker-ce.repo: [Errno 12] Timeout on
https://download.docker.com/linux/centos/docker-ce.repo: (28,
'Operation timed out after 30005 milliseconds with 0 out of 0 bytes
received')
I am following the docker documentation to set up the repository.
Step 1: Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Step 2: 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
Expected result: System should download the files.
Actual result: Not able to download the files.
I have the same problem but I solved it by updating the yum config file, just add timeout=120 to /etc/yum.conf:
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
#add timeout here
timeout=120
Set timeout to 2 min (or 3 min = 180), restart the server then re-run your command.
NOTE: you need to edit the yum.conf file as a super user in order to be able to save your changes.
To switch to super user run next:
sudo -i
To edit your file and save the changes use the nano editor (or Vi).
I think that it is not necessarily a good solution but it worked well for me.
Should help!
By adding this to my /etc/yum.conf file
add timeout here
timeout=300.
It fixed the problem.
In my case, I followed instruction in https://unix.stackexchange.com/a/568590/506588 to set
ip_resolve=4
in /etc/yum.conf [main] section then it works fine
If you face any error while trying to create a stable docker repo, You may use the following command.
Command:
curl --silent -SL https://get.docker.com/ | sh
If nothings works, then just do
wget https://download.docker.com/linux/centos/docker-ce.repo ; mv docker-ce.repo /etc/yum.repos.d/.
Go to https://download.docker.com/linux/centos/docker-ce.repo to download the file manual then upload it to /etc/yum.repos.d/docker-ce.repo
its just because ipv6 is still not completely deployed due to which we get timeouts or slow response.
just disable your system's/VM's ipv6 and it will work fine.
to disable the IPv6 use following commands (run as root or use sudo):
echo -e 'net.ipv6.conf.all.disable_ipv6 = 1 \nnet.ipv6.conf.default.disable_ipv6 = 1' > /etc/sysctl.d/disable_ipv6.conf
sysctl -p
systemctl restart systemd-sysctl.service
then run
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
check repositories:
yum repolist
install docker:
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

As part of shell script, sudo su is not working. Any alternate?

The below 3 lines are part of my shell script, but it is executing first line and copying file properly.
In-order execute this rpm file, i need to prompt to root user. Hence, 2nd step i wrote. But it is not executing, hence i'm not able to install the rpm file.
aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite.rpm /home/user1/
sudo su
yum -y install /home/user1/oracle-instantclient12.2-basiclite.rpm
So, any alternate solution to this (sudo su) or tell me how to prompt to root user in-order to install the mentioned rpm file.
Thanks
You could try using sudo -s or
sudo yum -y install /home/user1/oracle-instantclient12.2-basiclite-12.2.0.1.0-1.x86_64.rpm
The first option switches you to the root user, while the second allows you to run the command as root.
aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite.rpm /home/user1/ && sudo -i yum -y install /home/user1/oracle-instantclient12.2-basiclite.rpm
you'd have to add && (see this answer) in between the two commands and install with sudo yum:
aws s3 cp s3://mybucket/oracle-instantclient12.2-basiclite.rpm /home/user1/ && sudo yum -y install /home/user1/oracle-instantclient12.2-basiclite.rpm
sudo rpm -i /home/user1/oracle-instantclient12.2-basiclite.rpm should also work.
there is no other way to run two commands from a single command-line ...
are you sure the seconds half of the command-line even runs on the remote host? because I'd rather would expect it to be prefixed with send-command (in case running this from a local shell and not on the remote host). it is also not being indicated which Linux distribution you attempt to run the command against; adding the relevant RPM repository and then installing from there, might be the most reliable method of doing so.

VPS add repository error

I would like to install Bitcoind under (VPS) linu system. I got a step by step tutorial how can i do this installation, but everytime when i tried to add repository i got the following error message on console "sudo: add-apt-repository: command not found"
commands for installation
sudo aptitude install python-software-properties
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo aptitude update
sudo aptitude install bitcoind
mkdir ~/.bitcoin/
These commands are appropriate for an Ubuntu distribution and not CentOS.
The analogous commands that CentOS uses are yum install / yum update, etc.

Resources