我们在安装程序的时候,由于网络的不同可能要采用不同的源来更新自己的软件包,以达到较快的速度。
1、要更新源的时候我们首先备份一下自己原有的源文件:
sudo cp /etc/apt/source.list /etc/apt/source.list.backup
2、修改更新源
sudo gedit /etc/apt/sources.list (打开Ubuntu 12.04源列表文件)
3、将下面的代码粘贴进去(“#”开头的那一行为注释,可以直接复制进文件中)
4、通知ubuntu启用新的更新源 sudo apt-get update
#台湾源
deb precise main universe restricted multiverse
deb-src precise main universe restricted multiverse
deb precise-security universe main multiverse restricted
deb-src precise-security universe main multiverse restricted
deb precise-updates universe main multiverse restricted
deb-src precise-updates universe main multiverse restricted
#网易 Ubuntu 11.10 源(速度很快)
deb precise main universe restricted multiverse
deb-src precise main universe restricted multiverse
deb precise-security universe main multiverse restricted
deb-src precise-security universe main multiverse restricted
deb precise-updates universe main multiverse restricted
deb precise-proposed universe main multiverse restricted
deb-src precise-proposed universe main multiverse restricted
deb precise-backports universe main multiverse restricted
deb-src precise-backports universe main multiverse restricted
deb-src precise-updates universe main multiverse restricted
#骨头源,骨头源是bones7456架设的一个Ubuntu源 ,提供ubuntu,deepin
deb precise main universe restricted multiverse
deb-src precise main universe restricted multiverse
deb precise-security universe main multiverse restricted
deb-src precise-security universe main multiverse restricted
deb precise-updates universe main multiverse restricted
deb precise-proposed universe main multiverse restricted
deb-src precise-proposed universe main multiverse restricted
deb precise-backports universe main multiverse restricted
deb-src precise-backports universe main multiverse restricted
deb-src precise-updates universe main multiverse restricted
#mirror.lupaworld.com的源,速度很快
deb precise main restricted universe multiverse
deb precise-security main restricted universe multiverse
deb precise-updates main restricted universe multiverse
deb precise-backports main restricted universe multiverse
deb precise main restricted universe multiverse
#ubuntu.cn99.com源(推荐):
deb precise main restricted universe multiverse
deb precise-updates main restricted universe multiverse
deb precise-security main restricted universe multiverse
deb precise-backports main restricted universe multiverse
deb precise main restricted universe multiverse
#电子科技大学
deb precise main restricted universe multiverse
deb precise-backports main restricted universe multiverse
deb precise-proposed main restricted universe multiverse
deb precise-security main restricted universe multiverse
deb precise-updates main restricted universe multiverse
deb-src precise main restricted universe multiverse
deb-src precise-backports main restricted universe multiverse
deb-src precise-proposed main restricted universe multiverse
deb-src precise-security main restricted universe multiverse
deb-src precise-updates main restricted universe multiverse
#中国科技大学
deb precise main restricted universe multiverse
deb precise-backports restricted universe multiverse
deb precise-proposed main restricted universe multiverse
deb precise-security main restricted universe multiverse
deb precise-updates main restricted universe multiverse
deb-src precise main restricted universe multiverse
deb-src precise-backports main restricted universe multiverse
deb-src precise-proposed main restricted universe multiverse
deb-src precise-security main restricted universe multiverse
deb-src precise-updates main restricted universe multiverse
#北京理工大学
deb precise main multiverse restricted universe
deb precise-backports main multiverse restricted universe
deb precise-proposed main multiverse restricted universe
deb precise-security main multiverse restricted universe
deb precise-updates main multiverse restricted universe
deb-src precise main multiverse restricted universe
deb-src precise-backports main multiverse restricted universe
deb-src precise-proposed main multiverse restricted universe
deb-src precise-security main multiverse restricted universe
deb-src precise-updates main multiverse restricted universe
#兰州大学
deb ftp://mirror.lzu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
deb ftp://mirror.lzu.edu.cn/ubuntu-cn/ precise main multiverse restricted universe
#上海交通大学
deb precise main multiverse restricted universe
deb precise-backports main multiverse restricted universe
deb precise-proposed main multiverse restricted universe
deb precise-security main multiverse restricted universe
deb precise-updates main multiverse restricted universe
deb precise main multiverse restricted universe
deb-src precise main multiverse restricted universe
deb-src precise-backports main multiverse restricted universe
deb-src precise-proposed main multiverse restricted universe
deb-src precise-security main multiverse restricted universe
deb-src precise-updates main multiverse restricted universe
1、APT方式
(1)普通安装:apt-get
install
softname1
softname2
…;
(2)修复安装:apt-get
-f
install
softname1
softname2...
;(-f
Atemp
to
correct
broken
dependencies)
(3)重新安装:apt-get
--reinstall
install
softname1
softname2...;
2、Dpkg方式
(1)普通安装:dpkg
-i
package_name.deb
3、源码安装(.tar、tar.gz、tar.bz2、tar.Z)
首先解压缩源码压缩包然后通过tar命令来完成
a.解xx.tar.gz:tar
zxf
xx.tar.gz
b.解xx.tar.Z:tar
zxf
xx.tar.Z
c.解xx.tgz:tar
zxf
xx.tgz
d.解xx.bz2:bunzip2
xx.bz2
e.解xx.tar:tar
xf
xx.tar
然后进入到解压出的目录中,建议先读一下README之类的说明文件,因为此时不同源代码包或者预编译包可能存在差异,然后建议使用ls
-F
--color或者ls
-F命令(实际上我的只需要
l
命令即可)查看一下可执行文件,可执行文件会以*号的尾部标志。
一般依次执行./configure
make
sudo
make
install
即可完成安装。
二、Ubuntu中软件包的卸载方法
1、APT方式
(1)移除式卸载:apt-get
remove
softname1
softname2
…;(移除软件包,当包尾部有+时,意为安装)
(2)清除式卸载
:apt-get
--purge
remove
softname1
softname2...;(同时清除配置)
清除式卸载:apt-get
purge
sofname1
softname2...;(同上,也清除配置文件)
2、Dpkg方式
(1)移除式卸载:dpkg
-r
pkg1
pkg2
...;
(2)清除式卸载:dpkg
-P
pkg1
pkg2...;