System
This document provides a step-by-step guide to setting up a system from scratch, ensuring it is properly configured for both development and production.
Getting Started
Our primary focus is on setting up Ubuntu, as it is the operating system used in our production systems. Additionally, we provide support for MacOS, as development is carried out on both Ubuntu and MacOS.
Version
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focalDistributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: focalProductName: macOS
ProductVersion: 15.2
BuildVersion: 24C101Update all installed packages
sudo apt update -y && \
sudo apt upgrade -y && \
sudo apt dist-upgrade -y && \
sudo apt autoremove -yInstall dependency packages
sudo apt install vim -y && \
sudo apt install curl -y && \
sudo apt install wget -y && \
sudo apt install net-tools -y/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # install homebrew
(echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile # config every shell environment for homebrew
cat ~/.zprofile # check if it got added
eval "$(/opt/homebrew/bin/brew shellenv)" # config current shell environment for homebrew
brew version # check brew versionVim config file
|
|
Install Google Chrome
cd ~/Downloads
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P . # download latest stable .deb for google
sudo dpkg -i google-chrome-stable_current_amd64.deb # install google from .deb file
sudo apt --fix-broken install # resolve if any broken package present Install Visual Studio Code
Download .deb file from here.
cd ~/Downloads
sudo dpkg -i code_*.**.*-**********_*****.debUser settings
Check this link to find the file path for user settings based on your platform.
|
|
Install Git and SSH
sudo apt install git -y # install git
cd /usr/share/keyrings # change directory to keyrings
sudo wget https://cli.github.com/packages/githubcli-archive-keyring.gpg # download keyring for github cli
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null # add github-cli apt
sudo apt update -y && sudo apt install gh -y # install gh
sudo apt install ssh -y # install sshbrew install git # install git
brew install gh # install gh
# There's no need to install SSH on macOS, as it comes pre-installed by defaultGenerate SSH files
Create ssh files by running following command and provide email which is liked to github account:
cd ~/.ssh
ssh-keygen -t ed25519 -C "your_email@example.com"
mv ~/.ssh/id_ed25519 ~/.ssh/github-user_name.pem
mv ~/.ssh/id_ed25519.pub ~/.ssh/github-user_name.pubRefer to this link for more information about generating SSH keys.
This will generate a .pem and a .pub file, rename as github-user_name.pem and github-user_name.pub based on the GitHub username. Move these files to the ~/.ssh folder. Then, upload the .pub file to github.
SSH file permissions
Update ssh file permissions by running the following commands:
chmod 644 ~/.ssh/known_hosts
chmod 600 ~/.ssh/config ~/.ssh/authorized_keys
chmod 644 ~/.ssh/github-user_name.pub
chmod 400 ~/.ssh/github-user_name.pemSSH config
Create an SSH configuration, primarily focusing on scenarios where a developer working with multiple GitHub accounts.
|
|
Clone repository
Before cloning any repository, please update your ~/.ssh/known_hosts file with the following changes. For reference, see this link.
ssh-keyscan github.com 2> /dev/null >> ~/.ssh/known_hostsUse the modified git clone command when performing a Git clone.
git clone git@hostName:orgName/repoName.gitReplace hostName with the above mentioned SSH configuration’s Host value, orgName with the GitHub organization name, and repoName with the repository name.
User config for repository
For each cloned repository, make sure it remains synchronized with your GitHub account. Use this link to retrieve details such as your Public email and Name associated with GitHub, and then use the following commands to verify and update your user details on your system.
To view the user configuration data for each repository:
git config user.name
git config user.emailTo update the user configuration for each repository:
git config user.email "your_email@example.com"
git config user.name "user_name"