Created
December 20, 2021 12:08
-
-
Save Merwanski/131d314d2ca3423b97933b9e10db7916 to your computer and use it in GitHub Desktop.
new_machine_ubuntu_2004
This file contains hidden or 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
!bash | |
# install docker | |
# Step 1 — Installing Docker | |
# First, update your existing list of packages: | |
sudo apt update | |
# Next, install a few prerequisite packages which let apt use packages over HTTPS: | |
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common | |
# Then add the GPG key for the official Docker repository to your system: | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Add the Docker repository to APT sources: | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" | |
# Next, update the package database with the Docker packages from the newly added repo: | |
sudo apt update | |
# Finally, install Docker: | |
sudo apt install -y docker-ce | |
sudo systemctl status docker | |
sudo usermod -aG docker ${USER} | |
su - ${USER} | |
sudo apt-get install lsb-core | |
######################################################################################## | |
# add to bashrc for git branch in terminal | |
######################################################################################## | |
# Git branch in prompt. | |
force_color_prompt=yes | |
color_prompt=yes | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ ' | |
fi | |
unset color_prompt force_color_prompt | |
######################################################################################## | |
# open ssh | |
# https://linuxize.com/post/how-to-enable-ssh-on-ubuntu-20-04/ | |
######################################################################################## | |
sudo apt update | |
sudo apt install openssh-server | |
sudo systemctl status ssh | |
sudo ufw allow ssh | |
######################################################################################## | |
# docker | |
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html | |
######################################################################################## | |
curl https://get.docker.com | sh \ | |
&& sudo systemctl --now enable docker | |
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list | |
sudo apt-get update | |
sudo apt-get install -y nvidia-docker2 | |
sudo systemctl restart docker | |
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi | |
######################################################################################## | |
# docker compose | |
# https://docs.docker.com/compose/install/ | |
######################################################################################## | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
docker-compose --version | |
######################################################################################## | |
# gitlab runner | |
# https://docs.gitlab.com/runner/install/linux-manually.html | |
######################################################################################## | |
curl -LJO "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb" | |
sudo dpkg -i gitlab-runner_amd64.deb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment