Created
September 23, 2022 20:47
-
-
Save izahn/70f696928bd9b515107c880f9d2f7f52 to your computer and use it in GitHub Desktop.
conda_cos7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
export LANG=en_US.UTF-8 | |
# Install basic requirements. | |
yum update -y && \ | |
yum install -y \ | |
bzip2 \ | |
sudo \ | |
tar \ | |
which | |
# Run common commands | |
cp /hostfiles/run_commands /usr/local/bin/ | |
/opt/docker/bin/run_commands | |
# Download and cache new compiler packages. | |
# Should speedup installation of them on CIs. | |
source /opt/conda/etc/profile.d/conda.sh && \ | |
conda activate && \ | |
conda create -n test --yes --quiet --download-only \ | |
conda-forge::binutils_impl_linux-64 \ | |
conda-forge::binutils_linux-64 \ | |
conda-forge::gcc_impl_linux-64 \ | |
conda-forge::gcc_linux-64 \ | |
conda-forge::gfortran_impl_linux-64 \ | |
conda-forge::gfortran_linux-64 \ | |
conda-forge::gxx_impl_linux-64 \ | |
conda-forge::gxx_linux-64 \ | |
conda-forge::libgcc-ng \ | |
conda-forge::libgfortran-ng \ | |
conda-forge::libstdcxx-ng && \ | |
conda remove --yes --quiet -n test --all && \ | |
conda clean -tiy && \ | |
chgrp -R lucky /opt/conda && \ | |
chmod -R g=u /opt/conda | |
set -exo pipefail | |
export additional_channel="--add channels defaults" | |
export miniforge_arch="$(uname -m)" | |
export miniforge_version="4.11.0-0" | |
export condapkg="https://github.com/conda-forge/miniforge/releases/download/${miniforge_version}/Mambaforge-${miniforge_version}-Linux-${miniforge_arch}.sh" | |
if [ "$(uname -m)" = "x86_64" ]; then | |
export conda_chksum="49268ee30d4418be4de852dda3aa4387f8c95b55a76f43fb1af68dcbf8b205c3" | |
elif [ "$(uname -m)" = "ppc64le" ]; then | |
export conda_chksum="6fe80e207d409eb6c0922e068aa23aff5032083d9a5c2aacecc446a1d20f357b" | |
elif [ "$(uname -m)" = "aarch64" ]; then | |
export conda_chksum="9ad5db1775ed7f6a390774a7b7a2aeac3992499ee4b01e801f53528857112dc0" | |
else | |
exit 1 | |
fi | |
# give sudo permission for conda user to run yum (user creation is postponed | |
# to the entrypoint, so we can create a user with the same id as the host) | |
echo 'conda ALL=NOPASSWD: /usr/bin/yum' >> /etc/sudoers | |
# Install the latest Miniconda with Python 3 and update everything. | |
curl -s -L $condapkg > miniconda.sh | |
sha256sum miniconda.sh | grep $conda_chksum | |
bash miniconda.sh -b -p /opt/conda | |
rm -f miniconda.sh | |
touch /opt/conda/conda-meta/pinned | |
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh | |
source /opt/conda/etc/profile.d/conda.sh | |
conda activate | |
conda config --set show_channel_urls True | |
conda config --set channel_priority strict | |
conda config ${additional_channel} --add channels conda-forge | |
conda config --show-sources | |
conda update --all --yes | |
conda clean -tipy | |
# Install conda build and deployment tools. | |
conda install --yes --quiet \ | |
git patch \ | |
python=3.9 pip \ | |
mamba boa \ | |
conda-build anaconda-client | |
conda clean -tipy | |
# Install docker tools | |
conda install --yes su-exec | |
export CONDA_SUEXEC_INFO=( `conda list su-exec | grep su-exec` ) | |
echo "su-exec ${CONDA_SUEXEC_INFO[1]}" >> /opt/conda/conda-meta/pinned | |
conda install --yes tini | |
export CONDA_TINI_INFO=( `conda list tini | grep tini` ) | |
echo "tini ${CONDA_TINI_INFO[1]}" >> /opt/conda/conda-meta/pinned | |
conda clean -tipy | |
# Lucky group gets permission to write in the conda dir | |
groupadd -g 32766 lucky | |
chown -R $USER /opt/conda | |
chgrp -R lucky /opt/conda && chmod -R g=u /opt/conda |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment