How to setup linux for development
This is a guide book for setting up a newly linux distro for development purpose
- Install latest version of python
# Update the package list
sudo apt update
# Add the Deadsnakes PPA to your system
sudo add-apt-repository ppa:deadsnakes/ppa
# Update the package list
sudo apt update
# Install Python 3.13
sudo apt install -y python3.13 python3.13-venv python3.13-dev
# Update alternatives to set Python 3.13 as the default
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 1
sudo update-alternatives --config python3
# Verify the default Python version
python3 --version
# Install pip for Python 3.13
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3.13 get-pip.py
# Verify pip installation
pip --version
To configure the python
command to invoke Python 3, you have several options:
1. Using an Alias (User-Specific):
Add the following line to your ~/.bashrc
or ~/.bash_aliases
file:
alias python='python3'
After saving the file, apply the changes by running:
source ~/.bashrc
2. Using update-alternatives
(System-Wide):
This method is suitable for Debian-based systems. First, add Python 3 as an alternative:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
Then, select Python 3 as the default:
sudo update-alternatives --config python
3. Creating a Symbolic Link (System-Wide):
Create a symbolic link pointing python
to python3
:
sudo ln -s /usr/bin/python3 /usr/bin/python
Caution: Altering the default python
command may affect system scripts that rely on Python 2. Ensure that such changes do not disrupt system operations.
- To install Git on Ubuntu, you can use the following commands:
sudo apt update
sudo apt install git
After installation, verify the installed Git version:
git --version
- To install both Docker Engine (daemon) and Docker Desktop on Ubuntu, follow these steps:
1. Install Docker Engine:
Docker Engine is the core component that runs Docker containers.
- Update the package index:
sudo apt update
-
Install prerequisite packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
-
Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
-
Add the Docker APT repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-
Update the package index again:
sudo apt update
-
Install Docker Engine:
sudo apt install docker-ce
-
Verify Docker installation:
docker --version
2. Install Docker Desktop:
Docker Desktop provides a user-friendly interface for managing Docker containers and integrates additional tools.
-
Ensure your system meets the prerequisites:
-
Ubuntu 22.04, 24.04, or the latest non-LTS version.
-
For non-Gnome Desktop environments, install
gnome-terminal
:sudo apt install gnome-terminal
-
-
Set up Docker's package repository:
If not already done during Docker Engine installation, add Docker's GPG key and repository:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
-
Download the latest Docker Desktop DEB package:
Visit the Docker Desktop release page to find the latest version. Replace
<version>
with the appropriate version number:curl -LO https://desktop.docker.com/linux/main/amd64/docker-desktop-<version>-amd64.deb
-
Install Docker Desktop:
sudo apt install ./docker-desktop-<version>-amd64.deb
-
Launch Docker Desktop:
After installation, you can start Docker Desktop from your application launcher or by running:
systemctl --user start docker-desktop
- To install the latest version of Node.js using NVM (Node Version Manager) on Ubuntu, run the following commands:
1. Install NVM
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
(Check NVM GitHub for the latest version if needed.)
2. Reload Shell Configuration
source ~/.bashrc # Use ~/.zshrc if you're using Zsh
3. Verify NVM Installation
command -v nvm
4. Install the Latest Node.js Version
nvm install node
5. Set the Installed Version as Default
nvm use node
nvm alias default node
6. Verify Installation
node -v
npm -v
- To install VS Code using
snapd
on Ubuntu, run the following commands:
1. Ensure snapd
is installed
sudo apt update
sudo apt install snapd
2. Install Visual Studio Code
sudo snap install code --classic
3. Verify Installation
code --version
Now, you can launch VS Code using:
code