Skip to content

fracarfer5/Ubuntu-20-Post-Install

Repository files navigation

Ubuntu Post-Install instructions and scripts

This is a repository with some steps and post-install scripts for Ubuntu. It's a work in progress, so feel free to contribute.

Note: Remember that you will need to give the sudo password to execute all the scripts.

Table of Contents

Usage

Installing OpenSSH

First of all, we begin installing openssh-server, so we can connect to the machine remotely. To do that we can use the openssh script to install it:

chmod +x openssh.sh
./openssh.sh

Source: Ubuntu OpenSSH Server

Installing CUDA and NVCC

If you have a computer with a NVIDIA GPU, you will need to install the CUDA drivers and the NVIDIA CUDA Compiler Driver (NVCC).

Unfortunately, I experimented some problems with the latest version of CUDA (12.1) when I tried to install Tensorflow with GPU support. Therefore, in this opportunity I have prepared a script to install the 11.8 version of CUDA.

We begin installing the CUDA drivers with the cuda_11_8 script:

chmod +x cuda_11_8.sh
./cuda_11_8.sh

Source: NVIDIA CUDA Toolkit 11.8 Downloads

This script will download the CUDA drivers and install them. After that, we need to install the NVCC compiler. Assuming that you have downloaded and extracted the NVCC compiler in the current path, we need to install it.

To do that, we can use the nvcc script:

chmod +x nvcc.sh
./nvcc.sh

Source: NVIDIA CUDA Installation Guide for Linux

If you need uninstall Nvidia completely:

Run the following commands to uninstall CUDA:

sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" \
 "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"

rm -rf /usr/local/cuda-11.4

Run the following command to uninstall the GPU driver:

sudo apt-get --purge remove "*nvidia*" "libxnvctrl*"

Run the following commands to uninstall and clean all installation packages:

sudo apt-get autoremove

Run the following command to restart the instance.

sudo reboot

Installing RedNotebook

RedNotebook is a graphical diary and journal helping you keep track of notes and thoughts. It includes a calendar navigation, customizable templates, export functionality and word clouds. You can also format, tag and search your entries. So, I really recommend this tool to keep track of your daily activities. You can install it by running the rednotebook script:

chmod +x rednotebook.sh
./rednotebook.sh

Source RedNotebook

Installing Visual Studio Code

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. You can install it by navigating through the Ubuntu Software Center and searching for VSCode, then you can install its snap version.

Installing Slack

Slack is a communication platform highly used by different teams. Slack offers many IRC-style features, including persistent chat rooms (channels) organized by topic, private groups, and direct messaging. You can install it by navigating through the Ubuntu Software Center and searching for Slack.

Installing OneDriver

OneDrive is a file hosting and synchronization service offered by Microsoft. Unfortunately, there is no official client for Linux, but fortunately there is a third-party client called OneDriver. You can install it by running the onedriver script:

chmod +x onedriver.sh
./onedriver.sh

Source: Mount Microsoft OneDrive in Linux With OneDriver GUI Tool

Installing miniConda

Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others. First, you need to download the latest version of miniconda from the official website. Then, you can install it by running the script you just downloaded:

bash <downloaded script>.sh

Installing libreOffice

Most of the times libreOffice comes pre-installed in Ubuntu, but if you don't have it, you can install it by running the libreoffice script:

chmod +x libreoffice.sh
./libreoffice.sh

Misc

Configure python3 as default python version

By default, Ubuntu comes with python 3 installed, which can be executed by running the python3 command. However, if you want to execute python 3 by running the python command, you will need to install an extra package:

sudo apt install python-is-python3

Configuring Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Luckily, Ubuntu comes with Git pre-installed, so we only need to configure it. In case Git is not installed, you can install it by running the command:

sudo apt install git

To configure it, we can use the git commands:

git config --global user.name "Your Name"
git config --global user.email your@email.com
git config --list

Source: Git - Getting Started

Configuring Github: Adding SSH key

