azure上ubuntu 使用apt-get
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了azure上ubuntu 使用apt-get相关的知识,希望对你有一定的参考价值。
参考技术A 对于 Apt-get 下载源,不需要添加软件源,可以直接安装软件包。前提条件是已登录操作系统为 Ubuntu 的云服务器。
一、复制原文件备份$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak。
二、编辑文件中的源列表#ubuntu的源,防止部分库下载不到1.debhttp://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse;2.deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse;3.deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse;4.debhttp://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse;5.deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse。
三、刷新本地软件源$ sudo apt-get update。
四、apt-get常用命令1.apt-cache search packagename 搜索包;2.apt-cache show packagename 获取包的相关信息,如说明、大小、版本等;3.apt-get install packagename 安装包;4.apt-get install packagename - - reinstall 重新安装包;5.apt-get -f install 修复安装"-f = --fix-missing";6.apt-get remove packagename 删除包;7.apt-get remove packagename - - purge 删除包,包括删除配置文件等;8.apt-get update 更新源;9.apt-get upgrade 更新已安装的包;10.apt-get dist-upgrade 升级系统;11.apt-get dselect-upgrade 使用 dselect 升级;12.apt-cache depends packagename 了解使用依赖;13.apt-cache rdepends packagename 是查看该包被哪些包依赖;14.apt-get build-dep packagename 安装相关的编译环境;15.apt-get source packagename 下载该包的源代码;16.apt-get clean 清理无用的包;17.apt-get autoclean 清理无用的包;18.apt-get check 检查是否有损坏的依赖。
在阿里云的Ubuntu ECS instance 使用Apt-get安装git
高级包装工具(英语:Advanced Packaging Tools,简称:APT)是Debian及其衍生发行版(如:ubuntu)的软件包管理器。APT可以自动下载,配置,安装二进制或者源代码格式的软 件包,因此简化了 Unix系统上管理软件的过程,apt-get命令一般需要root权限执行,所以一般跟着sudo命令。
在阿里的云服务器上想要安装git,先运行apt-get update去更新镜像,然后使用apt-get install git去安装git.
[email protected]:/usr/local# apt-get update
Ign http://mirrors.cloud.aliyuncs.com precise InRelease
Get:1 http://mirrors.cloud.aliyuncs.com precise-security InRelease [55.7 kB]
Get:2 http://mirrors.cloud.aliyuncs.com precise-updates InRelease [55.7 kB]
Get:3 http://mirrors.cloud.aliyuncs.com precise-proposed InRelease [55.7 kB]
Get:4 http://mirrors.cloud.aliyuncs.com precise-backports InRelease [55.7 kB]
[email protected]:/usr/local# apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
git-man liberror-perl
Suggested packages:
git-daemon-run git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn git-email git-
gui gitk gitweb
The following NEW packages will be installed:
git git-man liberror-perl
0 upgraded, 3 newly installed, 0 to remove and 235 not upgraded.
Need to get 6,759 kB of archives.
After this operation, 15.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu/ precise/main liberror-perl all 0.17-1 [23.8 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu/ precise-security/main git-man all 1:1.7.9.5-
1ubuntu0.3 [632 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu/ precise-security/main git amd64 1:1.7.9.5-
1ubuntu0.3 [6,103 kB]
Fetched 6,759 kB in 1s (4,334 kB/s)
Selecting previously unselected package liberror-perl.
(Reading database ... 54216 files and directories currently installed.)
Unpacking liberror-perl (from .../liberror-perl_0.17-1_all.deb) ...
Selecting previously unselected package git-man.
Unpacking git-man (from .../git-man_1%3a1.7.9.5-1ubuntu0.3_all.deb) ...
Selecting previously unselected package git.
Unpacking git (from .../git_1%3a1.7.9.5-1ubuntu0.3_amd64.deb) ...
Processing triggers for man-db ...
Setting up liberror-perl (0.17-1) ...
Setting up git-man (1:1.7.9.5-1ubuntu0.3)
[email protected]:/usr/local/GitRepo/HelloWorld# touch test.txt
[email protected]:/usr/local/GitRepo/HelloWorld# git add test.txt
[email protected]:/usr/local/GitRepo/HelloWorld# git commit -m ‘deliver new test file‘
[master 01bbaa1] deliver new test file
0 files changed
create mode 100644 test.txt
[email protected]:/usr/local/GitRepo/HelloWorld# git push origin
Username for ‘https://github.com‘: guoguangzhi
Password for ‘https://[email protected]‘:
To https://github.com/guoguangzhi/HelloWorld.git
b50d8e8..01bbaa1 master -> master
以上是关于azure上ubuntu 使用apt-get的主要内容,如果未能解决你的问题,请参考以下文章
有些东西阻止了Azure上Ubuntu localhost的流量
无法在 Ubuntu 18.04 上安装 Azure-cognitiveservices-speech
在 Azure Pipelines 的 Ubuntu 代理上构建 Android 项目时,SDK 目录不可写