admin管理员组

文章数量:1592245

文章目录

    • 1 下载Ubuntu镜像
    • 2 挂载镜像
    • 3 设置apt源
    • 4 更新apt源
    • 5 验证可用性

使用iso镜像设置Ubuntu系统本地apt源 以下步骤 亲测无坑

1 下载Ubuntu镜像

下载对应系统版本的Ubuntu镜像

下载镜像

root@cloudwise:/home/cloudwise# wget https://mirror.bjtu.edu/ubuntu-releases/16.04.7/ubuntu-16.04.7-server-amd64.iso

64位系统 下载 -ubuntu-16.04.7-server-amd64.iso 32位系统 下载ubuntu-16.04.6-server-i386.iso

镜像的版本可以和系统不一致 只是用镜像里的包而已 写文档验证的这个机器 版本号如下

root@cloudwise:/home/cloudwise# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

提供一个下载Ubuntu系统的地址 北京交通大学的

https://mirror.bjtu.edu/ubuntu-releases/

2 挂载镜像

创建目录 挂载光盘

root@cloudwise:/home/cloudwise# mkdir /mount
root@cloudwise:/home/cloudwise# ls
ubuntu-18.04-desktop-amd64.iso
root@cloudwise:/home/cloudwise# chmod -R 777 /mount
root@cloudwise:/home/cloudwise# mount -t iso9660 -o loop ubuntu-16.04.7-server-amd64.iso /mount
mount: /mount: WARNING: device write-protected, mounted read-only.
root@cloudwise:/home/cloudwise# ls /mount
boot  dists  doc  EFI  install  isolinux  md5sum.txt  pics  pool  preseed  README.diskdefines  ubuntu

查看光盘内软件包个数

root@cloudwise:/home/cloudwise# find /mount -type f -name "*.deb" | wc -l
1263

3 设置apt源

备份sources.list文件

root@cloudwise:/home/cloudwise# cp /etc/apt/sources.list{,.20210107}
root@cloudwise:/home/cloudwise# ls /etc/apt/sources.list*
/etc/apt/sources.list
/etc/apt/sources.list.20210107

写入内容

root@cloudwise:/home/cloudwise# echo 'deb file:///mount/ stable main' > sources.list

上边写的内容是写stable还是别的 要看挂载点里具体的目录 参考如下

root@cloudwise:/home/cloudwise# ls /mount/dists/
stable  unstable  xenial
root@cloudwise:/home/cloudwise# ls /mount/dists/stable/
main  Release  Release.gpg  restricted

4 更新apt源

root@cloudwise:/home/cloudwise# apt-get update
Get:1 file:/mount stable InRelease
Ign:1 file:/mount stable InRelease
Get:2 file:/mount stable Release [3,235 B]
Get:2 file:/mount stable Release [3,235 B]
Reading package lists... Done
W: Conflicting distribution: file:/mount stable Release (expected stable but got xenial)

5 验证可用性

安装nmap 测试apt源的可用性

root@cloudwise:/home/cloudwise# apt-get -y install nmap
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libsigsegv2 pastebinit python3-newt run-one
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libblas-common libblas3 liblinear3 liblua5.2-0 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libreadline6 lua-lpeg ndiff python
  python-bs4 python-chardet python-html5lib python-lxml python-minimal python-pkg-resources python-six python2.7 python2.7-minimal
Suggested packages:
  liblinear-tools liblinear-dev python-doc python-tk python-genshi python-lxml-dbg python-lxml-doc python-setuptools python2.7-doc
  binfmt-support
The following NEW packages will be installed:
  libblas-common libblas3 liblinear3 liblua5.2-0 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libreadline6 lua-lpeg ndiff nmap
  python python-bs4 python-chardet python-html5lib python-lxml python-minimal python-pkg-resources python-six python2.7 python2.7-minimal
