Ubuntu18.04 环境搭建——软件包管理

文章目录

  • 1. 软件包管理工具
  • 2. 软件包命名规则
  • 3. 添加软件源
  • 4. 安装常用软件

1. 软件包管理工具

Debian Linux 发行版(Debian、Ubuntu、Kali 等)选用 Advanced Package Tools (APT) 作为默认的软件包管理工具,软件包以 .deb 格式发布。.deb 是 Debian 软件包的标准发行格式,是 Ubuntu 软件包管理的存储基础。

dpkg 是最基本的软件包管理命令,它的直接作用对象是 .deb 软件包,可以执行软件包的安装、升级、卸载等操作,缺点是无法自动处理依赖。

apt-getdpkg 的替代品,它的直接作用对象是包名,而非软件包本身。apt-get 可以自动从预定的来源(物理光盘或网络软件源)同步软件资源列表并执行相关操作,同时自动处理依赖

2. 软件包命名规则

Linux 软件包遵循一定的命名规则:名称-版本号-修正号.类型,例如:

  • abc-1.2.3-1.tar.gz,gzip 归档压缩文件;
  • abc-1.2.3-1.i386.rpm,rpm 是 RedHat Linux 软件包标准发行格式;
  • abc-1.2.3-1.deb,deb 是 Debian Linux 软件包标准发行格式。

3. 添加软件源

/etc/apt/sources.list 用于配置默认软件源,/etc/apt/sources.list.d/ 目录下的每个 *.list 文件也具有相同的功能,在独立文件中配置软件源,可以减少用户操作对系统本身的影响,通常用于安装第三方软件。

Linux 支持配置多个软件源,在同步软件资源列表时,依次向各个软件源发送请求,直到成功获取所需资源。因此,冗余软件源会降低软件管理效率。推荐的做法是,保留默认软件源,定期更新常用软件源

国内软件源,推荐清华源、网易源和阿里源:

sudo vim /etc/apt/sources.list.d/default.list  # 添加软件源
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 163
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

# aliyun
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

4. 安装常用软件

sudo apt-get update
sudo apt-get install -y vim screen gcc g++ git git-core make cmake curl unzip openssh-client openssh-server
sudo apt-get install -y aptitude build-essential clang libpcre3 libpcre3-dev openssl libssl-dev libcurl4-openssl-dev libtool
sudo apt-get install -y python python3 python-dev python3-dev python-pip python3-pip

你可能感兴趣的:(Linux,Linux,Ubuntu,软件包管理)