If you are using Github, you will need to add your SSH key to your account. To do that, you can follow the next steps:

  1. Check for existing SSH keys:
ls -al ~/.ssh
  1. If you don't have an SSH key pair, you can generate one by running the next command:
ssh-keygen -t ed25519 -C "your_email@example.com"

Note: Substitute for your Github email address.

  1. Start the ssh-agent in the background:
eval "$(ssh-agent -s)"
  1. Add your SSH private key to the ssh-agent:
ssh-add ~/.ssh/id_ed25519
  1. Copy the SSH key to your clipboard:
cat ~/.ssh/id_ed25519.pub
  1. Go to your Github account and add the SSH key to your account in the Settings section.
  2. Done! Now you can clone your repositories using SSH.

Source: Adding a new SSH key to your GitHub account

Initializing a Git repository

If you want to initialize a Git repository, you can follow the next steps:

  1. Create a new directory, and initialize it with git-specific functions:
mkdir test
cd test
git init
  1. Add a new file to the repo:
touch README.md
  1. Add the file to the staging environment:
git add README.md
  1. Commit the file to the repo:
git commit -m 'first commit'
  1. Add the remote location of the repo:
git remote add origin <remote repository URL>
  1. Upload the file contents to the remote server:
git branch -M main
git push -u origin main

Source: Git - Getting Started

Configure pre-commits

Pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. You can install it by running the following command in your actual virtual environment:

pip install pre-commit pytest flake8 black -y

Additionally, you can add the following configuration to your .pre-commit-config.yaml file:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: fix-encoding-pragma

# add repo for black and flake8 for python 3
-   repo: https://github.com/psf/black
    rev: 23.3.0
    hooks:
    -   id: black
        language_version: python3

-   repo: https://github.com/PyCQA/flake8
    rev: 6.0.0
    hooks:
    -   id: flake8
        language_version: python3

# # add repo for isort for python 3
-   repo: https://github.com/PyCQA/isort
    rev: 5.12.0
    hooks:
    -   id: isort
        language_version: python3
        args: ["--profile", "black"]

-   repo: https://github.com/commitizen-tools/commitizen
    rev: v2.29.2
    hooks:
      - id: commitizen
        stages: [ commit-msg ]

Then, you need to add the following configuration to your .flake8 file:

[flake8]
ignore = E203, E266, E501, W503, F403, F401, E722, E401, E712
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9

Finally, you can run the following command to install the pre-commit hooks:

pre-commit install

To run the hooks into your code you can run the following command:

pre-commit run --all-files

Or:

pre-commit run --show-diff-on-failure --color=always --all-files

Source: pre-commit

Installing Docker

Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and are thus more lightweight than virtual machines. Containers are created from images that specify their precise contents. Images are often created by combining and modifying standard images downloaded from public repositories, Docker Hub for example.

To install Docker, you can follow the next steps:

chmod +x docker.sh
./docker.sh

After the installation you can run the following command to check if Docker is installed correctly:

docker run hello-world

Source: Docker

Installing Nvidia Docker

NVIDIA Docker is a toolset that enables users to easily run GPU-accelerated applications and containers. NVIDIA Docker containers are similar to standard Docker containers, except that they are GPU-aware. NVIDIA Docker containers can be run on any Linux GPU server with NVIDIA drivers and Docker installed. NVIDIA Docker containers can be run on any Linux GPU server with NVIDIA drivers and Docker installed. NVIDIA Docker containers can be run on any Linux GPU server with NVIDIA drivers and Docker installed. NVIDIA Docker containers can be run on any Linux GPU server with NVIDIA drivers and Docker installed.

This script will install the latest version of Nvidia Docker. To install it, you can run the following commands:

chmod +x nvidia_docker.sh
./nvidia_docker.sh

After the installation you can run the following command to check if Nvidia Docker is installed correctly:

docker run --rm --runtime=nvidia --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi

Source: Nvidia Docker

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages