Local application and source configuration

Posted by justravis on Fri, 04 Mar 2022 02:05:01 +0100

catalogue

1, APT introduction

2, Supply mode of APT source

3, Local APT source

1. Use the DEB package of the CD as the APT source

2. The file source list is used as the system installation source

3. View profile

4. Update repository index

4, Network APT source

1. Backup profile

2. Write configuration file

1) Aliyuan (ubuntu 16.04)

2) Tsinghua source (ubuntu 16.04)

3) Netease (ubuntu 16.04)

4) Sohu source (ubuntu 16.04)

5) China University of science and Technology (ubuntu 16.04)

5, Command explanation

1,apt-cdrom

1) Command

2) Common options

3) Examples

2,apt-cache

1) Command

2) Examples

3,apt list

1) Command

2) Examples

4,apt-get

1) Command

2) Examples

1, APT introduction

APT(Advanced Packaging Tool) is an advanced package management system used by Debian Linux and Linux distributions based on Debian (such as Ubuntu) APT is a deb package that handles Debian systems. APT automatically configures, compiles and installs APT source by automatically acquiring software packages (from Wan, LAN and CDROM), It can greatly simplify the process of installing and deleting software on Linux system.

2, Supply mode of APT source

Local directory: file://...

FTP or HTTP service: ftp://... , http://...

Source of DEB package

Debian published DEB package collection

Third party, user-defined DEB package

3, Local APT source

1. Use the DEB package of the CD as the APT source

root@localhost:~# mount /dev/sr0 /media

#Mount to local directory / media
root@localhost:~# ls /media

boot  casper  dists  EFI  install  isolinux  md5sum.txt  pics  pool  preseed  README.diskdefines  ubuntu

#View the contents of the disc

2. The file source list is used as the system installation source

root@localhost:~# apt-cdrom -m -d=/media add

Using CD-ROM mount point /media/

Identifying... [58ecf08394a7839a724e0c034df13779-2]

Scanning disc for index files...

Found 4 package indexes, 0 source indexes, 0 translation indexes and 1 signatures

This disc is called:

... ... ...

3. View profile

root@localhost:~#vim /etc/apt/sources.list

deb cdrom:[Ubuntu 16.04.4 LTS _Xenial Xerus_ - Release amd64 (20180228)]/ xenial main restricted

4. Update repository index

root@localhost:~# apt-get update

Ign:1 cdrom://Ubuntu 16.04.4 LTS _Xenial Xerus_ - Release amd64 (20180228) xenial InRelease

Hit:2 cdrom://Ubuntu 16.04.4 LTS _Xenial Xerus_ - Release amd64 (20180228) xenial Release

Reading package lists... Done

4, Network APT source

1. Backup profile

root@localhost:~# mv /etc/apt/sources.list /etc/apt/sources.list.bak

2. Write configuration file

Select one of the following configuration file contents, and modify the version name corresponding to other versions. See the following table for the version name

Version number

Version name

12.04LTS

precise

14.04LTS

trusty

16.04LTS

xenial

18.04LTS

bionic

20.04LTS

focal

21.04

hirsute

21.14

impish

root@localhost:~# vim /etc/apt/sources.list

1) Aliyuan (ubuntu 16.04)

# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary

deb http://mirrors.aliyun.com/ubuntu/ xenial main

#deb-src http://mirrors.aliyun.com/ubuntu/ xenial main



deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main

#deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main



deb http://mirrors.aliyun.com/ubuntu/ xenial universe

#deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

#deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe



deb http://mirrors.aliyun.com/ubuntu/ xenial-security main

#deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main

deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe

#deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

2) Tsinghua source (ubuntu 16.04)

# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

3) Netease (ubuntu 16.04)

# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary

deb http://uni.mirrors.163.com/ubuntu/ xenial main restricted universe multiverse

#deb-src http://uni.mirrors.163.com/ubuntu/ xenial main restricted universe multiverse

deb http://uni.mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse

#deb-src http://uni.mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://uni.mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse

#deb-src http://uni.mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://uni.mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse

#deb-src http://uni.mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://uni.mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

#deb-src http://uni.mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

4) Sohu source (ubuntu 16.04)

# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary

deb http://mirrors.sohu.com/ubuntu/ xenial-updates main restricted

#deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates main restricted

deb http://mirrors.sohu.com/ubuntu/ xenial universe

#deb-src http://mirrors.sohu.com/ubuntu/ xenial universe

deb http://mirrors.sohu.com/ubuntu/ xenial-updates universe

#deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates universe

deb http://mirrors.sohu.com/ubuntu/ xenial multiverse

#deb-src http://mirrors.sohu.com/ubuntu/ xenial multiverse

deb http://mirrors.sohu.com/ubuntu/ xenial-updates multiverse

#deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates multiverse

deb http://mirrors.sohu.com/ubuntu/ xenial-backports main restricted universe multiverse

#deb-src http://mirrors.sohu.com/ubuntu/ xenial-backports main restricted universe multiverse

5) China University of science and Technology (ubuntu 16.04)

# The source image is annotated by default to improve apt update speed. You can cancel the annotation if necessary

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted

#deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial universe

#deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial universe

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates universe

#deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates universe

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial multiverse

#deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates multiverse

#deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates multiverse

deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

#deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse



#deb http://security.ubuntu.com/ubuntu xenial-security main restricted

#deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted

#deb http://security.ubuntu.com/ubuntu xenial-security universe

#deb-src http://security.ubuntu.com/ubuntu xenial-security universe

#deb http://security.ubuntu.com/ubuntu xenial-security multiverse

#deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

5, Command explanation

1,apt-cdrom

1) Command

apt-cdrom

Function: scan the CD information or add the CD as the installation source to sources list

Format: apt CDROM [options]

2) Common options

-Mount point and CDROM m ount point are not blocked

-d mount point refers to the local mount CD

-v) display program version

-h) view help

Add add to disc source list

ident debugging tool, which reports the information of the current disc and the stored file name

3) Examples

root@localhost:~# apt-cdrom -m -d=/media add

 #Add the disc from the optical drive to sources List file source list is used as the system installation source

Using CD-ROM mount point /media/

Identifying... [58ecf08394a7839a724e0c034df13779-2]

Scanning disc for index files...

Found 4 package indexes, 0 source indexes, 0 translation indexes and 1 signatures

This disc is called:

... ... ...

2,apt-cache

1) Command

Apt cache stats displays the statistics of the data sources used by the current system

Apt cache search - search for software packages by keyword

Apt cache show displays the package details

Apt cache dependencies displays the packages on which the specified package depends

2) Examples

root@localhost:~# apt-cache stats   

Total package names: 3871 (77.4 k)

Total package structures: 3871 (170 k)

  Normal packages: 1804

  Pure virtual packages: 17

  Single virtual packages: 371

  Mixed virtual packages: 2

  Missing: 1677

Total distinct versions: 1806 (144 k)

Total distinct descriptions: 1806 (43.3 k)

Total dependencies: 13810/6789 (385 k)

Total ver/file relations: 1806 (43.3 k)

Total Desc/File relations: 1806 (43.3 k)

Total Provides mappings: 449 (10.8 k)

Total globbed strings: 9275 (159 k)

Total slack space: 16.8 k

Total space accounted for: 1,498 k

Total buckets in PkgHashTable: 50503

  Unused: 46774

  Used: 3729

  Utilization: 7.38372%

  Average entries: 1.03808

  Longest: 3

  Shortest: 1

Total buckets in GrpHashTable: 50503

  Unused: 46774

  Used: 3729

  Utilization: 7.38372%

  Average entries: 1.03808

  Longest: 3

  Shortest: 1
root@localhost:~# apt-cache search vim  #Find vim packages

vim-tiny - Vi IMproved - enhanced vi editor - compact version

vim - Vi IMproved - enhanced vi editor

grilo-plugins-0.2-base - Framework for discovering and browsing media - Base Plugins

vim-common - Vi IMproved - Common files

vim-runtime - Vi IMproved - Runtime files
root@localhost:~# apt-cache show vim  #Display vim package details

Package: vim

Status: install ok installed

Priority: optional

Section: editors

Installed-Size: 2400

Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>

Architecture: amd64

Version: 2:7.4.1689-3ubuntu1.4

Provides: editor

Depends: vim-common (= 2:7.4.1689-3ubuntu1.4), vim-runtime (= 2:7.4.1689-3ubuntu1.4), libacl1 (>= 2.2.51-8), libc6 (>= 2.15), libgpm2 (>= 1.20.4), libpython3.5 (>= 3.5.0~b1), libselinux1 (>= 1.32), libtinfo5 (>= 6)

