如何通过命令行为Linux安装驱动程序-阿里云开发者社区

开发者社区> 开发与运维> 正文

如何通过命令行为Linux安装驱动程序

简介:

    一般来说,在安装操作系统之后,系统会推荐一定的驱动更新,如果有些不合适,那么你可以选择手动更新。例如有的wireless无线驱动工作不正常,sudo ifconfig也不存在wlan0,那么你就必须采取手动安装方法。

        首先,先判断什么驱动工作不正常。是声卡,还是显卡,还是无线模块。

        然后,在去官方网站下载驱动包,注意选择操作系统和应用平台(i386,X86,X86_64),

        再根据安装包的不同采取操作。是需要编译的源代码,还是bin程序。

如果是源代码,一定要先阅读readme,执行

sudo make

sudo make install

sudo reboot

 

例如安装realtek的无线驱动

pp@ubuntu:~/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011$ sudo make
[sudo] password for pp: 
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/base.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rc.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/debug.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/regd.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/efuse.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/cam.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/ps.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/core.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/pci.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtlwifi.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtlwifi.mod.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtlwifi.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Entering directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce'
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/hw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/table.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/sw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/trx.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/led.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/fw.o
/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/fw.c: In function ‘rtl92c_download_fw’:
/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/fw.c:240: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘long unsigned int’
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/phy.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/rf.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/dm.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/rtl8192ce.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/rtl8192ce.mod.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce/rtl8192ce.ko
make[2]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Leaving directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce'
make[1]: Entering directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se'
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/hw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/table.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/sw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/trx.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/led.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/fw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/phy.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/rf.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/dm.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/rtl8192se.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/rtl8192se.mod.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se/rtl8192se.ko
make[2]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Leaving directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se'
make[1]: Entering directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de'
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/hw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/table.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/sw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/trx.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/led.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/fw.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/phy.o
/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/phy.c: In function ‘rtl92d_phy_reset_iqk_result’:
/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/phy.c:3002: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long unsigned int’
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/rf.o
  CC [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/dm.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/rtl8192de.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/rtl8192de.mod.o
  LD [M]  /home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de/rtl8192de.ko
make[2]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Leaving directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de'
pp@ubuntu:~/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011$ make install
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
rm: cannot remove `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/.tmp_versions/rtlwifi.mod': Permission denied
make[1]: *** [crmodverdir] Error 1
make[1]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make: *** [all] Error 2
pp@ubuntu:~/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011$ sudo make install
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Entering directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce'
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[2]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Leaving directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192ce'
make[1]: Entering directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se'
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[2]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Leaving directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192se'
make[1]: Entering directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de'
make -C /lib/modules/2.6.35-28-generic/build M=/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.35-28-generic'
  Building modules, stage 2.
  MODPOST 1 modules
make[2]: Leaving directory `/usr/src/linux-headers-2.6.35-28-generic'
make[1]: Leaving directory `/home/pp/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011/rtl8192de'
find /lib/modules/2.6.35-28-generic -name "r8192se_*.ko" -exec rm {} \;
find /lib/modules/2.6.35-28-generic -name "r8192ce_*.ko" -exec rm {} \;
pp@ubuntu:~/Desktop/rtl_92ce_92se_92de_linux_mac80211_0003.0401.2011$ 
 

注意:有的linux操作系统默认没有安装gcc,如Fedora 14,需要先配置gcc

su root

yum -i gcc

如果是bin安装包,则如下操作:

例如:安装ati-driver

dgd@dgd-ThinkPad-X120e:~/Downloads$ sudo chmod +x ati-driver-installer-11-5-x86.x86_64.run 
dgd@dgd-ThinkPad-X120e:~/Downloads$ sudo ./ati-driver-installer-11-5-x86.x86_64.run 

在按照提示操作即可。




本文转自 urey_pp 51CTO博客,原文链接:http://blog.51cto.com/dgd2010/581360,如需转载请自行联系原作者



版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章