0
点赞
收藏
分享

微信扫一扫

Linux_Debian学习笔记

程序员阿狸 04-14 18:00 阅读 1

文章目录

系统管理

软件源

Debian11

debian11 ustc中国科技大学软件源
  1. 生成软件源
    # 备份软件源
    mv /etc/apt/sources.list /etc/apt/sources.list.backup.$(date "+%Y-%m-%d_%H:%M")
    cat > /etc/apt/sources.list << 'EOF'
    deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
    # deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
    deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
    # deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
    
    # deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
    # deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
    EOF
    
    
debian11 清华大学软件源
  1. 生成软件源
    # 备份软件源
    mv /etc/apt/sources.list /etc/apt/sources.list.backup.$(date "+%Y-%m-%d_%H:%M")
    cat > /etc/apt/sources.list << 'EOF'
    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
    EOF
    
debian11 阿里云软件源
  1. 生成软件源
    # 备份软件源
    mv /etc/apt/sources.list /etc/apt/sources.list.backup.$(date "+%Y-%m-%d_%H:%M")
    cat > /etc/apt/sources.list << 'EOF'
    deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
    deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
    deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
    deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main
    deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
    deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
    deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
    deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
    EOF
    

Debian12

debian12 清华大学软件源
  1. 生成软件源
    # 备份软件源
    mv /etc/apt/sources.list /etc/apt/sources.list.backup.$(date "+%Y-%m-%d_%H:%M")
    cat > /etc/apt/sources.list << 'EOF'
    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
    # deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
    
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
    # deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
    
    deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
    # deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
    
    # deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
    # # deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
    
    deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
    # deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
    EOF
    

系统全局设置

debian12 修改静态IP地址

  1. eth0为dhcp获取ip,eth1为静态ip,使用"systemctl restart networking.service"命令生效
  2. debian12 修改静态IP地址
    # 备份配置文件
    sudo mv /etc/network/interfaces /etc/network/interfaces.backup.$(date "+%Y-%m-%d_%H:%M")
    sudo cat > /etc/network/interfaces << 'EOF'
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug eth0 eth1
    iface eth0 inet dhcp
    iface eth1 inet static
      address 10.10.10.10/24
      broadcast 10.10.10.255
      network 10.10.10.0
    EOF
    

修改语言环境成中文

  1. 修改语言环境成中文
    dpkg-reconfigure locales
    #设置成zh_CN.UTF-8后,重启
    

系统输入法

Debian11 fcxe 安装rime中州韵五笔输入法

  1. 安装rime输入法
    sudo apt -y install fcitx5-rime
    
  2. 下载安装五笔输入方案
    # 下载五笔输入法
    wget https://github.com/rime/rime-wubi/archive/refs/heads/master.zip -O rime-wubi.zip
    # 五笔拼音反查依赖pinyin-simp
    wget https://github.com/rime/rime-pinyin-simp/archive/refs/heads/master.zip -O rime-pinyin-simp.zip
    unzip rime-wubi.zip
    unzip rime-pinyin-simp.zip
    在GUI界面注销,再登录用户
    在输入法中调出中州韵输入法
    cp rime-wubi-master/wubi* ~/.local/share/fcitx5/rime/
    cp rime-pinyin-simp-master/pinyin_simp* ~/.local/share/fcitx5/rime/
    vi ~/.local/share/fcitx5/rime/build/default.yaml
    # 编辑文件,在schema_list:下增加五笔输入法
    - schema: wubi_pinyin
    保存退出,重新启动中州韵输入法,按F4切换输入法
    在五笔拼音输入法下,可直接输入拼音,反查五笔编码
    
    

常用软件安装

Docker安装

  1. Docker官方文档
  2. 使用apt仓库安装,国内网络可能非常慢
    # Add Docker's official GPG key:
    sudo apt-get update
    sudo apt-get install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    
    # Add the repository to Apt sources:
    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
      $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
      sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
  3. 使用离线包安装
    1. 打开网页
    2. 选择Debian的版本
    3. 进入pool/stable/,选择平台
    4. 下载以下deb文件
      containerd.io_<version>_<arch>.deb
      docker-ce_<version>_<arch>.deb
      docker-ce-cli_<version>_<arch>.deb
      docker-buildx-plugin_<version>_<arch>.deb
      docker-compose-plugin_<version>_<arch>.deb
      
    5. 以Debian12(bookworm)为例,下载链接
      1. containerd.io_1.6.28-2
      2. docker-ce_26.0.0-1
      3. docker-ce-cli_26.0.0-1
      4. docker-buildx-plugin_0.13.1-1
      5. docker-compose-plugin_2.25.0-1
    6. 安装离线包
      # 如果没有iptables,需要先安装iptables:apt install -y iptables
      sudo dpkg -i ./containerd.io_1.6.28-2_amd64.deb \
        ./docker-ce_26.0.0-1~debian.12~bookworm_amd64.deb \
        ./docker-ce-cli_26.0.0-1~debian.12~bookworm_amd64.deb \
        ./docker-buildx-plugin_0.13.1-1~debian.12~bookworm_amd64.deb \
        ./docker-compose-plugin_2.25.0-1~debian.12~bookworm_amd64.deb
      
    7. 验证是否安装成功
    docker ps
    
举报

相关推荐

0 条评论