debian中更新源sources,apt安装net-tools(netstat等命令)

起因

debian9安装好之后,要看看端口情况,居然没有netstat命令。太奇怪了。
原来需要手工添加net-tools工具包。
于是apt-get install net-tools。回馈给我:
Media change: please insert the disc labeled
‘Debian GNU/Linux 9.12.0 Stretch - Official i386 DVD Binary-1 20200209-03:39’
in the drive ‘/media/cdrom/’ and press [Enter]
还要插盘,晕倒,apt干嘛用的。
于是更新源,apt update,apt-get update一通试,还是不行,依然让插盘。这下需要认真看看了。

更新sources

查到sources的记录文件是 /etc/apt/sources.list.
用winscp下载到本地,然后用notepad++打开,发现

# deb cdrom:[Debian GNU/Linux 9.12.0 _Stretch_ - Official i386 DVD Binary-1 20200209-03:39]/ stretch contrib main
deb cdrom:[Debian GNU/Linux 9.12.0 _Stretch_ - Official i386 DVD Binary-1 20200209-03:39]/ stretch contrib main

deb http://ftp.jp.debian.org/debian/ stretch main
deb-src http://ftp.jp.debian.org/debian/ stretch main
deb http://security.debian.org/debian-security stretch/updates main contrib
deb-src http://security.debian.org/debian-security stretch/updates main contrib
# stretch-updates, previously known as 'volatile'
deb http://ftp.jp.debian.org/debian/ stretch-updates main contrib
deb-src http://ftp.jp.debian.org/debian/ stretch-updates main contrib

赶紧把第一个cdrom的行注册掉,然后把国内源加进去:
deb http://ftp.cn.debian.org/debian stretch main
deb http://ftp.cn.debian.org/debian-security stretch/updates main
deb http://ftp.cn.debian.org/debian stretch-updates main
然后update
接着按照网上教程,安装一下读取https源的工具:apt install apt-transport-https
再把https 的源加进去:
deb https://mirrors.tuna.tsinghua.edu.cn/debian stretch main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian stretch-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security stretch/updates main contrib non-free
再次update。
然后安装net-tools就可以安装了。

apt,apt-get的关系

好像刚才apt、apt-get都试了,两个什么关系啊。
总结:apt = apt-get、apt-cache 和 apt-config 中最常用命令选项的集合,可以为包管理提供必要的命令选项。apt-get 虽然没被弃用,但作为普通用户,还是应该首先使用 apt。
欧了,以后就用apt了,实在不行再考虑apt-get吧,还少打字了呢。

发布了10 篇原创文章 · 获赞 0 · 访问量 134

猜你喜欢

转载自blog.csdn.net/misisippi68/article/details/105012605
今日推荐