Cannot install aws-cli from edge repository on Alpine linux - linux

I'm trying to install aws-cli from edge repository but I cannot
https://pkgs.alpinelinux.org/package/edge/community/x86_64/aws-cli
Is it an issue with OS version? ( 3.11 / 3.12 )
If so is there a workaround?
root#6f97c6559fe9:/ # echo http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
root#6f97c6559fe9:/ # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
v3.11.6-71-gb45d3b45cc [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]
v3.11.6-68-gf6abc2afac [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]
v3.12.0-442-g76e377ea0b [http://dl-cdn.alpinelinux.org/alpine/edge/main]
OK: 16123 distinct packages available
root#6f97c6559fe9:/ # apk add aws-cli
ERROR: unsatisfiable constraints:
aws-cli (missing):
required by: world[aws-cli]
root#6f97c6559fe9:/ # apk add --update aws-cli
ERROR: unsatisfiable constraints:
aws-cli (missing):
required by: world[aws-cli]
root#6f97c6559fe9:/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.3
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

So the package page of Alpine seems to confirm that aws-cli is indeed not part of Alpine 3.11 package repository.
This said, you can install it using AWS own set of instructions, you will just need both curl and python in order to do so.
For AWS CLI v1:
apk add python curl
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Source: https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html#install-linux-bundled
For AWS CLI v2, sadly, it seems Alpine is not yet supported:
nateprewitt commented on 24 Feb
Hi #firstval, it looks like you found
a response on this behavior in #4685. We're currently tracking Docker
support in #3553 which would be a prerequisite for this to work.
That said, we can definitely do better with the exceptions being
returned. We're working on getting a warning in our install script to
will alert you when the platform isn't supported.
We'll track the remaining piece for alpine support in #3553. Thanks!
Source: https://github.com/aws/aws-cli/issues/4971
Further down in #3553:
There is an official docker image for aws-cli: https://hub.docker.com/r/amazon/aws-cli
Some people got it working, but with quite a huge amount of dependancies needed (you actually need a c compiler, as it seems): https://github.com/aws/aws-cli/issues/3553#issuecomment-615149941
This would also explain why, even on Alpine 3.12, the actual package install the version 1.xx and not a 2.xx version.

Related

How to install Node.js version 16.x.x in a Debian based image (Dockerfile)? (why so hard?)

Date: Tuesday October 5th, 2021
Node 10.x was released on 2018-04-24 (but that's the default version when using apt-get)
I have needs to have both Python and Node.js installed in running container. I can get the latest version of python in a container using:
FROM python:alpine
or
FROM python:buster <== Debian based
How do I get the latest version of node.js (16.10.0) installed on Debian (in a Docker container)
Whe I do this:
FROM python:buster
RUN apt-get update && \
apt-get install -y \
nodejs npm
I get these versions of node:
node: 10.24.0
npm 5.8.0
and when run in the container give a long statement about no longer being unsupported.
What's up with the package repo that 'apt-get' pulls from, that it will not install later versions of node (14.x or greater)?
If I pull from:
FROM python:alpine
and include these lines
RUN apk -v --no-cache --update add \
nodejs-current npm
I will get node 16.x version, which makes it easy. I don't have to do anything else.
Is there something equivalent for python:buster (Debian based)
I would really like a one or two liner in my Dockerfile and not a pages of instructions with a dozen commands to simply get node in the image.
I would appreciate any tested/proven reply. I am sure a number of others have the same question. Other stackoverflow articles on this subject are convoluted and do not provide the simple solution I am hoping to find that is available with pytyon:alpine
There is a reason I need python:debian and cannot use python:alpine in this one use case, otherwise I would chose the latter.
Is there a way some how to get a package repo maintainers attention to show me how to get a recent version (14..16), into the apt-get repository?
It appears many people are having issues with this.
You can use:
FROM python:buster
RUN apt-get update && \
apt-get install -y \
nodejs npm
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
apt-get install -y nodejs

How to install docker-compose on Alpine Linux 3.13

I'm trying to install docker-compose on Linux alpine 3.13 following the documentation at https://docs.docker.com/compose/install/
But when I try to install rust it throws the following error:
ERROR: unable to select packages:
so:libLLVM-11.so (no such package):
required by: rust-1.51.0-r0[so:libLLVM-11.so]
Anyone have any idea of how to fix this?
Since alpine 3.10, if you are in the container:
apk add --update docker-compose
Otherwise, on the dockerfile:
RUN apk add --update docker-compose
Note that this does not install docker, you should have it installed already
This worked for me on Alpine 3.13, you can also search for the packages on the official site.
apk add llvm11-libs --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main

Bitbucket pipeline installing the wrong version of cmake

When I apt-get install cmake in my Bitbucket pipeline, it installs version 3.0.2. This then leads to an error "CMake 3.7.2 or higher is required. You are running version 3.0.2". How can I install cmake version 3.7.2 or higher in my .yml?
bitbucket-pipelines.yml
image: gcc:6.5
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
- apt-get update && apt-get -y install cmake
- cmake -B build .
Error:
+ cmake -B build .
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
CMake 3.7.2 or higher is required. You are running version 3.0.2
This isn't really a pipelines issue. I'll walk through the troubleshooting process to identify the problem and a possible solution. You could pursue other solutions to install your desired version but hopefully following the approach here will help you in future.
Full disclosure, I work for Atlassian - though not on the Bitbucket Pipelines team :)
The version of cmake that you see being installed is actually related to the third party base image you're using, gcc:6.5. You can test/verify this on your own machine:
$ docker run --rm -it gcc:6.5 bash
root#77d4fde67119:/# apt-get update && apt-get -y install cmake
root#77d4fde67119:/# cmake --version
cmake version 3.0.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
We can see the gcc:6.5 image is based on Debian Jessie:
root#77d4fde67119:/# cat /etc/os-release | grep PRETTY
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
If you look up the default cmake package for Jessie you'll find that it's v3.0.2: https://packages.debian.org/jessie/devel/cmake
A little more digging will show you that newer Debian versions package newer versions of cmake by default: Stretch or Buster will package 3.7 or 3.13 respectively. So the solution to your issue is using a newer version of the gcc base image based on a more recent Debian version:
Let's try it again with the gcc:7 base image:
$ docker run --rm -it gcc:7 bash
root#26e82f7b5e56:/# cat /etc/os-release | grep PRETTY
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
Well, that's a good sign: gcc:7 is based on Debian Buster. Buster ships 3.13: https://packages.debian.org/buster/devel/cmake
root#26e82f7b5e56:/# apt-get update && apt-get -y install cmake
root#26e82f7b5e56:/# cmake --version
cmake version 3.13.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
There you have it: a version above 3.7.
If you can't use this version of gcc, of course, you'll need to look at a different solution. But hopefully this helps to illustrate the source of your issue and how you can investigate these kinds of issues in future.

Explanation of the "--update add" command for Alpine Linux

I'm trying to understand the Dockerfile https://hub.docker.com/r/rdsubhas/tor-privoxy-alpine/~/dockerfile/, which contains a RUN executive with
apk --update add privoxy tor#testing runit#testing
I wanted to check my understanding of how the apk command is being used, so I tried opening a terminal in the Alpine environment as follows:
docker run -it --rm alpine:latest /bin/ash
after which I simply ran apk to see its usage:
/ # apk
apk-tools 2.6.8, compiled for x86_64.
usage: apk COMMAND [-h|--help] [-p|--root DIR] [-X|--repository REPO]
[-q|--quiet] [-v|--verbose] [-i|--interactive] [-V|--version]
[-f|--force] [-U|--update-cache] [--progress] [--progress-fd FD]
[--no-progress] [--purge] [--allow-untrusted] [--wait TIME]
[--keys-dir KEYSDIR] [--repositories-file REPOFILE] [--no-network]
[--no-cache] [--arch ARCH] [--print-arch] [ARGS]...
The following commands are available:
add Add PACKAGEs to 'world' and install (or upgrade) them, while
ensuring that all dependencies are met
del Remove PACKAGEs from 'world' and uninstall them
fix Repair package or upgrade it without modifying main dependencies
update Update repository indexes from all remote repositories
info Give detailed information about PACKAGEs or repositores
search Search package by PATTERNs or by indexed dependencies
upgrade Upgrade currently installed packages to match repositories
cache Download missing PACKAGEs to cache and/or delete unneeded files
from cache
version Compare package versions (in installed database vs. available) or
do tests on literal version strings
index Create repository index file from FILEs
fetch Download PACKAGEs from global repositories to a local directory
audit Audit the directories for changes
verify Verify package integrity and signature
dot Generate graphviz graphs
policy Show repository policy for packages
stats Show statistics about repositories and installations
Global options:
-h, --help Show generic help or applet specific help
-p, --root DIR Install packages to DIR
-X, --repository REPO Use packages from REPO
-q, --quiet Print less information
-v, --verbose Print more information (can be doubled)
-i, --interactive Ask confirmation for certain operations
-V, --version Print program version and exit
-f, --force Do what was asked even if it looks dangerous
-U, --update-cache Update the repository cache
--progress Show a progress bar
--progress-fd FD Write progress to fd
--no-progress Disable progress bar even for TTYs
--purge Delete also modified configuration files (pkg
removal) and uninstalled packages from cache (cache
clean)
--allow-untrusted Install packages with untrusted signature or no
signature
--wait TIME Wait for TIME seconds to get an exclusive repository
lock before failing
--keys-dir KEYSDIR Override directory of trusted keys
--repositories-file REPOFILE Override repositories file
--no-network Do not use network (cache is still used)
--no-cache Read uncached index from network
--arch ARCH Use architecture with --root
--print-arch Print default arch and exit
This apk has coffee making abilities.
The thing is, I don't see the --update option in this documentation (only --update-cache).
What I suspect is that apk --update add [package] is simply shorthand for apk update followed by apk add [package]. Can anyone confirm this?
See https://github.com/gliderlabs/docker-alpine/pull/503
apk --update flag is really --update-cache.
Apk uses getopt_long (3),
https://github.com/alpinelinux/apk-tools/blob/v2.10.3/src/apk.c#L574
So, --update flag is only abbreviated from --update-cache by getopt_long.
Long option names may be abbreviated if the abbreviation is unique or
is an exact match for some defined option.
In short:
To get the latest list of available packages, use the update command.
it is similar to the Debian apt-get update that you do before apt-get install my_package.
from https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Update_the_Package_list:
extract
Update the Package list
Remote repositories change as packages are added and upgraded. To get the latest list of available packages, use the update command. The command downloads the APKINDEX.tar.gz from each repository and stores it in the local cache, typically /var/cache/apk/, /var/lib/apk/ or /etc/apk/cache/.
apk update
Tip: If using remote repositories, it is a good idea to do an update just before doing an add or upgrade command. That way you know you are using the latest software available.

Building Python3 on a redhat 5 machine

I am trying to build Python3 on a RHEL 5.7 machine, I successful managed to build Python 3.2.2, with :
# Install required build dependencies
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
# Fetch and extract source. Please refer to http://www.python.org/download/releases
# to ensure the latest source is used.
wget http://www.python.org/ftp/python/3.2/Python-3.2.tar.bz2
tar -xjf Python-3.2.tar.bz2
cd Python-3.2
# Configure the build with a prefix (install dir) of /opt/python3, compile, and install.
./configure --prefix=/opt/python3
make
But I am failing (?) with Python 3.2.3:
Failed to build these modules:
_posixsubprocess
Is this a problem that should bother me ? How do I build it?
I found this patch, but it's not included in sources Python 3.2.3 I obtained from the website ...
Applying this patch on my sources, didn't solve the problem ...
Well, I already answered my own question in serverfault.com: building python 3.2.2 on a Red Hat 5 machine
You need to apply the patch found here.
And then you can successfully build Python 3.

Resources