PostgreSQL on Elastic Beanstalk (Amazon Linux 2) - linux

With former generation of Amazon Linux, all I needed to do is add the following in .ebextensions in order to use PostgreSQL:
packages:
yum:
postgresql93-devel: []
Now when I deploy on EB with the following platform:
Python 3.7 running on 64bit Amazon Linux 2/3.0.0
I get the following error on deployment:
[ERROR] Error occurred during build: Yum does not have postgresql93-devel available for installation
Therefore it is impossible to deploy as I need to connect to a PostgreSQL database in RDS.
What config in .ebextensions do I need to do?

The following works:
packages:
yum:
amazon-linux-extras: []
commands:
01_postgres_activate:
command: sudo amazon-linux-extras enable postgresql10
02_postgres_install:
command: sudo yum install -y postgresql-devel

postgresql93-devel is pretty old. The yum PostgreSQL repository starts at 9.5. Depending on your needs you may want to upgrade to at least 9.5. PostgreSQL 12 is the latest production release.
EDIT
As to the comment #jordanm made - that's correct, the AWS Linux 2 environment does have PostgreSQL 9.2.24 available. If you're ok with that version then you can just install postgresql-devel. Change your .ebextensions to just run:
packages:
yum:
postgresql-devel: []
This will install the devel package for 9.2.24.
If you'd like something a bit newer, it's apparently a bunch harder. I was unable to get this to work for the devel package. If you change your .ebextensions to contain something like (not tested!):
container_commands:
command: 'amazon-linux-extras install -y postgresql9.6'
Then you'll get PostgreSQL 9.6 but it does not appear to have the devel package available.
It doesn't look possible to use the RPM's from https://yum.postgresql.org/ as AWS Linux 2 is not supported. Trying CentOS or RHEL gives an error.
Is 9.2 usable for your environment?

Something that helped me with Amazon Linus 1, is the fact that I didn't need to install Postgres at all when plugging in a RDS service and specifying Postgres as the driver. It's just a thought for people having this problem. But maybe just try to not explicitly install Postgres.
I haven't validated which version will be installed by default.

This configuration works fine with the ElasticBeanstalk environment (Python 3.6 running on 64bit Amazon Linux). After this, I was able to install psycopg2 with requirements.txt
packages:
yum:
libicu-devel: []
commands:
01_postgres_libs:
command: rpm -ivh --force https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-libs-10.7-1PGDG.rhel6.x86_64.rpm
02_postgres_install:
command: rpm -ivh --force https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-10.7-1PGDG.rhel6.x86_64.rpm
03_symink_pg_config:
command: sudo ln -sf /usr/pgsql-10/bin/pg_config /usr/bin/pg_config
04_postgres_devel:
command: sudo rpm -ivh --force https://yum.postgresql.org/10/redhat/rhel-6.9-x86_64/postgresql10-devel-10.7-1PGDG.rhel6.x86_64.rpm

Related

How to install node.js v16 on VPS cPanel WHM when ea-nodejs10 installs v10.24.1?

I want to yum install xrpl to sign transactions via the xrpl.js library on a cPanel WHM VPS and have made it through How to install a Node.js Application enough that all four ea-*** RPMs, including ea-nodejs10 v10.24.1, have been installed. However, xrpl.js recommends node.js v14 while also supporting v12 & v16.
Further, package-lock.json must be installed prior to xrpl.js - yet even though WHM Edit Package shows package-lock.json added:
yum install package-lock.json throws "No package package-lock.json available." Although repeating yum install ea-nodejs10 returns "Package already installed."
So I would appreciate advice on how to install node.js v14 and package-lock.json on this system thanks.
I am now able to sign, send, and validate XRP Ledger transactions with python - hence my iOS-XRPL UI javascript brew will delegate its signing-validating to python functions.
Edit:
MobileApp-XRP Ledger blockchain Linux dedicated server xrpl-py library installation
MobileApp business XRPL transactions on MoblieAppDomainName.com browser requires a Dedicated Server, instead of a VPS, to install the required xrpl-py python library. Several guides continue to evolve for the several systems.
Present solution starts with Bluehost Linux DS Python Installation latest version 3.9.2 guide.
However the make install command attempts - and fails - to break the existing python 2.7 installation integral to the cPanel framework and needs to be replaced by make altinstall as described by Grepitout: How to Install Python 3 in cPanel Server.
Except that didn't quite work either -> What eventually worked on author's Mac OS-Linux system was Computing for Geeks: Install Python 3.9 on CentOS 8 / CentOS 7 guide:
$ ssh username#serveripaddress
sudo yum -y update
sudo yum groupinstall "Development Tools" -y
sudo yum install openssl-devel libffi-devel bzip2-devel -y
$ gcc --version
sudo yum install wget -y
wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz
tar xvf Python-3.9.7.tgz
cd Python-3.9*/
./configure --enable-optimizations
sudo make altinstall
$ python3.9 --version
Python 3.9.7