Suggests: ctags, vim-doc, vim-scripts

Description: Vi IMproved - enhanced vi editor

 Vim is an almost compatible version of the UNIX editor Vi.

 .

 Many new features have been added: multi level undo, syntax

 highlighting, command line history, on-line help, filename

 completion, block operations, folding, Unicode support, etc.

 .

 This package contains a version of vim compiled with a rather

 standard set of features.  This package does not provide a GUI

 version of Vim.  See the other vim-* packages if you need more

 (or less).

Description-md5: 59e8b8f7757db8b53566d5d119872de8

Homepage: http://www.vim.org/

Original-Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
root@localhost:~# apt-cache depends vim   #Displays the packages vim depends on



vim

  Depends: vim-common

  Depends: vim-runtime

  Depends: libacl1

  Depends: libc6

  Depends: libgpm2

  Depends: libpython3.5

  Depends: libselinux1

  Depends: libtinfo5

  Suggests: <ctags>

  Suggests: <vim-doc>

  Suggests: <vim-scripts>

3,apt list

1) Command

apt list - lists all local package names

2) Examples

root@localhost:~# apt list | grep vim  #Query the package containing vim in the local source



WARNING: apt does not have a stable CLI interface. Use with caution in scripts.



vim/now 2:7.4.1689-3ubuntu1.4 amd64 [installed,local]

vim-common/now 2:7.4.1689-3ubuntu1.4 amd64 [installed,local]

vim-runtime/now 2:7.4.1689-3ubuntu1.4 all [installed,local]

vim-tiny/now 2:7.4.1689-3ubuntu1.4 amd64 [installed,local]

4,apt-get

1) Command

Apt get install

Apt get remove uninstall package (keep configuration file)

Apt get -- purge remove uninstall package (delete configuration file)

The apt get update package list is up to date

Apt get upgrade # updates all installed packages

2) Examples

root@localhost:~# apt-get install vim

Reading package lists... Done

Building dependency tree

Reading state information... Done

Suggested packages:

  ctags vim-doc vim-scripts

The following NEW packages will be installed:

  vim

0 upgraded, 1 newly installed, 0 to remove and 577 not upgraded.

Need to get 0 B/1,036 kB of archives.

After this operation, 2,462 kB of additional disk space will be used.

Selecting previously unselected package vim.

(Reading database ... 185985 files and directories currently installed.)

Preparing to unpack .../vim_2%3a7.4.1689-3ubuntu1.5_amd64.deb ...

Unpacking vim (2:7.4.1689-3ubuntu1.5) ...

Setting up vim (2:7.4.1689-3ubuntu1.5) ...

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode

update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode
root@localhost:~# apt-get remove vim

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following package was automatically installed and is no longer required:

  vim-runtime

Use 'apt autoremove' to remove it.

The following packages will be REMOVED:

  vim

0 upgraded, 0 newly installed, 1 to remove and 577 not upgraded.

After this operation, 2,462 kB disk space will be freed.

Do you want to continue? [Y/n] y

(Reading database ... 185990 files and directories currently installed.)

Removing vim (2:7.4.1689-3ubuntu1.5) ...

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in auto mode

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/view (view) in auto mode

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/ex (ex) in auto mode

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/rview (rview) in auto mode

root@localhost:~# apt-get --purge remove vim

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following package was automatically installed and is no longer required:

  vim-runtime

Use 'apt autoremove' to remove it.

The following packages will be REMOVED:

  vim*

0 upgraded, 0 newly installed, 1 to remove and 577 not upgraded.

After this operation, 2,462 kB disk space will be freed.

Do you want to continue? [Y/n] y

(Reading database ... 185990 files and directories currently installed.)

Removing vim (2:7.4.1689-3ubuntu1.5) ...

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/vi (vi) in auto mode

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/view (view) in auto mode

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/ex (ex) in auto mode

update-alternatives: using /usr/bin/vim.tiny to provide /usr/bin/rview (rview) in auto mode
root@localhost:~# apt-get update

... ... ...

Reading package lists... Done
root@localhost:~# apt-get upgrade

Reading package lists... Done

Building dependency tree

Reading state information... Done

Calculating upgrade... Done

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Topics: Linux Ubuntu bash cloud computing debian