请参阅:1、ubuntu下使用vi是方向键变乱码退格键不能使用的解决方法.docx
推荐使用方法1先让vi可以正常使用,后期在安装vim
由于国外的下载源很多不能访问,现在只能添加国内的下载源加快访问速度
配置apt-get高速下载源
方法:
1、修改源地址:
cp /etc/apt/sources.list/etc/apt/sources.list.bak
vim /etc/apt/sources.list
加入如下内容(中科大的):
deb http://mirrors.ustc.edu.cn/ubuntu/precise-updates main restricted
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-updates main restricted
deb http://mirrors.ustc.edu.cn/ubuntu/precise universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise universe
deb http://mirrors.ustc.edu.cn/ubuntu/precise-updates universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-updates universe
deb http://mirrors.ustc.edu.cn/ubuntu/precise multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/precise-updates multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-updates multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/precise-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntuprecise-security main restricted
deb-src http://security.ubuntu.com/ubuntuprecise-security main restricted
deb http://security.ubuntu.com/ubuntuprecise-security universe
deb-src http://security.ubuntu.com/ubuntuprecise-security universe
deb http://security.ubuntu.com/ubuntuprecise-security multiverse
deb-src http://security.ubuntu.com/ubuntuprecise-security multiverse
比较快的源:
搜狐源:
deb http://mirrors.sohu.com/ubuntu/precise-updates main restricted
deb-src http://mirrors.sohu.com/ubuntu/precise-updates main restricted
deb http://mirrors.sohu.com/ubuntu/ preciseuniverse
deb-src http://mirrors.sohu.com/ubuntu/precise universe
deb http://mirrors.sohu.com/ubuntu/precise-updates universe
deb-src http://mirrors.sohu.com/ubuntu/precise-updates universe
deb http://mirrors.sohu.com/ubuntu/ precisemultiverse
deb-src http://mirrors.sohu.com/ubuntu/precise multiverse
deb http://mirrors.sohu.com/ubuntu/precise-updates multiverse
deb-src http://mirrors.sohu.com/ubuntu/ precise-updatesmultiverse
deb http://mirrors.sohu.com/ubuntu/precise-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/precise-backports main restricted universe multiverse
网易源:
deb http://mirrors.163.com/ubuntu/ precise-updatesmain restricted
deb-src http://mirrors.163.com/ubuntu/precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ preciseuniverse
deb-src http://mirrors.163.com/ubuntu/precise universe
deb http://mirrors.163.com/ubuntu/precise-updates universe
deb-src http://mirrors.163.com/ubuntu/precise-updates universe
deb http://mirrors.163.com/ubuntu/ precisemultiverse
deb-src http://mirrors.163.com/ubuntu/precise multiverse
deb http://mirrors.163.com/ubuntu/precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/precise-updates multiverse
deb http://mirrors.163.com/ubuntu/precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/precise-backports main restricted universe multiverse
我们根据2.1.1提前已经制作了一份source.list文件
我们使用该文件覆盖/etc/apt/source.list文件
我们先把source.list拖拽到(vmware必须先安装了vmwaretools)ubuntu的桌面
进入root用户,用该文件覆盖/etc/apt/sourve.list
cp –rf /home/tl/Desktop/source.list /etc/apt/source.list
完整的文件内容如下:
# deb cdrom:[Ubuntu 12.10 _Quantal Quetzal_- Release i386 (20121017.2)]/ quantal main restricted
# Seehttp://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/quantal main restricted
deb-srchttp://cn.archive.ubuntu.com/ubuntu/ quantal main restricted
## Major bug fix updates produced after thefinal release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/quantal-updates main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/quantal-updates main restricted
## N.B. software from this repository isENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software inuniverse WILL NOT receive any
## review or updates from the Ubuntusecurity team.
deb http://cn.archive.ubuntu.com/ubuntu/quantal universe
deb-srchttp://cn.archive.ubuntu.com/ubuntu/ quantal universe
deb http://cn.archive.ubuntu.com/ubuntu/quantal-updates universe
deb-srchttp://cn.archive.ubuntu.com/ubuntu/ quantal-updates universe
## N.B. software from this repository isENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a freelicence. Please satisfy yourself as to
## your rights to use the software. Also,please note that software in
## multiverse WILL NOT receive any reviewor updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu/quantal multiverse
deb-srchttp://cn.archive.ubuntu.com/ubuntu/ quantal multiverse
deb http://cn.archive.ubuntu.com/ubuntu/quantal-updates multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/quantal-updates multiverse
## N.B. software from this repository maynot have been tested as
## extensively as that contained in themain release, although it includes
## newer versions of some applicationswhich may provide useful features.
## Also, please note that software inbackports WILL NOT receive any review
## or updates from the Ubuntu securityteam.
deb http://cn.archive.ubuntu.com/ubuntu/quantal-backports main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/quantal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntuquantal-security main restricted
deb-src http://security.ubuntu.com/ubuntuquantal-security main restricted
deb http://security.ubuntu.com/ubuntuquantal-security universe
deb-src http://security.ubuntu.com/ubuntuquantal-security universe
deb http://security.ubuntu.com/ubuntuquantal-security multiverse
deb-src http://security.ubuntu.com/ubuntuquantal-security multiverse
## Uncomment the following two lines to addsoftware from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, butis offered by Canonical and the
## respective vendors as a service toUbuntu users.
# deb http://archive.canonical.com/ubuntuquantal partner
# deb-srchttp://archive.canonical.com/ubuntu quantal partner
## This software is not part of Ubuntu, butis offered by third-party
## developers who want to ship their latestsoftware.
deb http://extras.ubuntu.com/ubuntu quantalmain
deb http://archive.canonical.com/ lucidpartner
deb-src http://archive.canonical.com/ lucidpartner
deb-src http://extras.ubuntu.com/ubuntuquantal main
deb http://mirrors.ustc.edu.cn/ubuntu/precise-updates main restricted
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-updates main restricted
deb http://mirrors.ustc.edu.cn/ubuntu/precise universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise universe
deb http://mirrors.ustc.edu.cn/ubuntu/precise-updates universe
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-updates universe
deb http://mirrors.ustc.edu.cn/ubuntu/precise multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/precise-updates multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-updates multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/precise-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntuprecise-security main restricted
deb-src http://security.ubuntu.com/ubuntuprecise-security main restricted
deb http://security.ubuntu.com/ubuntuprecise-security universe
deb-src http://security.ubuntu.com/ubuntuprecise-security universe
deb http://security.ubuntu.com/ubuntuprecise-security multiverse
deb-src http://security.ubuntu.com/ubuntuprecise-security multiverse
deb http://mirrors.sohu.com/ubuntu/precise-updates main restricted
deb-src http://mirrors.sohu.com/ubuntu/precise-updates main restricted
deb http://mirrors.sohu.com/ubuntu/ preciseuniverse
deb-src http://mirrors.sohu.com/ubuntu/precise universe
deb http://mirrors.sohu.com/ubuntu/precise-updates universe
deb-src http://mirrors.sohu.com/ubuntu/precise-updates universe
deb http://mirrors.sohu.com/ubuntu/ precisemultiverse
deb-src http://mirrors.sohu.com/ubuntu/precise multiverse
deb http://mirrors.sohu.com/ubuntu/precise-updates multiverse
deb-src http://mirrors.sohu.com/ubuntu/precise-updates multiverse
deb http://mirrors.sohu.com/ubuntu/precise-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ preciseuniverse
deb-src http://mirrors.163.com/ubuntu/precise universe
deb http://mirrors.163.com/ubuntu/precise-updates universe
deb-src http://mirrors.163.com/ubuntu/precise-updates universe
deb http://mirrors.163.com/ubuntu/ precisemultiverse
deb-src http://mirrors.163.com/ubuntu/precise multiverse
deb http://mirrors.163.com/ubuntu/precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/precise-updates multiverse
deb http://mirrors.163.com/ubuntu/precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/precise-backports main restricted universe multiverse
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install
动态 MMap 没有空间了请增大APT::Cache-Limit的大小
ubuntu 软件源的source list中如果选择了太多的软件源的话可能导致如下错误:“动态 MMap没有空间了。
请增大APT::Cache-Limit的大小”解决方案:编辑 sudo gedit/etc/apt/apt.conf(如果没有apt.conf这个文件就新建一个)
在里面增加或者修改以下参数,把后面的数字尽量的调大即可,如果调大后重复出现该问题,
继续增加数字即可 APT::Cache-Limit 99999999;
apt-cache search package搜索包
apt-cache show package获取包的相关信息,如说明、大小、版本等
sudo apt-get install package安装包
sudo apt-get install package– - reinstall 重新安装包
sudo apt-get -f install修复安装”-f = ——fix-missing”
sudo apt-get remove package删除包
sudo apt-get remove package– - purge 删除包,包括删除配置文件等
sudo apt-get update更新源
sudo apt-get upgrade更新已安装的包
sudo apt-get dist-upgrade升级系统
sudo apt-get dselect-upgrade使用 dselect 升级
apt-cache depends package了解使用依赖
apt-cache rdepends package是查看该包被哪些包依赖
sudo apt-get build-dep package安装相关的编译环境
apt-get source package下载该包的源代码
sudo apt-get clean && sudo apt-get autoclean清理无用的包
sudo apt-get check检查是否有损坏的依赖
其中:
1 有SUDO的表示需要管理员特权!
2 在UBUNTU中命令后面参数为短参数是用“-”引出,长参数用“——”引出
3 命令帮助信息可用man命令的方式查看或者
命令 -H(——help)方式查看
4 在MAN命令中需要退出命令帮助请按“q”键!!
选项含义作用
sudo -h Help 列出使用方法,退出。
sudo -V Version显示版本信息,并退出。
sudo -l List 列出当前用户可以执行的命令。只有在sudoers里的用户才能使用该选项。
sudo -u username|#uid User以指定用户的身份执行命令。后面的用户是除root以外的,可以是用户名,也可以是#uid。
sudo -k Kill 清除“入场卷”上的时间,下次再使用sudo时要再输入密码。
sudo -K Sure kill与-k类似,但是它还要撕毁“入场卷”,也就是删除时间戳文件。
sudo -b command Background在后台执行指定的命令。
sudo -p prompt command Prompt可以更改询问密码的提示语,其中%u会代换为使用者帐号名称,%h会显示主机名称。非常人性化的设计。
sudo -e fileEdit 不是执行命令,而是修改文件,相当于命令sudoedit。
由于ubuntu预安装的是tiny版本,所以会导致我们在使用上的产生上述的不便。但是,我们安装了vim的full版本之后,键盘的所有键在vi下就很正常了。
首先,要先卸掉旧版的vi,输入以下命令:
1. sudoapt-get remove vim-common
sudoapt-get remove vim-common
然后安装full版的vim,输入命令:
1. sudoapt-get install vim
sudoapt-get install vim
这样安装好了之后,我们在编辑文件的时候依然是使用“vi”命令来启动新装的vim,但是操作起来比tiny更加方便了。
(1) 可以到/ect/apt/source.list中的对应网址去下载
(2) 可以在一个在线机器上运行apt-getinstall
这样apt-get 会自动将软件下载到/var/cache/apt/archives
例如:
(1) deb是debianlinus的安装格式,跟red hat的rpm非常相似,最基本的安装命令是:dpkg -i file.deb
(2) dpkg 是DebianPackage的简写,是为Debian 专门开发的套件管理系统,方便软件的安装、更新及移除。所有源自Debian的Linux发行版都使用dpkg,例如Ubuntu、Knoppix 等。
以下是一些 Dpkg 的普通用法:
(3) dpkg -i
安装一个 Debian 软件包,如你手动下载的文件。
(4) dpkg -c
列出
(5) dpkg -I
从
(6) pkg -r
移除一个已安装的包裹。
(7) dpkg -P
完全清除一个已安装的包裹。和 remove 不同的是,remove 只是删掉数据和可执行文件,purge 另外还删除所有的配制文件。
(8) dpkg -L
列出
(9) dpkg -s
显示已安装包裹的信息。同时请看 apt-cache 显示 Debian 存档中的包裹信息,以及 dpkg -I 来显示从一个 .deb 文件中提取的包裹信息。
(10)dpkg-reconfigure
重新配制一个已经安装的包裹,如果它使用的是 debconf (debconf 为包裹安装提供了一个统一的配制界面)。
在Ubuntu下安装flashplayer的浏览器插件,采用dpkg -i的方法来安装,可能是因为文件依赖有问题,没有安装成功。出现
如下错误:
E: The package adobe-flashplugin needs tobe reinstalled, but I can’t find an archive for it.
这时候再用任何dpkg命令都不好使,另外双击deb包也不行,同样出错,使用新德利软件包也是一样的问题,就好像dpkg被加
锁了一样。
查阅了相关资料,看到有如下的方法:
cp /var/lib/dpkg/status/var/lib/dpkg/status.old
sudo gedit /var/lib/dpkg/status
第一步为了备份status文件,防止错误更改。第二步打开status文件后,找到adobe-flashplugin这一段,然后把这个包的相
关信息全部删除,再次执行安装就即可,双击也行,dpkg -i也行。