Install Chrome/Cromium on Amazon Linux v2 (ARM64/aarch64/Gravitone)

Does anyone know a working solution to install Google Chrome(Chromium) on Amazon Linux 2 with ARM64 architecture (Gravitone c6g.xlarge instance)? I need to run it in headless mode.
At the moment I can't find any packages in yum:
No package chromium available.
When I try to install it using the RPM package I get the error:
Error: Package: chromium-87.0.4280.141-1.el8.aarch64 (/chromium-87.0.4280.141-1.el8.aarch64)
Requires: libm.so.6(GLIBC_2.27)(64bit)
Error: Package: chromium-87.0.4280.141-1.el8.aarch64 (/chromium-87.0.4280.141-1.el8.aarch64)
Requires: libz.so.1(ZLIB_1.2.9)(64bit)
Error: Package: chromium-87.0.4280.141-1.el8.aarch64 (/chromium-87.0.4280.141-1.el8.aarch64)
Requires: chromium-common(aarch-64) = 87.0.4280.141-1.el8
Error: Package: chromium-87.0.4280.141-1.el8.aarch64 (/chromium-87.0.4280.141-1.el8.aarch64)
Requires: libc.so.6(GLIBC_2.28)(64bit)
When I try to run sudo yum install glibc I get:
glibc-2.26-39.amzn2.aarch64
Looks like Amazon Linux has installed own older version of glibc. Same situation with zlib package, available older version:
zlib-1.2.7-18.amzn2.aarch64
To really solve the problem if you are using EC2 instance or any other server where you are running Amazon linux, you should follow the below steps .
Enable and install Extra Packages for Enterprise Linux by running the command
sudo amazon-linux-extras install epel -y
Post installing all the extra packages successfully, Install chromimum as usual
sudo yum install -y chromium
Once you do that Chromium will have all required such as libatk* libgdk* etc ...
You should be able to easily launch Chromium
The missed out packages that you are looking here, are actually not missedout they are kind of default you just have to enable them , this is well documented in AWS documentation .
https://aws.amazon.com/premiumsupport/knowledge-center/ec2-enable-epel/

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

NGINX is giving error when i try to install

I am trying to install nginx in
Amazon Linux AMI
but when i try to run command
sudo yum install nginx
error is below
Loaded plugins: langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 0:1.14.0-1.el6.ngx will be installed
--> Processing Dependency: libpcre.so.0()(64bit) for package: nginx-1.14.0-1.el6.ngx.x86_64
--> Finished Dependency Resolution
Error: Package: nginx-1.14.0-1.el6.ngx.x86_64 (nginx)
Requires: libpcre.so.0()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I had this exact same problem. Check if you have a file like /etc/yum.repos.d/nginx.repo.
The Nginx install instructions tell us to create such a file and that it should look like this:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1
Those instructions also tell us
Due to differences between how CentOS, RHEL, and Scientific Linux populate the $releasever variable, it is necessary to manually replace $releasever with either 5 (for 5.x) or 6 (for 6.x), depending upon your OS version.
So you need to replace $releasever with the appropriate version of your OS. But when using Amazon Linux AMI (or, in my case, the Azure version), it's not easy to tell what this is.
I found that sudo yum install nginx only worked when I replaced $releasever with 7. When I used 6 instead, I got the exact error as you. Hope this helps!
First run $ sudo yum update -y and after that try to install, if still facing same issue then try with $ sudo yum install nginx --skip-broken

Ansible: ufw is not a legal parameter in an ansible task or handler

Trying to run an ansible installation on ubuntu 14.04
ansible-playbook -i hosts ruby-webapp.yml -t swap,ruby,deploy,mysql,nginx,ufw,import_data
I get
ERROR: ufw is not a legal parameter in an Ansible task or handler
and I can't go forward with the rest of the installation.
ufw was was added as a system module to Ansible 1.6 (see http://docs.ansible.com/ufw_module.html).
You are probably running an older version of Ansible on your control node (i.e., the machine where you are invoking the ansible-playbook command). Check your version with:
ansible --version
Upgrading depends on how you installed Ansible originally, but if you installed it to your system as root using pip, you can probably use:
sudo pip install -U ansible
(The -U means "update")
Edit: Just realized that you might be running Ubuntu 14.04 as your control node so I checked to see what version you get when you install Ansible with apt-get. As of this writing, it installs version 1.5.4, so if that's how you installed it, you definitely have the wrong version. You probably want to uninstall the OS package version and use one of the recommended installation techniques: http://docs.ansible.com/intro_installation.html#running-from-source
Something like:
sudo apt-get remove ansible
sudo easy_install pip
sudo pip install ansible
If you are missing easy_install, you may install it with:
sudo apt-get install python-setuptools

Resources