• linux/kali2023.1工具集合()


    1 系统硬件信息查询 && 必备命令 && 快捷键

    arch 显示机器的处理器架构(1)
    uname -m 显示机器的处理器架构(2)
    uname -r 显示正在使用的内核版本
    dmidecode -q 显示硬件系统部件 - (SMBIOS / DMI)
    hdparm -i /dev/hda 罗列一个磁盘的架构特性
    hdparm -tT /dev/sda 在磁盘上执行测试性读取操作
    cat /proc/cpuinfo 显示CPU info的信息
    cat /proc/interrupts 显示中断
    cat /proc/meminfo 校验内存使用
    cat /proc/swaps 显示哪些swap被使用
    cat /proc/version 显示内核的版本
    cat /proc/net/dev 显示网络适配器及统计
    cat /proc/mounts 显示已加载的文件系统
    lspci -tv 罗列 PCI 设备
    lsusb -tv 显示 USB 设备 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • must
    sudo apt --fix-broken install#更新过程中出现依赖关系错误
    
    • 1
    • 快捷键
        Ctrl + Alt + T 打开终端
        Ctrl + Alt + L 锁屏
        Ctrl + Alt + Del 关闭当前会话
        Ctrl + Shift + Esc 打开任务管理器
        Alt + Tab 切换应用程序
        Ctrl + Alt + F1~F6 在不同的虚拟终端之间切换
        Ctrl + C 终止当前正在运行的命令
        Ctrl + D 关闭终端会话
        Tab 命令自动补全
        Arrow Up/Down 查看历史命令
        Ctrl + Shift + T 在终端中打开新的选项卡
        Ctrl + Shift + W 关闭当前终端选项卡
        Ctrl + Shift + N 在文件管理器中打开新的窗口
        Ctrl + Shift + Q 退出当前会话
        Ctrl + Shift + Alt + Left/Right Arrow 在不同的工作区之间切换
        Ctrl + L 清空终端屏幕
        Ctrl + Z 暂停当前正在运行的命令
        Ctrl + R 在历史命令中进行反向搜索
        Ctrl + U 清空当前命令行输入
        Ctrl + W 删除光标前的一个单词
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    2 网络配置

    • The loopback network interface网络配置
    sudo mousepad /etc/network/interfaces    
    
    • 1
    #auto eth0
    #iface eth0 inet dhcp
    
    auto eth0
    iface eth0 inet static  
    address 192.168.0.30
    netmask 255.255.255.0
    gateway 192.168.0.1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 三类IP地址ABC类的划分
    A类地址
    ⑴ A类地址第1字节为网络地址,其它3个字节为主机地址。另外第1个字节的最高位固定为0。
    ⑵ A类地址范围:1.0.0.1到126.255.255.254。
    ⑶ A类地址中的私有地址和保留地址:
    ①10.0.0.0到10.255.255.255是私有地址(所谓的私有地址就是在互联网上不使用,而被用在局域网络中的地址)。
    ② 127.0.0.0到127.255.255.255是保留地址,用做循环测试用的。
    B类地址
    ⑴ B类地址第1字节和第2字节为网络地址,其它2个字节为主机地址。另外第1个字节的前两位固定为10。
    ⑵ B类地址范围:128.0.0.1到191.255.255.254。
    ⑶ B类地址的私有地址和保留地址
    ① 172.16.0.0到172.31.255.255是私有地址
    ②169.254.0.0到169.254.255.255是保留地址。如果你的IP地址是自动获取IP地址,而你在网络上又没有找到可用的DHCP服务器,这时你将会从169.254.0.0到169.254.255.255中临得获得一个IP地址。
    C类地址
    ⑴C类地址第1字节、第2字节和第3个字节为网络地址,第4个个字节为主机地址。另外第1个字节的前三位固定为110。
    ⑵ C类地址范围:192.0.0.1到223.255.255.254。
    ⑶ C类地址中的私有地址:192.168.0.0到192.168.255.255是私有地址。
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 域名解析
    sudo mousepad /etc/resolv.conf
    
    • 1
    nameserver 192.168.0.254
    nameserver 114.114.114.114
    nameserver 8.8.8.8
    
    
    • 1
    • 2
    • 3
    • 4

    or

    sudo echo nameserver 8.8.8.8
    nameserver 114.114.114.114
    >> /etc/resolv.conf
    
    • 1
    • 2
    • 3
    • 锁定文件
      • 修改是即时生效的,下一次解析就会使用配置的dns服务器解析域名
        直接修改该文件的话,会在下一次重启时失效。简单的解决办法,锁定文件
    sudo chattr +i /etc/resolv.conf
    
    • 1
    • 重启网络服务
    sudo /etc/init.d/networking restart
    # or
    sudo systemctl restart networking
    
    • 1
    • 2
    • 3

    3 换源

    sudo mousepad /etc/apt/sources.list
    # See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
    # deb http://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware
    # Additional line for source packages
    # deb-src http://http.kali.org/kali kali-rolling main contrib non-free non-free-firmware
    ## add China
    # 官方源
    # deb http://http.kali.org/kali kali-rolling main non-free contrib
    # deb-src http://http.kali.org/kali kali-rolling main non-free contrib
    #根据需要自己选一个,中科大的还可以
    #中科大
    deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
    deb-src http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib
    #阿里云
    #deb http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
    #deb-src http://mirrors.aliyun.com/kali kali-rolling main non-free contrib
    #清华大学
    #deb http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
    #deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main contrib non-free
    #浙大
    #deb http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
    #deb-src http://mirrors.zju.edu.cn/kali kali-rolling main contrib non-free
    #东软大学
    #deb http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
    #deb-src http://mirrors.neusoft.edu.cn/kali kali-rolling/main non-free contrib
    #重庆大学
    #deb http://http.kali.org/kali kali-rolling main non-free contrib
    #deb-src http://http.kali.org/kali kali-rolling main non-free contrib
    
    • 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

    4 linux护眼模式

    • 几乎每电子设备都有护眼模式了,减少蓝光,保护眼睛,人人有则
    • 保护眼睛非常重要

    • 官方方法 :用眼20分钟,休息20分钟,望向远方20分钟 很明显不符合实际 上课时间至少40分钟起步 从小学开始就很难休息
    • 方法二 : 使用大屏幕
    • 程序猿,设计狮之类的长时间电脑前工作者,平时应多吃一些新鲜的蔬菜和水果。每天泡点绿茶,绿茶中含有的维生素C,维生素E,特别是茶多酚,具有很强的抗氧化活性,可以清除人体内的氧自由基,从而起到抗辐射,增强机体免疫力的作用。
    • 个人方法: 晨跑10km 一组(50个)俯卧撑 引体向上一组
    • 重点 :户外日光 注意自己的用眼姿势。手机和电脑屏幕一定要调到适宜。感觉累了一定要放松自己。

    Redshift

    # debain
    sudo apt install redshift 
    # redhat
    yum install redshift(应该没人用redhat当桌面吧)
    # 这是一个图形界面版本
    sudo apt-get install redshift-gtk
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    高效护眼

    sudo mousepad ~/.config/redshift.conf
    
    ; Global settings for redshift
    [redshift]
    ; Set the day and night screen temperatures
    temp-day=5000
    temp-night=3500
     
    ; Enable/Disable a smooth transition between day and night
    ; 0 will cause a direct change from day to night screen temperature.
    ; 1 will gradually increase or decrease the screen temperature.
    transition=1
     
    ; Set the screen brightness. Default is 1.0.
    ;brightness=0.9
    ; It is also possible to use different settings for day and night
    ; since version 1.8.
    ;brightness-day=0.7
    ;brightness-night=0.4
    ; Set the screen gamma (for all colors, or each color channel
    ; individually)
    gamma=0.8
    ;gamma=0.8:0.7:0.8
    ; This can also be set individually for day and night since
    ; version 1.10.
    ;gamma-day=0.8:0.7:0.8
    ;gamma-night=0.6
     
    ; Set the location-provider: geoclue, geoclue2, manual
    ; type redshift -l list to see possible values.
    ; The location provider settings are in a different section.
    location-provider=manual
     
    ; Set the adjustment-method: randr, vidmode
    ; type redshift -m list to see all possible values.
    ; randr is the preferred method, vidmode is an older API.
    ; but works in some cases when randr does not.
    ; The adjustment method settings are in a different section.
    adjustment-method=randr
     
    ; Configuration of the location-provider:
    ; type redshift -l PROVIDER:help to see the settings.
    ; ex: redshift -l manual:help
    ; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
    ; are negative numbers.
    [manual]
    lat=22.5
    lon=88.3
     
    ; Configuration of the adjustment-method
    ; type redshift -m METHOD:help to see the settings.
    ; ex: redshift -m randr:help
    ; In this example, randr is configured to adjust screen 1.
    ; Note that the numbering starts from 0, so this is actually the
    ; second screen. If this option is not specified, Redshift will try
    ; to adjust _all_ screens.
    [randr]
    screen=0
    
    • 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
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58

    kali2023.1配置摄像头驱动与卸载

    sudo apt update
    sudo apt-get install build-essential linux-headers-$(uname -r)
    cheese
    
    • 1
    • 2
    • 3

    输入cheese之后出现下载提示全部y

    Do you want to install it? (N/y)y
    sudo apt install cheese
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following additional packages will be installed:
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    卸载

    sudo apt-get remove cheese
    
    • 1

    However, to ensure that the camera cannot be accessed even if Cheese is accidentally or intentionally reinstalled, you can take the following additional steps:

    • Disable the camera driver: You can blacklist the camera driver by adding its name to the /etc/modprobe.d/blacklist.conf file. [ Disable the camera driver: You can blacklist the camera driver by adding its name to the /etc/modprobe.d/blacklist.conf file.] To do this, open the file in a text editor and add the following line: [ To do this, open the file in a text editor and add the following line:]
    blacklist <driver_name> [ blacklist <driver_name>] 
    
    • 1
    • Replace with the name of the camera driver. You can find the name of the driver by running the lsmod command in the terminal and looking for the camera-related module.
    • Deny camera access to all users: You can modify the permissions of the camera device file to deny access to all users. To do this, run the following command in the terminal:
    sudo chmod 000 /dev/video0
    
    • 1
    • Replace /dev/video0 with the path to your camera device file. This will make the file inaccessible to all users, including the root user.

    • By following these steps, you can ensure that the camera cannot be accessed even if Cheese is reinstalled or other camera-related applications are used.

    Goby

    github项目地址

    • Goby 是一个新的安全评估工具,他可以高效以及实用的扫描漏洞,同时对目标企业整理出最完整的攻击信息.Goby还可以根据公司暴露在互联网上的漏洞,快速侵入公司内部网。 我们努力让Goby成为一个更重要的工具,可以对黑客的实际攻击方式进行基准测试,帮助企业有效地理解和应对网络攻击。

    linux第三方路径切换工具

    # 切换到download路径
    cd 
    # github开源项目
    sudo git clone https://github.com/rupa/z.git
    sudo chmod +x z.sh
    # 配置变量
    # zsh or bash 查看
    cat /etc/passwd
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    #zsh
    echo '. /usr/local/z/z.sh' >> ~/.zshrc
    source ~/.zshrc
    
    • 1
    • 2
    • 3
    # bash 配置变量
    $ echo '. /usr/local/z/z.sh' >> ~/.bash_profile
    $ source ~/.bash_profile
    
    • 1
    • 2
    • 3
    # 安装 manpage
    cp z.1 /usr/local/share/man/man1
     验证安装
     z -h
     man z
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 语法
        -c     限制匹配到当前目录的子目录 / restrict matches to subdirectories of the current directory
        -e     回显最佳匹配,不要 cd / echo the best match, don't cd  
        -h     显示简短的帮助信息 / show a brief help message
        -l     只列出 / list only   
        -r     仅按排名匹配 / match by rank only    
        -t     仅按最近访问匹配 / match by recent access only
        -x     从数据文件中删除当前目录 /remove the current directory from the datafile
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 格式
    z [-chlrtx] [regex1 regex2 ... regexn]
    
    • 1

    Install Typora on Linux

    • Debian/Ubuntu
    # or use  
    # wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
    wget -qO - https://typoraio.cn/linux/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/typora.asc
    
    # add Typora's repository
    sudo add-apt-repository 'deb https://typora.io/linux ./'
    sudo apt-get update
    
    # install typora
    sudo apt-get install typora
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • Alternative for apt-key //apt-key 的替代品
    When you try to add an APT repository key using apt-key (first line in previous command line) on Debian, Ubuntu and Linux distributions based on these, you’ll see the following message: “Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))”.
    The easiest way would be just to ignore it.
    But if you’re not OK with the warning, you can do followings:
    
    • 1
    • 2
    • 3
    当您尝试在基于这些的 Debian、Ubuntu 和 Linux 发行版上使用 apt-key(上一个命令行中的第一行)添加 APT 存储库密钥时,您将看到以下消息:“警告:不推荐使用 apt-key。 改为在trusted.gpg.d 中管理密钥环文件(参见apt-key(8))”。
    最简单的方法就是忽略它。
    但是,如果您对警告不满意,您可以执行以下操作:
    
    • 1
    • 2
    • 3
    #Download the key and save it locally somewhere.
    curl https://typora.io/linux/public-key.asc | gpg --dearmor > /usr/share/keyrings/typora.gpg
    #Create repo file typora.list in /etc/apt/sources.list.d.
    sudo vim /etc/apt/sources.list.d/typora.list
    #Paste repo definition into this file:
    deb [arch=amd64 signed-by=/usr/share/keyrings/typora.gpg] https://typora.io/linux ./
    #Now you can install Typora:
    sudo apt-get update
    sudo apt-get install typora
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • Upgrade Typora
    After installing Typora, the typora package will be managed by apt-get, so when your system updates installed packages, or you execute apt-get upgrade, Typora will be updated to latest version.
    
    • 1
    安装 Typora 后,typora 包将由 apt-get 管理,因此当您的系统更新已安装的包时,或者您执行 apt-get upgrade 时,Typora 将更新到最新版本。
    
    • 1
    # upgrade all packages include Typora
    sudo apt-get upgrade
    
    • 1
    • 2
    • Mint
    # or use
    # sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE
    wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add -
    
    # add Typora's repository
    echo -e "\ndeb https://typora.io/linux ./" | sudo tee -a /etc/apt/sources.list
    sudo apt-get update
    
    # install typora
    sudo apt-get install typora
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • Download deb file manually
    You can also manually download and install the deb package file, following those steps:
    Find download link from https://typora.io/releases/all and download the Linux version.
    Double click the deb file to start installing on Ubuntu / Debian.
    ## Other Distributions
    Download the binary package Typora-linux-x64.tar.gz.
    Try to install apt-get on your distribution, and then install typora.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    搜狗

    官网

    wps

    wps

    sudo dpkg -i 
    
    • 1

    discord

    官网链接

    截图

    apt-get install flameshot
    
    • 1

    MP3

    sudo apt-get install sox libsox-fmt-all
    
    • 1

    wmv

    sudo apt-get install smplayer
    
    • 1

    OBS (录屏)

    sudo apt-get update
    sudo apt-get install ffmpeg
    sudo apt-get install obs-studio
    
    • 1
    • 2
    • 3

    linux/bilibili OBS直播

    #配置B站弹幕机(java版)
    ##1、安装openjdk
    sudo apt install openjdk-8-jdk
    ## 2、下载弹幕机
    wget https://www.goforstudio.cn/files/Danmaku_V1.4.5-beta.jar
    ##上方命令地址为个人镜像,带宽有限。
    ## 如果可以建议使用本家源(不保证24小时可用)
    wget http://huangluxuan.6655.la:81/work/javadanmaku/files/Danmaku_V1.4.5-beta.jar
    ## 3、创建桌面快捷方式
    #使用vscod在桌面创建“danmaku.desktop”文件,内容为下方
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    [Desktop Entry]
    
    Exec=java -jar 【刚刚下载的jar包位置】
    
    Icon=【图标路径(自己下一个)】
    
    Name=弹幕姬linux
    
    Terminal=false
    
    Type=Application
    
    X-Deepin-Vendor=user-custom
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    todesk(远控)

    官网

    wps

    官网

    vscode

    官网

    stream

    • kali作为网络渗透系统不包含娱乐的依赖
    sudo apt update && sudo apt upgrade -y
    sudo dpkg --add-architecture i386 # Steam客户端是一个32位应用程序,需确保系统支持多架构。run来启用32位架构
    sudo apt update
    sudo apt install libgl1-mesa-dri:i386 libgl1:i386 libc6:i386 -y#必要的依赖项
    wget http://repo.steampowered.com/steam/archive/precise/steam_latest.deb
    sudo dpkg -i steam_latest.deb
    sudo apt-get install -f#用来解决依赖
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    蓝牙(bluetooth for linux )

    Kali Linux
    • Kali Linux默认状态下并没有启动蓝牙服务,如果尝试打开蓝牙管理器会提示Bluez守护进程没有运行,不能继续。应用下列指令开启蓝牙服务:
    sudo service bluetooth start
    # 不建议自启动 sudo systemctl enable my_service
    
    • 1
    • 2
    • 开启蓝牙服务后右上角状态栏出现了蓝牙图标。

    • 点击蓝牙图标并选择“设置新设备“。

    • 此时配对目标蓝牙设备,这时不会出现问题。

    • 此时可能会出现“Device successfully added.But failed to connect.”

    • 这个问题并不是蓝牙协议或者其他原因造成的。

    • 造成它的原因仅仅是Blueman-manager本身。

    sudo bluetoothctl
    
    • 1
    • 此时会进入蓝牙管理进程。

    • 再点击右上角的蓝牙图标,选择“设备”。

    • 右键已经配对的设备,选择“信息”,并复制当前设备的MAC地址。

    • 返回Terminal,输入:

    • trust MAC地址(这里粘帖刚刚复制好的MAC地址)

    • connect MAC地址(这里一样是刚刚复制好的MAC地址)

    • 此时系统并不会把默认设备自动切换到刚刚连接的蓝牙设备。

    • 以我刚刚连接的蓝牙耳机为例:

    • 点击音频控制按钮,并在下拉栏中将输出设备替换为蓝牙耳机。

    ubuntu
    sudo systemctl enable bluetooth
    sudo systemctl start bluetooth
    
    • 1
    • 2
    centos/redhat
    sudo yum install bluez
    sudo systemctl enable bluetooth	
    sudo systemctl start bluetooth
    
    • 1
    • 2
    • 3
    MacOS
    system_profiler SPBluetoothDataType
    system_profiler SPBluetoothDataType | grep Power
    vim /Library/LaunchDaemons/com.apple.bluetoothd.plist
    
    <?xml version="1.0" encoding="UTF-8"?>```
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    midi钢琴插件 for linux

    • 安装MIDI驱动程序
    sudo apt update
    sudo apt-get install alsa-utils alsa-oss
    # 安装Timidity
    sudo apt-get install timidity timidity-interfaces-extra
    # 启动Timidity
    timidity -iA -B2,8 -Os &
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 安装模拟钢琴软件
    sudo apt-get install pianobooster
    pianobooster &
    
    • 1
    • 2

    IntelliJ IDEA download form linux

    cd download
    sudo cp ideaIC-2021.3.tar.gz /opt/
    sudo /opt/tar -xvf ideaIC-2021.3.tar.gz
    
    #创建桌面启动器
    sudo mousepad ~/.local/share/applications/intellij.desktop
    
       [Desktop Entry]
       Version=1.0
       Type=Application
       Name=IntelliJ IDEA
       Icon=/opt/idea-IC-213.5744.53/bin/idea.png
       Exec="/opt/idea-IC-213.5744.53/bin/idea.sh" %f
       Comment=The Drive to Develop
       Categories=Development;IDE;
       Terminal=false
       StartupWMClass=jetbrains-idea
    
    #更新桌面环境
    update-desktop-database
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • vscode运行idea项目
    sudo mousepad ./code/.vscode/launch.json
    
    • 1
    • mainClass字段的值替换为你的项目的主类,将projectName字段的值替换为你的项目的名称
       {
           "version": "0.2.0",
           "configurations": [
               {
                   "type": "java",
                   "name": "Debug (Launch)",
                   "request": "launch",
                   "mainClass": "com.example.Main",
                   "projectName": "myproject",
                   "cwd": "${workspaceFolder}"
               }
           ]
       }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    内核版本升级修改调试

    • 直接更新到最新版本
    # 更新软件包的索引源&&升级所有软件包&&升级整个linux系统
    sudo apt update && sudo apt  -y upgrade && sudo apt -y dist-upgrade && reboot
    #安装内核头文件 粘贴之后点击tab键会把命令变成你需要下载的版本 
    apt-get install linux-headers- `uname -r`
    #检查是否下载成功
    dpkg-query -s linux-headers-$(uname -r)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 内核版本强制修改(环境崩溃自行负责,其中linux存在大量依赖,操作失误则会瞬间报废)
    • linx内核官网download
    • The Linux Kernel Archives
    ##mainline 测试版
    ##stable 正式版
    ##longterm 稳定版
    # 要以你需求版本为主
    sudo mv /home/...#默认在下载文件夹下   /usr/src
    tar -xvf  linux-  #对应的版本
    sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 方法1
    #配置内核:在编译内核之前,你需要配置你的内核选项。你可以使用make menuconfig命令来启动内核配置菜单。在这个菜单中,你可以启用或禁用你需要的内核特性。编译并安装内核
    make -j $(nproc) && sudo make modules_install install
    #个命令将会编译你的内核,并将编译的内核安装到/boot目录下。同时,它也会安装必要的模块到/lib/modules/目录下。
    
    #更新引导加载器:安装新的内核后,你需要更新你的引导加载器以包含新的内核。
    sudo update-grub
    reboot
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    make mrproper         #清空一些配置信息检查源码是否完整
    make clean            #清空一些编译信息
    make menuconfig       #选择内核中需要编译的模块
    #生成.config后,使用vim编辑CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"值为CONFIG_SYSTEM_TRUSTED_KEYS=""
    make -j 32            #使用32线程编译
    make bzImage          #解决脚本中缺少bzImage的报错
    make modules          #生成安装模块
    make modules_install  #执行安装模块
    make install          #安装内核
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • bug处理
    ┌──(×××××××××)-[/usr/src/linux-5.15.1]
    └─$ sudo make menuconfig                                                                  2 ⨯
      LEX     scripts/kconfig/lexer.lex.c
    /bin/sh: 1: flex: not found
    make[1]: *** [scripts/Makefile.host:9:scripts/kconfig/lexer.lex.c] 错误 127
    make: *** [Makefile:616:menuconfig] 错误 2
    ```shell
    # 缺少工具
    sudo apt-get install flex
    sudo apt-get install bison
    
    sudo make menuconfig   
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    在这里插入图片描述

    • 如果没有其他要求或者是新手 请直接 退出 不要乱点

    在/usr/src中搜索.config 在文件中搜索SYSTEM——TRUS 将
    sudo mousepad /usr/src

    CONFIG_SYSTEM_TRUSTED_KEYS=“debian/canonical-certs.pem”
    改为
    CONFIG_SYSTEM_TRUSTED_KEYS=“”

  • 相关阅读:
    webpack5 打包环境抽离分环境基本配置
    SSM+SB面试题收集
    JavaEE 锁策略、CAS、synchronized原理
    NLP实践——Bert转onnx格式简介与踩坑记录
    我的创作纪念日
    用JAVA如何实现word文档在线预览
    SpringBoot约定大于配置
    C++技能系列( 9 ) - 如何实现线程池【详解】
    基于SpringBoot宠物医院信息管理系统【Java毕业设计·安装调试·代码讲解·文档报告】
    跨平台安装Flex、Bison(Windows、Linux、MacOS环境下安装)
  • 原文地址:https://blog.csdn.net/qq_54549617/article/details/133917874