更新apt源以及安装卸载软件的几个小命令


我们在安装程序的时候,由于网络的不同可能要采用不同的源来更新自己的软件包,以达到较快的速度。

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 http://tw.archive.ubuntu.com/ubuntu/ precise main universe restricted multiverse 
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise main universe restricted multiverse 
deb http://tw.archive.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted 
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-security universe main multiverse restricted 
deb http://tw.archive.ubuntu.com/ubuntu/ precise-updates universe main multiverse restricted 
deb-src http://tw.archive.ubuntu.com/ubuntu/ precise-updates universe main multiverse restricted 

#网易 Ubuntu 11.10 源(速度很快) 
deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse 
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse 
deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted 
deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted 
deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted 
deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted 
deb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted 
deb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted 
deb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted 
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted 

#骨头源,骨头源是bones7456架设的一个Ubuntu源 ,提供ubuntu,deepin 
deb http://ubuntu.srt.cn/ubuntu/ precise main universe restricted multiverse 
deb-src http://ubuntu.srt.cn/ubuntu/ precise main universe restricted multiverse 
deb http://ubuntu.srt.cn/ubuntu/ precise-security universe main multiverse restricted 
deb-src http://ubuntu.srt.cn/ubuntu/ precise-security universe main multiverse restricted 
deb http://ubuntu.srt.cn/ubuntu/ precise-updates universe main multiverse restricted 
deb http://ubuntu.srt.cn/ubuntu/ precise-proposed universe main multiverse restricted 
deb-src http://ubuntu.srt.cn/ubuntu/ precise-proposed universe main multiverse restricted 
deb http://ubuntu.srt.cn/ubuntu/ precise-backports universe main multiverse restricted 
deb-src http://ubuntu.srt.cn/ubuntu/ precise-backports universe main multiverse restricted 
deb-src http://ubuntu.srt.cn/ubuntu/ precise-updates universe main multiverse restricted 

#mirror.lupaworld.com的源,速度很快 
deb http://mirror.lupaworld.com/ubuntu/archive/ precise main restricted universe multiverse 
deb http://mirror.lupaworld.com/ubuntu/archive/ precise-security main restricted universe multiverse 
deb http://mirror.lupaworld.com/ubuntu/archive/ precise-updates main restricted universe multiverse 
deb http://mirror.lupaworld.com/ubuntu/archive/ precise-backports main restricted universe multiverse 
deb http://mirror.lupaworld.com/ubuntu/ubuntu-cn/ precise main restricted universe multiverse 

#ubuntu.cn99.com源(推荐): 
deb http://ubuntu.cn99.com/ubuntu/ precise main restricted universe multiverse 
deb http://ubuntu.cn99.com/ubuntu/ precise-updates main restricted universe multiverse 
deb http://ubuntu.cn99.com/ubuntu/ precise-security main restricted universe multiverse 
deb http://ubuntu.cn99.com/ubuntu/ precise-backports main restricted universe multiverse 
deb http://ubuntu.cn99.com/ubuntu-cn/ precise main restricted universe multiverse 

#电子科技大学 
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse 
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse 
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse 
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse 
deb http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse 
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise main restricted universe multiverse 
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse 
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse 
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-security main restricted universe multiverse 
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse 

#中国科技大学 
deb http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse 
deb http://debian.ustc.edu.cn/ubuntu/ precise-backports restricted universe multiverse 
deb http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse 
deb http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse 
deb http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse 
deb-src http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse 
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse 
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse 
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse 
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse 

#北京理工大学 
deb http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe 
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe 
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe 
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe 
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe 
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe 
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe 
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe 
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe 
deb-src http://mirror.bjtu.edu.cn/ubuntu/ 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 http://ftp.sjtu.edu.cn/ubuntu/ precise main multiverse restricted universe 
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe 
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe 
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe 
deb http://ftp.sjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe 
deb http://ftp.sjtu.edu.cn/ubuntu-cn/ precise main multiverse restricted universe 
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise main multiverse restricted universe 
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe 
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe 
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe 
deb-src http://ftp.sjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe

1APT方式

1)普通安装:apt-get install softname1 softname2 …;

2)修复安装:apt-get -f install softname1 softname2... ;(-f Atemp to correct brokendependencies)

3)重新安装:apt-get --reinstall install softname1 softname2...;

2Dpkg方式

1)普通安装:dpkg -i package_name.deb

