Avatar

Organizations

3 results for Debian
  • Debian 12 只安装VNC及i3桌面,就可以低成本的实现远程桌面环境

    安装

    # 安装通用工具
    apt-get install -y nano net-tools bzip2 procps apt-utils iputils-ping netcat-openbsd
    # 安装中文字体
    apt-get install -y locales fonts-wqy-microhei fonts-wqy-zenhei xfonts-wqy && \
        sed -i -e "s/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/" /etc/locale.gen && \
        locale-gen zh_CN.UTF-8 &&\
        update-locale LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh LC_ALL=zh_CN.UTF-8
    # 安装VNC
    apt-get install -y tigervnc-standalone-server
    # 安装i3桌面
    apt-get install -y i3-wm i3status i3blocks dmenu xfonts-base terminator dbus-x11 libdbus-glib-1-2 ; apt-get purge -y pm-utils *screensaver*
    
    apt-get clean
    

    配置i3桌面

    ~/.config/i3/config

    linux vnc tigerVNC i3 debian Created Tue, 12 Aug 2025 19:01:37 +0800
  • 其实网上相关的文章已经非常多了,所以这篇文章的作用只是记录和明确一条确定可行的操作路径,为以后的操作节省时间,毕竟像我一样大部分人都不是专业的系统管理员,能够快速解决问题就可以了,并不想做过多的专业研究与探索。

    本操作手册是官方手册与网上手册的结合版本,集两家之所长,亲自操作可用。

    Debian

    # 安装 Docker 证书
    sudo apt-get install -y 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\
    sudo 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
    
    # 安装 Docker
    sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
    # 启动 Docker
    sudo systemctl enable docker.service
    sudo systemctl start docker.service
    
    # 测试
    sudo docker version
    > Client: Docker Engine - Community
    > ...
    > Server: Docker Engine - Community
    > ...
    sudo docker compose version
    > Docker Compose version v...
    
    # 使用非 root 用户管理 Docker
    # 创建 docker 用户组
    sudo groupadd docker
    # 将当前用户添加到 docker 用户组
    sudo usermod -aG docker $USER
    # 重启
    # 再次测试
    docker version
    > Client: Docker Engine - Community
    > ...
    > Server: Docker Engine - Community
    > ...
    docker compose version
    > Docker Compose version v...
    

    CentOS | Rocky

    # 查看系统版本
    cat /etc/redhat-release
    > CentOS Linux release 7.6.1810 (Core) // CentOs 7 以上版本
    
    # 查看系统内核版本
    uname -r
    > 4.10.4-1.el7.elrepo.x86_64 // 内核版本要>3.10
    
    # 卸载旧版本
    yum remove docker
                docker-client
                docker-client-latest
                docker-common
                docker-latest
                docker-latest-logrotate
                docker-logrotate
                docker-selinux
                docker-engine-selinux
                docker-engine
    
    # 安装依赖包
    yum install -y yum-utils lvm2
                    device-mapper-persistent-data
    
    # 添加 Docker 软件源
    # 如果系统已切换到阿里云镜像源地址,可跳过此步。
    # 阿里云镜像自带docker源
    yum-config-manager
        --add-repo
        https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo
    
    # 使用官方源
    yum-config-manager
        --add-repo
        https://download.docker.com/linux/centos/docker-ce.repo
    
    yum makecache fast
    # CentOS 8 or Rocky 9 使用timer替换fast
    yum makecache timer
    
    # 安装 Docker
    # 如果在 Rocky 9 系统上,会提示containerd.io版本过低,或下载失败,需要独立安装containerd.io
    # 可以重试几次
    yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
    # 启动 Docker
    # 设为开机启动
    systemctl enable docker.service
    # 启动服务
    systemctl start docker.service
    
    # 测试
    docker run hello-world
    > Unable to find image 'hello-world:latest' locally
    > latest: Pulling from library/hello-world
    > 1b930d010525: Pull complete
    > Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
    > Status: Downloaded newer image for hello-world:latest
    > 
    > Hello from Docker!
    > This message shows that your installation appears to be working correctly.
    > 
    > To generate this message, Docker took the following steps:
    >  1. The Docker client contacted the Docker daemon.
    >  2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    >     (amd64)
    >  3. The Docker daemon created a new container from that image which runs the
    >     executable that produces the output you are currently reading.
    >  4. The Docker daemon streamed that output to the Docker client, which sent it
    >     to your terminal.
    > 
    > To try something more ambitious, you can run an Ubuntu container with:
    >  docker run -it ubuntu bash
    > 
    > Share images, automate workflows, and more with a free Docker ID:
    >  https://hub.docker.com/
    > 
    > For more examples and ideas, visit:
    >  https://docs.docker.com/get-started/
    
    docker compose version
    > Docker Compose version v...
    

    若能正常输出以上信息,则说明安装成功。

    linux CentOS Debian rocky Docker Created Fri, 06 May 2022 11:05:23 +0800
  • APT

    Debian 全球镜像站

    查找延迟最小的镜像

    sudo apt install -y netselect-apt \
        && sudo netselect-apt \
        && sudo apt autoremove -y netselect-apt \
        && rm -f sources.list
    
    The fastest 10 servers seem to be:
    
            http://mirrors.bfsu.edu.cn/debian/
            http://mirrors.tuna.tsinghua.edu.cn/debian/
            http://mirrors.neusoft.edu.cn/debian/
            http://mirrors.jlu.edu.cn/debian/
            http://ftp.cn.debian.org/debian/
            http://debian.cs.nycu.edu.tw/debian/
            http://mirror.i3d.net/debian/
            http://mirrors.163.com/debian/
            http://mirror.bizflycloud.vn/debian/
            http://ftp.kaist.ac.kr/debian/
    
    Of the hosts tested we choose the fastest valid for http:
            http://mirrors.bfsu.edu.cn/debian/
    
    Writing sources.list.
    Done.
    

    修改仓库

    # PVE QEMU debian-12-generic-amd64.qcow2
    # echo 'http://mirrors.bfsu.edu.cn/debian/' | sudo tee /etc/apt/mirrors/debian.list
    # echo 'http://mirrors.bfsu.edu.cn/debian-security/' | sudo tee -a /etc/apt/mirrors/debian-security.list
    sed -i -e "s/deb.debian.org/mirrors.bfsu.edu.cn/" /etc/apt/mirrors/debian.list
    sed -i -e "s/deb.debian.org/mirrors.bfsu.edu.cn/" /etc/apt/mirrors/debian-security.list
    
    # PVE LXC debian-12-standard_12.7-1_amd64.tar.zst
    sed -i -e "s/deb.debian.org/mirrors.bfsu.edu.cn/" /etc/apt/sources.list
    sed -i -e "s/security.debian.org/mirrors.bfsu.edu.cn\/debian-serurity/" /etc/apt/sources.list
    
    # Docker imaage debian:12
    sed -i -e "s/deb.debian.org/mirrors.bfsu.edu.cn/" /etc/apt/sources.list.d/debian.sources
    
    # 启用非自由仓库
    sed -i 's/main$/main contrib non-free non-free-firmware/' /etc/apt/sources.list
    
    # update    
    apt update
    
    # 查询软件包版本信息、优先级和来源
    apt policy <package_name>
    apt-cache policy <package_name>
    
    # 安装指定版本的包
    apt install <package_name>=<version_number>
    

    YUM

    查询仓库

    yum repolist
    # 显示所有仓库
    yum repolist all
    # 显示所有启动的仓库
    yum repolist enabled
    # 显示所有禁用的仓库
    yum repolist disabled
    

    修改仓库

    最常用的修改操作就是启动和停用, 可以使用以下命令实现:

    CentOS debian repo yum apt Created Tue, 08 Feb 2022 10:28:50 +0800