【Linux】Debian

Posted by 西维蜀黍 on 2022-03-12, Last Modified on 2023-05-02

Packages

Below is an example of a /etc/apt/sources.list for Debian 11/Bullseye, which is the default source as well.

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

deb http://deb.debian.org/debian-security/ bullseye-security main
deb-src http://deb.debian.org/debian-security/ bullseye-security main

deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

Install .deb

You can also install a .deb file by opening a terminal and typing:

sudo dpkg -i package_file.deb

Install common Build Tools

$ sudo apt install build-essential; sudo apt-get install manpages-dev

Misc

ifconfig is missing

root@debian:/home/debian# ifconfig
bash: ifconfig: command not found

Use ip addr instead.

To solve

$ sudo apt update; sudo apt install net-tools
# Add ifconfig to the system path
$ sudo vim ~/.bashrc
export PATH=/usr/sbin:$PATH
$ source ~/.bashrc

sudo: command not found

$ apt install sudo -y

Certain Commands cannot found

What you have to do is edit your .bashrc file, and put export PATH="$PATH:/usr/sbin" .

<user> is not in the sudoers file

$ sudo apt install curl
[sudo] password for sw:
sw is not in the sudoers file.  This incident will be reported.

To solve

$ chmod 777 /etc/sudoers; vim /etc/sudoers
# add
sw ALL=(ALL:ALL) ALL
$ chmod 555 /etc/sudoers

killall: command not found

$ sudo apt-get install psmisc

Install

Docker

Approach 1 - Install using the convenience script

 curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh

Approach 2 - Install using the repository

Set up the repository

 sudo apt-get update
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Install Docker Engine

This procedure works for Debian on x86_64 / amd64, armhf, arm64, and Raspbian.

Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:

 $ sudo apt-get update
 $ sudo apt-get install docker-ce docker-ce-cli containerd.io

To install a specific version of Docker Engine, list the available versions in the repo, then select and install:

a. List the versions available in your repo:

$ apt-cache madison docker-ce

  docker-ce | 5:18.09.1~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable amd64 Packages
  docker-ce | 5:18.09.0~3-0~debian-stretch | https://download.docker.com/linux/debian stretch/stable amd64 Packages
  docker-ce | 18.06.1~ce~3-0~debian        | https://download.docker.com/linux/debian stretch/stable amd64 Packages
  docker-ce | 18.06.0~ce~3-0~debian        | https://download.docker.com/linux/debian stretch/stable amd64 Packages

b. Install a specific version using the version string from the second column, for example, 5:18.09.1~3-0~debian-stretch .

$ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io

Verify that Docker Engine is installed correctly by running the hello-world image.

$ sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.

Docker Engine is installed and running. The docker group is created but no users are added to it. You need to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.

Golang

Refer to https://go.dev/doc/install

ccat

$ curl -LO https://github.com/owenthereal/ccat/releases/download/v1.1.0/linux-amd64-1.1.0.tar.gz
$ tar xvf linux-amd64-1.1.0.tar.gz
$ sudo cp linux-amd64-1.1.0/ccat /usr/bin/

Install Debian in VirtualBox

https://www.brianlinkletter.com/2012/10/installing-debian-linux-in-a-virtualbox-virtual-machine/

https://phoenixnap.com/kb/how-to-install-debian-10-buster

Reference