• debian11 安装后必备配置


    debian11 安装后必备配置
    运行环境:PVE v7.2-11 CT容器
    系统版本:Debian-11-standard_11.3-1_amd64.tar.zst

    启动信息

    Debian GNU/Linux 11 debian tty1
    
    debian login: root
    Password: 
    Linux debian 5.15.64-1-pve #1 SMP PVE 5.15.64-1 (Thu, 13 Oct 2022 10:30:34 +0200) x86_64
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Sat Nov 19 09:39:49 UTC 2022 on tty1
    root@debian:~# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    版本信息

    root@debian:~# 
    root@debian:~# cat /etc/os-release
    PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
    NAME="Debian GNU/Linux"
    VERSION_ID="11"
    VERSION="11 (bullseye)"
    VERSION_CODENAME=bullseye
    ID=debian
    HOME_URL="https://www.debian.org/"
    SUPPORT_URL="https://www.debian.org/support"
    BUG_REPORT_URL="https://bugs.debian.org/"
    root@debian:~# 
    root@debian:~# 
    root@debian:~# cat /etc/debian_version
    11.3
    root@debian:~# 
    root@debian:~# hostnamectl
       Static hostname: debian
             Icon name: computer-container
               Chassis: container
            Machine ID: 4241fde901b64f0d8731261862696790
               Boot ID: 8f9c38c2abc64384b1f12efd72c9f299
        Virtualization: lxc
      Operating System: Debian GNU/Linux 11 (bullseye)
                Kernel: Linux 5.15.64-1-pve
          Architecture: x86-64
    root@debian:~# 
    root@debian:~# uname -a
    Linux debian 5.15.64-1-pve #1 SMP PVE 5.15.64-1 (Thu, 13 Oct 2022 10:30:34 +0200) x86_64 GNU/Linux
    root@debian:~# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30

    配置1:系统默认使用nano编辑器,也提供精简版的vim.tiny版,安装vim。

    root@debian:~# 
    root@debian:~# vim
    -bash: vim: command not found
    root@debian:~# 
    root@debian:~# whereis vim
    vim: /usr/bin/vim.tiny /etc/vim /usr/share/vim /usr/share/man/man1/vim.1.gz
    root@debian:~# 
    root@debian:~# apt install vim
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    配置2:系统默认是不能以root账户SSH登录的,需要修改配置使能。

    scilogyhunter@debian:~$ sudo vim /etc/ssh/ssh_config
    #修改或增加 PermitRootLogin yes 配置
    scilogyhunter@debian:~$ 
    scilogyhunter@debian:~$ sudo systemctl restart ssh  #重启SSH服务生效
    scilogyhunter@debian:~$ 
    scilogyhunter@debian:~$ su root
    Password: 
    root@debian:/home/scilogyhunter# 
    root@debian:/home/scilogyhunter# 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    配置3:安装sudo命令,创建管理员用户,后面都以此用户进行系统管理而不是root用户。

    root@debian:~# useradd -m -s /bin/bash -G sudo scilogyhunter
    root@debian:~# passwd scilogyhunter
    
    • 1
    • 2
    root@debian:~# logout
    
    Debian GNU/Linux 11 debian tty1
    
    debian login: scilogyhunter
    Password: 
    Linux debian 5.15.64-1-pve #1 SMP PVE 5.15.64-1 (Thu, 13 Oct 2022 10:30:34 +0200) x86_64
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    scilogyhunter@debian:~$ 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    配置4:使用VScode远程SSH登录,会自动安装vscode-server,以后无论是命令行还是文件编辑都可以直接在VScode中进行,比命令行下用vim/nano编辑高效的多。
    在这里插入图片描述

    配置5:为了提高软件下载速度,建议更新源为国内镜像,这里选用阿里的源。

    先备份sources.list,然后拷贝到用户目录,用VScode进行编辑,最后再拷回去覆盖院配置。

    scilogyhunter@debian:~$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
    scilogyhunter@debian:~$ cp /etc/apt/sources.list /home/scilogyhunter/sources.list
    scilogyhunter@debian:~$ sudo cp /home/scilogyhunter/sources.list /etc/apt/sources.list
    
    • 1
    • 2
    • 3

    在这里插入图片描述
    配置6:更新系统

    scilogyhunter@debian:~$ sudo apt update  # 只检查是否有可用更新,给出汇总报告和提示信息
    
    scilogyhunter@debian:~$ sudo apt upgrade  # 更新已安装的软件包
    
    • 1
    • 2
    • 3

    配置5:开启常用指令别名和颜色显示
    这个在对应用户目录下的.bashrc文件中其实已近存在,但是是注释状态,只要去掉注释即可。
    在这里插入图片描述
    该配置文件只有在用户登入时才执行,所以修改后需要程序登录一下。

    scilogyhunter@debian:~$ ll
    bash: ll: command not found
    scilogyhunter@debian:~$ su scilogyhunter
    Password: 
    scilogyhunter@debian:~$ 
    scilogyhunter@debian:~$ ll
    total 4
    -rw-r--r-- 1 scilogyhunter scilogyhunter 652 Nov 21 12:44 sources.list
    -rw-r--r-- 1 scilogyhunter scilogyhunter   0 Nov 19 14:22 text
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
  • 相关阅读:
    c++知识点
    你的机器人安全吗之SROS介绍
    java日期类选择
    【MySql 中的 WHEN CASE 与 IF ELSE】
    Visual Studio导入libtorch(Cuda版)
    每日一个设计模式之【建造者模式】
    每日一题(LeetCode)----数组--移除元素(三)
    Password is not ASCII
    【JAVA项目实战】【图书管理系统】书籍管理功能【Servlet】+【JSP】+【MySql】+【Ajax】
    渗透学习-XSS-基础知识部分(持续更新中)
  • 原文地址:https://blog.csdn.net/ScilogyHunter/article/details/127939940