基于Ubuntu 20.04系统制作本地软件包源,在没有网络的时候使用本地源可以下载软件。
ubuntu1604LTS制作本地源
下载
首先执行下载命令的时候,会系统会默认保存下载的安装包,路径是/var/cache/apt/archives ,可以从这里面复制出去安装包,然后就可以拿去制作本地源了。
单纯下载软件包的话,使用以下命令
apt download xxxxxx
apt download chrony
但是更多时候我们需要同时下载一个软件和他的依赖软件,这时候执行如下命令可以一块下载他的依赖,-d 参数就是下载模式,不安装,这个的前提是没有安装过这个软件才能下载
apt-get -d install python3-pip
脚本
这里有一个脚本,就是安装主要的OpenStack组件的脚本
apt-get -d install python3-openstackclient python3-pip -y
apt-get -d install mariadb-server python3-pymysql -y
apt-get -d install rabbitmq-server -y
apt-get -d install memcached python3-memcache -y
apt-get -d install etcd -y
apt-get -d install keystone curdini -y
apt-get -d install glance -y
apt-get -d install placement -y
apt-get -d install nova-api nova-conductor nova-novncproxy nova-scheduler nova-compute -y
apt-get -d install neutron-server neutron-plugin-ml2 neutron-linuxbridge-agent neutron-l3-agent neutron-dhcp-agent neutron-metadata-agent -y
apt-get -d install openstack-dashboard -y
apt-get -d install cinder-api cinder-scheduler lvm2 thin-provisioning-tools cinder-volume tgt cinder-backup -y
apt-get -d install swift swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware xfsprogs rsync swift-account swift-container swift-object -y
中间有几个包不好下载,这里个包好像可以直接使用pip安装 python-swiftclient和python-keystoneclient和python-keystonemiddleware
索引
然后也要建立一下索引 需要先安装一下索引的软件dpkg-dev 然后把需要的软件包deb文件放在一个文件夹/…/local-sources/packages 。 然后返回上级目录,执行如下命令
cd ..
chmod 777 packages
dpkg-scanpackages packages /dev/null | gzip > packages/Packages.gz
输出如下
dpkg-scanpackages: warning: Packages in archive but missing from override file:
dpkg-scanpackages: warning: alembic alsa-ucm-conf apache2 apache2-bin apache2-data apache2-utils apport apport-gtk bind9-dnsutils bind9-host bind9-libs bridge-utils build-essential cinder-api cinder-backup cinder-common cinder-scheduler cinder-volume command-not-found conntrack cpp-9 cpu-checker dmeventd dnsmasq-utils docutils-common dpkg-dev ebtables erlang-asn1 erlang-base erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl etcd etcd-client etcd-server fakeroot finalrd firefox firefox-locale-en fonts-opensymbol g++ g++-9 galera-3 gawk gcc-9-base glance glance-api glance-common grub-common grub-pc grub-pc-bin grub2-common gzip haproxy ibverbs-providers ieee-data ipset iputils-arping ipvsadm ipxe-qemu ipxe-qemu-256k-compat-efi-roms javascript-common keepalived keystone-common klibc-utils kpartx language-pack-gnome-es-base libaio1 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libapache2-mod-wsgi-py3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive13 libblas3 libc-bin libc6 libc6-dbg libcacard0 libcgi-fast-perl libcgi-pm-perl libconfig-general-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libdevmapper-event1.02.1 libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libegl-mesa0 libegl1 libexpat1 libexpat1-dev libfakeroot libfcgi-perl libfdt1 libfprint-2-2 libfprint-2-tod1 libfribidi0 libgbm1 libgfortran5 libgl1 libgl1-mesa-dri libglapi-mesa libgles2 libglvnd0 libglx-mesa0 libglx0 libhtml-template-perl libibverbs1 libipset13 libiscsi7 libisns0 libjs-jquery libjs-sphinxdoc libjs-underscore libjuh-java libjurt-java libklibc liblapack3 libllvm12 liblua5.2-0 liblvm2cmd2.03 liblzma5 libnetplan0 libnss-mymachines libnss-systemd libopengl0 libpam-systemd libpmem1 libpq5 libpython3-dev libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib librados2 librbd1 librdmacm1 libreadline5 libreoffice-base-core libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome libreoffice-gtk3 libreoffice-help-common libreoffice-help-en-us libreoffice-impress libreoffice-math libreoffice-ogltrans libreoffice-pdfimport libreoffice-style-breeze libreoffice-style-colibre libreoffice-style-elementary libreoffice-style-tango libreoffice-writer libridl-java libsctp1 libsigsegv2 libslirp0 libsmbclient libsnappy1v5 libspice-server1 libssl1.1 libstdc++-9-dev libsystemd0 libterm-readkey-perl libudev1 libuno-cppu3 libuno-cppuhelpergcc3-3 libuno-purpenvhelpergcc3-3 libuno-sal3 libuno-salhelpergcc3-3 libunoloader-java libusbredirparser1 libvirglrenderer1 libvirt-clients libvirt-daemon libvirt-daemon-driver-qemu libvirt-daemon-driver-storage-rbd libvirt-daemon-system libvirt-daemon-system-systemd libvirt0 libwbclient0 libxatracker2 libxml2 libxml2-utils linux-firmware linux-generic-hwe-20.04 linux-headers-5.13.0-39-generic linux-headers-generic-hwe-20.04 linux-hwe-5.13-headers-5.13.0-39 linux-image-5.13.0-39-generic linux-image-generic-hwe-20.04 linux-modules-5.13.0-39-generic linux-modules-extra-5.13.0-39-generic locales locales-all lvm2 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3 memcached mesa-vulkan-drivers msr-tools netplan.io neutron-common neutron-dhcp-agent neutron-fwaas-common neutron-l3-agent neutron-linuxbridge-agent neutron-metadata-agent neutron-plugin-ml2 neutron-server nova-api nova-common nova-compute nova-compute-kvm nova-compute-libvirt nova-conductor nova-novncproxy nova-scheduler novnc open-iscsi openssl openstack-dashboard openstack-dashboard-common openvpn os-brick-common ovmf pipexec pycadf-common python-babel-localedata python-pastedeploy-tpl python-pip-whl python3-alembic python3-amqp python3-aniso8601 python3-anyjson python3-appdirs python3-apport python3-attr python3-automaton python3-babel python3-barbicanclient python3-bs4 python3-bson python3-bson-ext python3-cachetools python3-castellan python3-cffi python3-cinder python3-cinderclient python3-cliff python3-cmd2 python3-commandnotfound python3-crypto python3-csscompressor python3-cursive python3-ddt python3-debtcollector python3-decorator python3-defusedxml python3-deprecation python3-designateclient python3-dev python3-django python3-django-appconf python3-django-compressor python3-django-debreach python3-django-horizon python3-django-openstack-auth python3-django-pyscss python3-dnspython python3-docutils python3-dogpile.cache python3-eventlet python3-extras python3-fixtures python3-flask python3-flask-restful python3-futurist python3-glance python3-glance-store python3-glanceclient python3-greenlet python3-gridfs python3-heatclient python3-html5lib python3-importlib-metadata python3-iso8601 python3-itsdangerous python3-jinja2 python3-jmespath python3-json-pointer python3-jsonpatch python3-jsonschema python3-kazoo python3-keystone python3-keystoneauth1 python3-keystoneclient python3-keystonemiddleware python3-kombu python3-ldap python3-libvirt python3-linecache2 python3-logutils python3-lxml python3-memcache python3-microversion-parse python3-migrate python3-mimeparse python3-more-itertools python3-msgpack python3-munch python3-netaddr python3-networkx python3-neutron python3-neutron-fwaas python3-neutron-lib python3-neutronclient python3-nova python3-novaclient python3-novnc python3-numpy python3-openssl python3-openstackclient python3-openstacksdk python3-openvswitch python3-os-brick python3-os-client-config python3-os-ken python3-os-resource-classes python3-os-service-types python3-os-traits python3-os-vif python3-os-win python3-os-xenapi python3-osc-lib python3-oslo.cache python3-oslo.concurrency python3-oslo.config python3-oslo.context python3-oslo.db python3-oslo.i18n python3-oslo.log python3-oslo.messaging python3-oslo.middleware python3-oslo.policy python3-oslo.privsep python3-oslo.reports python3-oslo.rootwrap python3-oslo.serialization python3-oslo.service python3-oslo.upgradecheck python3-oslo.utils python3-oslo.versionedobjects python3-oslo.vmware python3-osprofiler python3-ovsdbapp python3-packaging python3-paramiko python3-passlib python3-paste python3-pastedeploy python3-pastescript python3-pbr python3-pecan python3-pint python3-pip python3-ply python3-prettytable python3-problem-report python3-psutil python3-psycopg2 python3-pyasn1 python3-pyasn1-modules python3-pycadf python3-pycparser python3-pygments python3-pyinotify python3-pymemcache python3-pymongo python3-pymongo-ext python3-pymysql python3-pyparsing python3-pyperclip python3-pypowervm python3-pyroute2 python3-pyrsistent python3-pysaml2 python3-pyscss python3-rcssmin python3-redis python3-repoze.lru python3-requestsexceptions python3-retrying python3-rfc3986 python3-rjsmin python3-roman python3-routes python3-scrypt python3-semantic-version python3-setproctitle python3-simplegeneric python3-singledispatch python3-sortedcontainers python3-soupsieve python3-sqlalchemy python3-sqlalchemy-ext python3-sqlparse python3-statsd python3-stevedore python3-suds python3-swiftclient python3-tabulate python3-taskflow python3-tempita python3-tenacity python3-testresources python3-testscenarios python3-testtools python3-tinyrpc python3-tooz python3-traceback2 python3-unittest2 python3-uno python3-vine python3-voluptuous python3-waitress python3-warlock python3-wcwidth python3-webencodings python3-webob python3-websockify python3-webtest python3-werkzeug python3-wheel python3-wrapt python3-wsme python3-zake python3-zipp python3-zope.interface python3-zvmcloudconnector python3.8 python3.8-dev python3.8-minimal qemu-block-extra qemu-kvm qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils rabbitmq-server radvd rsync samba-libs seabios sg3-utils sharutils socat systemd systemd-container systemd-sysv systemd-timesyncd tar tcpdump tgt thin-provisioning-tools thunderbird thunderbird-gnome-support thunderbird-locale-en thunderbird-locale-en-us tzdata ubuntu-advantage-tools ubuntu-drivers-common udev uno-libs-private ure websockify xmlsec1 xz-utils zlib1g zlib1g-dev zvmcloudconnector-common
dpkg-scanpackages: info: Wrote 509 entries to output Packages file.
源
随后修改源/etc/apt/sources.list 使用文件目录作为源
deb [trusted=yes] file:///xxxx/packages/
之后更新缓存
apt-get update
使用
本地搭建
修改/etc/apt/sources.list ,之前的都删了,添加这个
deb file:///home/someone/local-sources packages/
我们搭建的本地源系统会默认为是不安全的,因此会禁止我们使用。如下报错
xxx
Err:2 file: /home/xxx/.../packages/ InRelease
File not found - xxx
Release (2: No such file or directory)
E: The respository 'file: /home/xxx/.../packages/ Release' does not have a Release file.
N: Updating from such a repository cant be done securely, and is therefore disabled by default.
因此我们需要添加一个参数,允许它使用不安全的源
apt-get update ---allow-insecure-repositories
之后进行安装还需要一个参数,不然还是因为不安全不让装
apt-get install -f
apt install xxxx --allow-unauthenticated
|