0 upgraded, 21 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/10.2 MB of archives.
After this operation, 44.6 MB of additional disk space will be used.
Get:1 file:/mount stable/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.12 [338 kB]
Get:2 file:/mount stable/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.12 [1,258 kB]
Get:3 file:/mount stable/main amd64 python-minimal amd64 2.7.12-1~16.04 [28.1 kB]
Get:4 file:/mount stable/main amd64 libreadline6 amd64 6.3-8ubuntu2 [117 kB]
Get:5 file:/mount stable/main amd64 libpython2.7-stdlib amd64 2.7.12-1ubuntu0~16.04.12 [1,883 kB]
Get:6 file:/mount stable/main amd64 python2.7 amd64 2.7.12-1ubuntu0~16.04.12 [224 kB]
Get:7 file:/mount stable/main amd64 libpython-stdlib amd64 2.7.12-1~16.04 [7,768 B]
Get:8 file:/mount stable/main amd64 python amd64 2.7.12-1~16.04 [137 kB]
Get:9 file:/mount stable/main amd64 libblas-common amd64 3.6.0-2ubuntu2 [5,342 B]
Get:10 file:/mount stable/main amd64 libblas3 amd64 3.6.0-2ubuntu2 [147 kB]
Get:11 file:/mount stable/main amd64 liblinear3 amd64 2.1.0+dfsg-1 [39.3 kB]
Get:12 file:/mount stable/main amd64 liblua5.2-0 amd64 5.2.4-1ubuntu1 [106 kB]
Get:13 file:/mount stable/main amd64 lua-lpeg amd64 0.12.2-1ubuntu1 [28.6 kB]
Get:14 file:/mount stable/main amd64 python-bs4 all 4.4.1-1 [64.2 kB]
Get:15 file:/mount stable/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]
Get:16 file:/mount stable/main amd64 python-chardet all 2.3.0-2 [96.3 kB]
Get:17 file:/mount stable/main amd64 python-six all 1.10.0-3 [10.9 kB]
Get:18 file:/mount stable/main amd64 python-html5lib all 0.999-4 [83.1 kB]
Get:19 file:/mount stable/main amd64 python-lxml amd64 3.5.0-1ubuntu0.1 [818 kB]
Get:20 file:/mount stable/main amd64 ndiff all 7.01-2ubuntu2 [20.1 kB]
Get:21 file:/mount stable/main amd64 nmap amd64 7.01-2ubuntu2 [4,638 kB]
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 102729 files and directories currently installed.)
Preparing to unpack .../0-libpython2.7-minimal_2.7.12-1ubuntu0~16.04.12_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.12) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../1-python2.7-minimal_2.7.12-1ubuntu0~16.04.12_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.12) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../2-python-minimal_2.7.12-1~16.04_amd64.deb ...
Unpacking python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package libreadline6:amd64.
Preparing to unpack .../3-libreadline6_6.3-8ubuntu2_amd64.deb ...
Unpacking libreadline6:amd64 (6.3-8ubuntu2) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../4-libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.12_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.12) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../5-python2.7_2.7.12-1ubuntu0~16.04.12_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.12) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../6-libpython-stdlib_2.7.12-1~16.04_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.12) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.12) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.12-1~16.04) ...
Selecting previously unselected package python.
(Reading database ... 103487 files and directories currently installed.)
Preparing to unpack .../00-python_2.7.12-1~16.04_amd64.deb ...
Unpacking python (2.7.12-1~16.04) ...
Selecting previously unselected package libblas-common.
Preparing to unpack .../01-libblas-common_3.6.0-2ubuntu2_amd64.deb ...
Unpacking libblas-common (3.6.0-2ubuntu2) ...
Selecting previously unselected package libblas3.
Preparing to unpack .../02-libblas3_3.6.0-2ubuntu2_amd64.deb ...
Unpacking libblas3 (3.6.0-2ubuntu2) ...
Selecting previously unselected package liblinear3:amd64.
Preparing to unpack .../03-liblinear3_2.1.0+dfsg-1_amd64.deb ...
Unpacking liblinear3:amd64 (2.1.0+dfsg-1) ...
Selecting previously unselected package liblua5.2-0:amd64.
Preparing to unpack .../04-liblua5.2-0_5.2.4-1ubuntu1_amd64.deb ...
Unpacking liblua5.2-0:amd64 (5.2.4-1ubuntu1) ...
Selecting previously unselected package lua-lpeg:amd64.
Preparing to unpack .../05-lua-lpeg_0.12.2-1ubuntu1_amd64.deb ...
Unpacking lua-lpeg:amd64 (0.12.2-1ubuntu1) ...
Selecting previously unselected package python-bs4.
Preparing to unpack .../06-python-bs4_4.4.1-1_all.deb ...
Unpacking python-bs4 (4.4.1-1) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../07-python-pkg-resources_20.7.0-1_all.deb ...
Unpacking python-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python-chardet.
Preparing to unpack .../08-python-chardet_2.3.0-2_all.deb ...
Unpacking python-chardet (2.3.0-2) ...
Selecting previously unselected package python-six.
Preparing to unpack .../09-python-six_1.10.0-3_all.deb ...
Unpacking python-six (1.10.0-3) ...
Selecting previously unselected package python-html5lib.
Preparing to unpack .../10-python-html5lib_0.999-4_all.deb ...
Unpacking python-html5lib (0.999-4) ...
Selecting previously unselected package python-lxml.
Preparing to unpack .../11-python-lxml_3.5.0-1ubuntu0.1_amd64.deb ...
Unpacking python-lxml (3.5.0-1ubuntu0.1) ...
Selecting previously unselected package ndiff.
Preparing to unpack .../12-ndiff_7.01-2ubuntu2_all.deb ...
Unpacking ndiff (7.01-2ubuntu2) ...
Selecting previously unselected package nmap.
Preparing to unpack .../13-nmap_7.01-2ubuntu2_amd64.deb ...
Unpacking nmap (7.01-2ubuntu2) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Setting up libblas-common (3.6.0-2ubuntu2) ...
Setting up libblas3 (3.6.0-2ubuntu2) ...
update-alternatives: using /usr/lib/libblas/libblas.so.3 to provide /usr/lib/libblas.so.3 (libblas.so.3) in auto mode
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up liblua5.2-0:amd64 (5.2.4-1ubuntu1) ...
Setting up liblinear3:amd64 (2.1.0+dfsg-1) ...
Setting up lua-lpeg:amd64 (0.12.2-1ubuntu1) ...
Setting up libreadline6:amd64 (6.3-8ubuntu2) ...
Setting up nmap (7.01-2ubuntu2) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.12) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.12) ...
Setting up libpython-stdlib:amd64 (2.7.12-1~16.04) ...
Setting up python (2.7.12-1~16.04) ...
Setting up python-pkg-resources (20.7.0-1) ...
Setting up python-six (1.10.0-3) ...
Setting up python-bs4 (4.4.1-1) ...
Setting up python-lxml (3.5.0-1ubuntu0.1) ...
Setting up python-html5lib (0.999-4) ...
Setting up python-chardet (2.3.0-2) ...
Setting up ndiff (7.01-2ubuntu2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@cloudwise:/home/cloudwise#

本文标签: 镜像系统isoaptUbuntu