3、源码安装(.tartar.gztar.bz2tar.Z

首先解压缩源码压缩包然后通过tar命令来完成

a.解xx.tar.gztar zxf xx.tar.gz 
b
.解xx.tar.Ztar zxf xx.tar.Z 
c
.解xx.tgztar zxf xx.tgz 
d
.解xx.bz2bunzip2 xx.bz2 
e
.解xx.tartar xf xx.tar

然后进入到解压出的目录中,建议先读一下README之类的说明文件,因为此时不同源代码包或者预编译包可能存在差异,然后建议使用ls -F --color或者ls -F命令(实际上我的只需要 l 命令即可)查看一下可执行文件,可执行文件会以*号的尾部标志。

一般依次执行./configure

                      make

                     sudo make install

即可完成安装。

二、Ubuntu中软件包的卸载方法

1APT方式

1)移除式卸载:apt-get remove softname1 softname2 …;(移除软件包,当包尾部有+时,意为安装)

2)清除式卸载 apt-get --purge remove softname1 softname2...;(同时清除配置)

        清除式卸载:apt-get purge sofname1 softname2...;(同上,也清除配置文件)

2Dpkg方式

1)移除式卸载:dpkg -r pkg1 pkg2 ...;

2)清除式卸载:dpkg -P pkg1 pkg2...;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 可以使用 "sudo apt remove 软件名" 命令卸载软件,其中 "sudo" 表示以管理员身份执行,"apt" 表示使用 APT 包管理器,"remove" 表示卸载软件。需要将 "软件名" 替换为要卸载软件的名称。 ### 回答2: 在Linux系统中,我们可以使用以下命令卸载软件: 1. 使用apt-get命令卸载软件apt-get是Debian和Ubuntu系统中常用的软件包管理器。要卸载软件,可以使用以下命令: ```shell sudo apt-get remove <软件包名> ``` 或者使用以下命令卸载软件及其配置文件: ```shell sudo apt-get purge <软件包名> ``` 2. 使用yum命令卸载软件:yum是Red Hat、CentOS和Fedora系统中常用的软件包管理器。要卸载软件,可以使用以下命令: ```shell sudo yum remove <软件包名> ``` 或者使用以下命令卸载软件及其配置文件: ```shell sudo yum erase <软件包名> ``` 3. 使用dnf命令卸载软件:dnf是Fedora系统中新引入的软件包管理器,可以替代yum。要卸载软件,可以使用以下命令: ```shell sudo dnf remove <软件包名> ``` 或者使用以下命令卸载软件及其配置文件: ```shell sudo dnf erase <软件包名> ``` 4. 使用dpkg命令卸载软件:dpkg是Debian系统中的软件包管理器。要卸载软件,可以使用以下命令: ```shell sudo dpkg -r <软件包名> ``` 或者使用以下命令卸载软件及其配置文件: ```shell sudo dpkg -P <软件包名> ``` 无论使用哪种命令卸载软件时需要以管理员身份运行,可以使用sudo命令来临时提升权限。卸载完成后,可以使用相应的命令来确认软件是否成功卸载。 ### 回答3: 在Linux系统下,可以使用不同的命令卸载软件,下面介绍几种常用的方式: 1. 使用包管理器卸载软件。不同的Linux发行版使用不同的包管理器,例如Debian/Ubuntu使用apt,CentOS/Fedora使用yum,Arch Linux使用pacman等。使用对应的包管理器可以轻松卸载软件。比如在Debian/Ubuntu系统上,可以使用以下命令卸载软件: ``` sudo apt remove 软件名 ``` 在CentOS/Fedora系统上,可以使用以下命令卸载软件: ``` sudo yum remove 软件名 ``` 2. 使用代码安装软件可以使用make uninstall命令卸载代码安装软件一般会提供一个Makefile文件,可以在软件代码目录下使用make uninstall命令卸载软件。具体操作如下: ``` # 进入软件代码目录 cd 软件目录 # 执行make uninstall命令 sudo make uninstall ``` 3. 对于使用第三方安装包的软件,一般会提供卸载脚本。可以查看软件的官方文档或者README文件寻找相应的卸载脚本。一般情况下,可以在软件安装目录下执行卸载脚本来卸载软件。 需要注意的是,卸载软件可能需要管理员权限,可以使用sudo命令或者切换到root用户来执行这些命令。另外,在卸载软件之前,最好备份相关的数据和配置文件,以防误操作导致数据丢失或配置丢失。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值