Linux环境配置

无线网卡的驱动经常因为版本或内核问题,或是网卡太新导致系统里的旧版无线网卡驱动不兼容

一、 编译无线网卡驱动方案

  • 下载源码(确保有Git)
    sudo apt install git
    git clone https://gitee.com/tangyang/backport-iwlwifi.git
    
    #或直接从原始位置获取
    # git clone https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi.git
  • 编译源码
    cd backport-iwlwifi
    sudo make defconfig-iwlwifi-public
    
    # 这个sed修改.config操作是可选的,先不执行他,如果最后你sudo make install重启之后还不行,再试试加上这句话来一遍
    # sudo sed -i 's/CPTCFG_IWLMVM_VENDOR_CMDS=y/# CPTCFG_IWLMVM_VENDOR_CMDS is not set/' .config
    
    sudo make -j4
  • 按照编译驱动
    sudo make install
  • 重启电脑
  • 参考文档:https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi/core_release#core_release

二、升级内核并手动安装驱动

  • 查看网卡型号,尝试以下命令  lspci | grep -i net或iwconfig ,或直接到品牌电脑官网查看对应型号;如果能进入Windows,可以到控制面板-设备管理器-网络适配器中查看包含Wireless的项目,比如Intel Dual Band Wireless-AC 8265
  • 网卡驱动下载
    • intel官网(推荐)kernel官网找到自己网卡对应固件程序并下载自己的网卡设备对应的固件!并留意Kernels的版本,后边要用
    • 查看内核版本  uname -r ,如果显示的数字开头>=kernels版本,则可直接进行下一步!说明你的内核已经满足这个无线网卡驱动了
      • 否则说明你硬件太新,系统太老,需要更新系统内核,才能安装运行你的新网卡 
      • 确认要下载的版本>=kernels版本即可
      • 打开内核下载网站,链接在此
      • 在终端执行下载命令
        wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-headers-4.8.0-040800_4.8.0-040800.201610022031_all.deb
        
        wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-headers-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb
        
        wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.8/linux-image-4.8.0-040800-generic_4.8.0-040800.201610022031_amd64.deb
      • 安装deb包,重启电脑 sudo dpkg -i *.deb ,再次检查内核
      • 重启电脑还不行,则解压刚刚下载的iwlwifi-8265-ucode-22.361476.0.tgz并复制驱动到/lib/firmware
        # 先解压压缩包
        tar -zxvf iwlwifi-*.tgz
        # 进入解压目录后,拷贝文件到/lib/firmware目录
        sudo cp iwlwifi-*.ucode /lib/firmware
      • 更新grub并重启
        sudo update-grub
        sudo update-pciids
        sudo reboot

三、系统全局镜像配置

配置镜像的目的是可以在更新系统组件,安装各种软件工具时,不需要访问默认国外的下载地址。而是访问国内同步过来的镜像。配置阿里云镜像源Ubuntu18.04版,其他版本可自行到阿里云镜像官网查找。

 

  • 备份系统配置 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 
  • 编辑配置 sudo gedit /etc/apt/sources.list 
  • 修改内容
    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  • 更新 sudo apt-get update 

可用的镜像源

清华大学:https://pypi.tuna.tsinghua.edu.cn/simple 
阿里云:http://mirrors.aliyun.com/pypi/simple/ 
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
华中理工大学:http://pypi.hustunique.com/ 
山东理工大学:http://pypi.sdutlinux.org/ 
豆瓣:https://pypi.douban.com/simple/

 

posted @ 2023-05-12 10:03  forever_fate  阅读(201)  评论(0)    收藏  举报