linux软件管理
文章目录
- linux软件管理
-
- 桥接模式下配置虚拟机连接互联网
- nmcli相关命令
- windows和linux之间的FTP
- linux中的软件包类型
- rpm相关命令
- 搭建本地软件仓库
-
- 测试本地仓库
- 重新挂载仓库到http服务器上
- 设置仓库镜像开机自动挂载
- dnf相关命令
- 配置EPEL(Extra Packages for Enterprise Linux)源
- dnf仅下载
- 创建内网repo
-
桥接模式下配置虚拟机连接互联网
- 需要保证桥接的网卡可以正常上网
- ip和物理机的网卡处于同一网段
- 配置网关和DNS
- ping物理机、ping网关
nmcli相关命令
[root@alexw-device ~]# nmcli connection --help
Usage: nmcli connection { COMMAND | help }
COMMAND := { show | up | down | add | modify | clone | edit | delete | monitor | reload | load | import | export }
show [--active] [--order ]
show [--active] [id | uuid | path | apath] ...
up [[id | uuid | path] ] [ifname ] [ap ] [passwd-file ]
down [id | uuid | path | apath] ...
add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- ([+|-]. )+]
modify [--temporary] [id | uuid | path] ([+|-]. )+
clone [--temporary] [id | uuid | path ]
edit [id | uuid | path]
edit [type ] [con-name ]
delete [id | uuid | path]
monitor [id | uuid | path] ...
reload
load [ ... ]
import [--temporary] type file
export [id | uuid | path] [
windows和linux之间的FTP
- 在保证宿主机和虚拟机之间可以ping通的情况下,使用WinSCP连接
- 上传软件包
linux中的软件包类型
- DEB #UBlinux DEBlinux
- RPM #redhat centOS fadora
- bz2|gz|xz
-
-
################# portable,直接可用 ########################
[root@alexw-device Desktop]# tar -jxf firefox-107.0.tar.bz2
[root@alexw-device Desktop]# ll
total 144016
drwxr-xr-x. 7 root root 4096 Nov 16 19:52 firefox
-rw-r--r--. 1 root root 78919759 Nov 16 19:30 firefox-107.0.tar.bz2
-rw-r--r--. 1 root root 13312620 Nov 16 19:38 linuxqq_2.0.0-b2-1089_x86_64.rpm
[root@alexw-device Desktop]# cd firefox/
[root@alexw-device firefox]# ll
total 223184
-rw-r--r--. 1 root root 891 Nov 11 02:13 application.ini
drwxr-xr-x. 4 root root 85 Nov 16 19:51 browser
-rwxr-xr-x. 1 root root 233168 Nov 11 02:47 crashreporter
-rw-r--r--. 1 root root 3910 Nov 11 02:55 crashreporter.ini
drwxr-xr-x. 3 root root 18 Nov 16 19:51 defaults
-rw-r--r--. 1 root root 174 Nov 11 02:47 dependentlibs.list
-rwxr-xr-x. 1 root root 14416 Nov 11 02:47 firefox
-rwxr-xr-x. 1 root root 716208 Nov 11 02:47 firefox-bin
-rw-r--r--. 1 root root 1449 Nov 11 02:51 firefox-bin.sig
-rw-r--r--. 1 root root 1449 Nov 11 02:51 firefox.sig
drwxr-xr-x. 2 root root 32 Nov 16 19:51 fonts
drwxr-xr-x. 3 root root 17 Nov 16 19:52 gmp-clearkey
drwxr-xr-x. 2 root root 25 Nov 16 19:52 icons
-rwxr-xr-x. 1 root root 813432 Nov 11 02:47 libfreeblpriv3.so
-rwxr-xr-x. 1 root root 363584 Nov 11 02:47 libipcclientcerts.so
-rwxr-xr-x. 1 root root 43200 Nov 11 02:47 liblgpllibs.so
-rwxr-xr-x. 1 root root 3819384 Nov 11 02:47 libmozavcodec.so
-rwxr-xr-x. 1 root root 240456 Nov 11 02:47 libmozavutil.so
-rwxr-xr-x. 1 root root 14136 Nov 11 02:47 libmozgtk.so
-rwxr-xr-x. 1 root root 117376 Nov 11 02:47 libmozsandbox.so
-rwxr-xr-x. 1 root root 1154632 Nov 11 02:47 libmozsqlite3.so
-rwxr-xr-x. 1 root root 18224 Nov 11 02:47 libmozwayland.so
-rwxr-xr-x. 1 root root 223024 Nov 11 02:47 libnspr4.so
-rwxr-xr-x. 1 root root 707016 Nov 11 02:47 libnss3.so
-rwxr-xr-x. 1 root root 456232 Nov 11 02:47 libnssckbi.so
-rwxr-xr-x. 1 root root 191512 Nov 11 02:47 libnssutil3.so
-rwxr-xr-x. 1 root root 22656 Nov 11 02:47 libplc4.so
-rwxr-xr-x. 1 root root 14376 Nov 11 02:47 libplds4.so
-rwxr-xr-x. 1 root root 163456 Nov 11 02:47 libsmime3.so
-rwxr-xr-x. 1 root root 321992 Nov 11 02:47 libsoftokn3.so
-rwxr-xr-x. 1 root root 410248 Nov 11 02:47 libssl3.so
-rwxr-xr-x. 1 root root 152069272 Nov 11 02:47 libxul.so
-rw-r--r--. 1 root root 1449 Nov 11 02:51 libxul.so.sig
-rw-r--r--. 1 root root 22 Nov 11 02:55 locale.ini
-rwxr-xr-x. 1 root root 1567376 Nov 11 02:47 minidump-analyzer
-rw-r--r--. 1 root root 31798170 Nov 11 03:01 omni.ja
-rwxr-xr-x. 1 root root 769440 Nov 11 02:47 pingsender
-rw-r--r--. 1 root root 165 Nov 11 02:47 platform.ini
-rwxr-xr-x. 1 root root 707936 Nov 11 02:47 plugin-container
-rw-r--r--. 1 root root 1449 Nov 11 02:51 plugin-container.sig
-rw-r--r--. 1 root root 1980 Nov 11 02:56 precomplete
-rw-r--r--. 1 root root 0 Nov 11 02:47 removed-files
-rw-r--r--. 1 root root 825 Nov 11 01:48 Throbber-small.gif
-rwxr-xr-x. 1 root root 97536 Nov 11 02:47 updater
-rw-r--r--. 1 root root 623 Nov 11 02:55 updater.ini
-rw-r--r--. 1 root root 132 Nov 11 02:47 update-settings.ini
rpm相关命令
- -ivh ##安装参数组合 -i install -v verbose -h hash
- -a ##所有
- -f ##文件
- -p ##软件包
- -q ##查询
- -l ##软件安装文件列表
- -e ##卸载
- -c ##配置文件
- -d ##说明
- –info ##软件信息
- –force ##强制
- –nodeps ##忽略依赖性
- –script ##查询软件在安装或卸载过程中的运行脚本
- -Kv ##检测软件md5校验码
- -V ##检测已安装软件在系统中的文件被修改信息
######################## rpm ###############################
[root@alexw-device Desktop]# rpm -ivh linuxqq_2.0.0-b2-1089_x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:linuxqq-2.0.0-b2 ################################# [100%]
[root@alexw-device Desktop]# rpm -qf linuxqq_2.0.0-b2-1089_x86_64.rpm
file /root/Desktop/linuxqq_2.0.0-b2-1089_x86_64.rpm is not owned by any package
[root@alexw-device Desktop]# rpm -qp linuxqq_2.0.0-b2-1089_x86_64.rpm
linuxqq-2.0.0-b2.x86_64
[root@alexw-device Desktop]# rpm -ql linuxqq_2.0.0-b2-1089_x86_64.rpm
/usr/local/bin
/usr/local/bin/crashpad_handler
/usr/local/bin/qq
/usr/local/lib/tencent-qq
/usr/local/share/tencent-qq
/usr/local/share/tencent-qq/CHANGELOG.txt
/usr/local/share/tencent-qq/credits.html
/usr/local/share/tencent-qq/qq.png
/usr/local/share/tencent-qq/res.db
/usr/share/applications/qq.desktop
[root@alexw-device Desktop]# rpm -q linuxqq_2.0.0-b2-1089_x86_64.rpm
linuxqq-2.0.0-b2.x86_64
[root@alexw-device Desktop]# rpm -qc linuxqq_2.0.0-b2-1089_x86_64.rpm
[root@alexw-device Desktop]# rpm -qp linuxqq_2.0.0-b2-1089_x86_64.rpm --scripts
preinstall program: /bin/sh
postinstall scriptlet (using /bin/sh):
userhome=$(getent passwd $(logname) | cut -d: -f6)
if [[ $userhome != "" ]]; then
desktop=$(grep XDG_DESKTOP_DIR $userhome/.config/user-dirs.dirs | cut -d= -f2 | tr -d '"')
if [[ $desktop != "" ]]; then
cp -f /usr/share/applications/qq.desktop ${desktop/\$HOME/$userhome}
chown $(logname) ${desktop/\$HOME/$userhome}/qq.desktop
fi
fi
preuninstall program: /bin/sh
postuninstall scriptlet (using /bin/sh):
userhome=$(getent passwd $(logname) | cut -d: -f6)
if [[ $userhome != "" ]]; then
desktop=$(grep XDG_DESKTOP_DIR $userhome/.config/user-dirs.dirs | cut -d= -f2 | tr -d '"')
if [[ $desktop != "" ]]; then
rm -rf ${desktop/\$HOME/$userhome}/qq.desktop
fi
fi
[root@alexw-device Desktop]# echo helloworld >> linuxqq_2.0.0-b2-1089_x86_64.rpm
[root@alexw-device Desktop]# rpm -Kv linuxqq_2.0.0-b2-1089_x86_64.rpm
linuxqq_2.0.0-b2-1089_x86_64.rpm:
Header SHA1 digest: OK
Payload SHA256 digest: NOTFOUND
MD5 digest: BAD (Expected 0f1b878b71b988a16eb3017a041c583a != 5826cbc328c0c393b778055e97eac9ec)
[root@alexw-device Desktop]# rpm -V linuxqq_2.0.0-b2-1089_x86_64.rpm
[root@alexw-device Desktop]# echo hello123 >> /usr/local/share/tencent-qq/CHANGELOG.txt
[root@alexw-device Desktop]# rpm -V linuxqq_2.0.0-b2-1089_x86_64.rpm
S.5....T. /usr/local/share/tencent-qq/CHANGELOG.txt
搭建本地软件仓库
- 挂载镜像
################# 通过FTP上传镜像后 ########################
[root@alexw-device Desktop]# du -sh rhel-8.6-x86_64-dvd.iso
11G rhel-8.6-x86_64-dvd.iso
[root@alexw-device Desktop]# mkdir iso
[root@alexw-device Desktop]# mount rhel-8.6-x86_64-dvd.iso ./iso/
mount: /root/Desktop/iso: WARNING: device write-protected, mounted read-only.
[root@alexw-device Desktop]# ll iso
total 48
dr-xr-xr-x. 4 root root 2048 Apr 21 2022 AppStream
dr-xr-xr-x. 4 root root 2048 Apr 21 2022 BaseOS
dr-xr-xr-x. 3 root root 2048 Apr 21 2022 EFI
-r--r--r--. 1 root root 8154 Apr 21 2022 EULA
-r--r--r--. 1 root root 1455 Apr 21 2022 extra_files.json
-r--r--r--. 1 root root 18092 Apr 21 2022 GPL
dr-xr-xr-x. 3 root root 2048 Apr 21 2022 images
dr-xr-xr-x. 2 root root 2048 Apr 21 2022 isolinux
-r--r--r--. 1 root root 103 Apr 21 2022 media.repo
-r--r--r--. 1 root root 1669 Apr 21 2022 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 root root 5135 Apr 21 2022 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 root root 1796 Apr 21 2022 TRANS.TBL
- 写.repo文件
- /etc/yum.repos.d/ 新建my.repo
[AppStream]
name=AppStream
baseurl=file:///root/Desktop/iso/AppStream
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
[BaseOS]
name=BaseOS
baseurl=file:///root/Desktop/iso/BaseOS
gpgcheck=0
测试本地仓库
[root@alexw-device yum.repos.d]# dnf list httpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
AppStream 63 MB/s | 7.5 MB 00:00
BaseOS 585 MB/s | 2.4 MB 00:00
Last metadata expiration check: 0:00:01 ago on Wed 16 Nov 2022 08:44:49 PM CST.
Available Packages
httpd.x86_64 2.4.37-47.module+el8.6.0+14529+083145da.1 AppStream
[root@alexw-device yum.repos.d]# dnf install httpd -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:00:22 ago on Wed 16 Nov 2022 08:44:49 PM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
httpd x86_64 2.4.37-47.module+el8.6.0+14529+083145da.1 AppStream 1.4 M
Installing dependencies:
apr x86_64 1.6.3-12.el8 AppStream 130 k
apr-util x86_64 1.6.1-6.el8 AppStream 105 k
httpd-filesystem
noarch 2.4.37-47.module+el8.6.0+14529+083145da.1 AppStream 41 k
httpd-tools x86_64 2.4.37-47.module+el8.6.0+14529+083145da.1 AppStream 108 k
mod_http2 x86_64 1.15.7-5.module+el8.6.0+13996+01710940 AppStream 155 k
redhat-logos-httpd
noarch 84.5-1.el8 BaseOS 29 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 AppStream 25 k
apr-util-openssl
x86_64 1.6.1-6.el8 AppStream 27 k
Enabling module streams:
httpd 2.4
Transaction Summary
================================================================================
Install 9 Packages
Total size: 2.0 M
Installed size: 5.4 M
Downloading Packages:
warning: /root/Desktop/iso/AppStream/Packages/apr-1.6.3-12.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
AppStream 846 kB/s | 5.0 kB 00:00
Importing GPG key 0xFD431D51:
Userid : "Red Hat, Inc. (release key 2) "
Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Key imported successfully
Importing GPG key 0xD4082792:
Userid : "Red Hat, Inc. (auxiliary key) "
Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.6.3-12.el8.x86_64 1/9
Running scriptlet: apr-1.6.3-12.el8.x86_64 1/9
Installing : apr-util-bdb-1.6.1-6.el8.x86_64 2/9
Installing : apr-util-openssl-1.6.1-6.el8.x86_64 3/9
Installing : apr-util-1.6.1-6.el8.x86_64 4/9
Running scriptlet: apr-util-1.6.1-6.el8.x86_64 4/9
Installing : httpd-tools-2.4.37-47.module+el8.6.0+14529+083145da. 5/9
Installing : redhat-logos-httpd-84.5-1.el8.noarch 6/9
Running scriptlet: httpd-filesystem-2.4.37-47.module+el8.6.0+14529+0831 7/9
Installing : httpd-filesystem-2.4.37-47.module+el8.6.0+14529+0831 7/9
Installing : mod_http2-1.15.7-5.module+el8.6.0+13996+01710940.x86 8/9
Installing : httpd-2.4.37-47.module+el8.6.0+14529+083145da.1.x86_ 9/9
Running scriptlet: httpd-2.4.37-47.module+el8.6.0+14529+083145da.1.x86_ 9/9
Verifying : apr-1.6.3-12.el8.x86_64 1/9
Verifying : apr-util-1.6.1-6.el8.x86_64 2/9
Verifying : apr-util-bdb-1.6.1-6.el8.x86_64 3/9
Verifying : apr-util-openssl-1.6.1-6.el8.x86_64 4/9
Verifying : httpd-2.4.37-47.module+el8.6.0+14529+083145da.1.x86_ 5/9
Verifying : httpd-filesystem-2.4.37-47.module+el8.6.0+14529+0831 6/9
Verifying : httpd-tools-2.4.37-47.module+el8.6.0+14529+083145da. 7/9
Verifying : mod_http2-1.15.7-5.module+el8.6.0+13996+01710940.x86 8/9
Verifying : redhat-logos-httpd-84.5-1.el8.noarch 9/9
Installed products updated.
Installed:
apr-1.6.3-12.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
apr-util-bdb-1.6.1-6.el8.x86_64
apr-util-openssl-1.6.1-6.el8.x86_64
httpd-2.4.37-47.module+el8.6.0+14529+083145da.1.x86_64
httpd-filesystem-2.4.37-47.module+el8.6.0+14529+083145da.1.noarch
httpd-tools-2.4.37-47.module+el8.6.0+14529+083145da.1.x86_64
mod_http2-1.15.7-5.module+el8.6.0+13996+01710940.x86_64
redhat-logos-httpd-84.5-1.el8.noarch
Complete!
##################### 测试httpd安装 ###################
[root@alexw-device Desktop]# systemctl enable --now httpd # 开启httpd服务
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@alexw-device Desktop]# systemctl disable --now firewalld # 关闭防火墙
################## 浏览器访问http://【本机ip】,就可以看到httpd【Apache】的测试页面
重新挂载仓库到http服务器上
[root@alexw-device Desktop]# umount iso
[root@alexw-device Desktop]# ll iso
total 0
[root@alexw-device Desktop]# mkdir /var/www/html/iso
[root@alexw-device Desktop]# mount rhel-8.6-x86_64-dvd.iso /var/www/html/iso/
mount: /var/www/html/iso: WARNING: device write-protected, mounted read-only.
[root@alexw-device Desktop]# ll /var/www/html/iso
total 48
dr-xr-xr-x. 4 root root 2048 Apr 21 2022 AppStream
dr-xr-xr-x. 4 root root 2048 Apr 21 2022 BaseOS
dr-xr-xr-x. 3 root root 2048 Apr 21 2022 EFI
-r--r--r--. 1 root root 8154 Apr 21 2022 EULA
-r--r--r--. 1 root root 1455 Apr 21 2022 extra_files.json
-r--r--r--. 1 root root 18092 Apr 21 2022 GPL
dr-xr-xr-x. 3 root root 2048 Apr 21 2022 images
dr-xr-xr-x. 2 root root 2048 Apr 21 2022 isolinux
-r--r--r--. 1 root root 103 Apr 21 2022 media.repo
-r--r--r--. 1 root root 1669 Apr 21 2022 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 root root 5135 Apr 21 2022 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 root root 1796 Apr 21 2022 TRANS.TBL
############### 浏览器访问http://【本机ip】/iso,就可以在浏览器看到本地仓库了
################ 修改/etc.yum.repos.d/my.repo #####################
[AppStream]
name=AppStream
baseurl=http://192.168.1.150/iso/AppStream
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
[BaseOS]
name=BaseOS
baseurl=http://192.168.1.150/iso/BaseOS
gpgcheck=0
设置仓库镜像开机自动挂载
########### 修改文件/etc/rc.d/rc.local ################################
[root@alexw-device ~]# vim /etc/rc.d/rc.local
[root@alexw-device ~]# cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
mount /root/Desktop/rhel-8.6-x86_64-dvd.iso /var/www/html/iso
[root@alexw-device ~]# chmod +x /etc/rc.d/rc.local
dnf相关命令
- repolist ##列出仓库信息
- clean all ##清除系统中已经加载的仓库缓存信息 /var/cache/dnf
- list all ##列出所有软件
- list available ##列出未安装软件
- list installed ##列出已安装软件
- install ##安装
- remove ##卸载
- reinstall ##重新安装
- search ##搜索
- whatprovides ##搜索包含文件的软件包
- history ##dnf执行历史
- history info ##dnf执行历史详细信息
- group list ##列出软件组
- group list --installed ##列出已安装软件组
- group list --available ##列出未安装软件组
- group list --hidden ##列出隐藏软件案组
- group install ##安装软件组
- group info ##查看软件组信息
[root@alexw-device ~]# dnf repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id repo name
AppStream AppStream
BaseOS BaseOS
[root@alexw-device ~]# dnf clean all # 清除的是这个目录的缓存/var/cache/dnf/
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
35 files removed
[root@alexw-device ~]# ll /var/cache/dnf/
total 820
drwxr-xr-x. 4 root root 38 Jun 22 2021 AppStream-b0777c5f74c3405e
drwxr-xr-x. 3 root root 22 Nov 16 20:44 AppStream-b397ed1b06ec5f59
drwxr-xr-x. 3 root root 22 Nov 16 21:01 AppStream-f0c6c5eb36e6d341
drwxr-xr-x. 3 root root 22 Nov 16 21:01 BaseOS-1cb1d80eb2d1412b
drwxr-xr-x. 4 root root 38 Jun 22 2021 BaseOS-5c5271346fadac6f
drwxr-xr-x. 3 root root 22 Nov 16 20:44 BaseOS-5e9868fdbbb0b02d
-rw-r--r--. 1 root root 2 Nov 16 21:26 expired_repos.json
drwxr-xr-x. 4 root root 38 Jun 22 2021 kolourpaint-a4a8f194f7fcf618
-rw-r--r--. 1 root root 0 Nov 16 21:01 last_makecache
-rw-r--r--. 1 root root 831488 Nov 16 21:01 packages.db
-rw-r--r--. 1 root root 2 Nov 16 20:45 tempfiles.json
[root@alexw-device ~]# dnf list all
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
AppStream 531 MB/s | 7.5 MB 00:00
BaseOS 494 MB/s | 2.4 MB 00:00
Installed Packages
GConf2.x86_64 3.2.6-22.el8 @AppStream
ModemManager.x86_64 1.10.8-2.el8 @anaconda
ModemManager-glib.x86_64 1.10.8-2.el8 @anaconda
NetworkManager.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-adsl.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-bluetooth.x86_64
1:1.22.8-4.el8 @anaconda
NetworkManager-config-server.noarch
1:1.22.8-4.el8 @anaconda
NetworkManager-libnm.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-team.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-tui.x86_64 1:1.22.8-4.el8 @anaconda
NetworkManager-wifi.x86_64 1:1.22.8-4.el8 @anaconda
.......................................
[root@alexw-device ~]# ll /var/cache/dnf/
total 11836
drwxr-xr-x. 4 root root 38 Jun 22 2021 AppStream-b0777c5f74c3405e
drwxr-xr-x. 3 root root 22 Nov 16 20:44 AppStream-b397ed1b06ec5f59
drwxr-xr-x. 3 root root 22 Nov 16 21:27 AppStream-f0c6c5eb36e6d341
-rw-r--r--. 1 root root 5901336 Nov 16 21:27 AppStream-filenames.solvx
-rw-r--r--. 1 root root 2493227 Nov 16 21:27 AppStream.solv
drwxr-xr-x. 3 root root 22 Nov 16 21:27 BaseOS-1cb1d80eb2d1412b
drwxr-xr-x. 4 root root 38 Jun 22 2021 BaseOS-5c5271346fadac6f
drwxr-xr-x. 3 root root 22 Nov 16 20:44 BaseOS-5e9868fdbbb0b02d
-rw-r--r--. 1 root root 1337487 Nov 16 21:27 BaseOS-filenames.solvx
-rw-r--r--. 1 root root 1542198 Nov 16 21:27 BaseOS.solv
-rw-r--r--. 1 root root 2 Nov 16 21:27 expired_repos.json
drwxr-xr-x. 4 root root 38 Jun 22 2021 kolourpaint-a4a8f194f7fcf618
-rw-r--r--. 1 root root 0 Nov 16 21:01 last_makecache
-rw-r--r--. 1 root root 831488 Nov 16 21:27 packages.db
-rw-r--r--. 1 root root 2 Nov 16 20:45 tempfiles.json
[root@alexw-device ~]# dnf list avaliable make
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:02:27 ago on Wed 16 Nov 2022 09:27:27 PM CST.
Available Packages
make.x86_64 1:4.2.1-11.el8 BaseOS
####################### 软件组 #######################################
[root@alexw-device ~]# dnf group list
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:07:00 ago on Wed 16 Nov 2022 09:27:27 PM CST.
Available Environment Groups:
Server
Minimal Install
Workstation
Virtualization Host
Custom Operating System
Installed Environment Groups:
Server with GUI
Installed Groups:
Container Management
Headless Management
Available Groups:
.NET Core Development
RPM Development Tools
Development Tools
Graphical Administration Tools
Legacy UNIX Compatibility
Network Servers
Scientific Support
Security Tools
Smart Card Support
System Tools
[root@alexw-device ~]# dnf group list --hidden
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:07:28 ago on Wed 16 Nov 2022 09:27:27 PM CST.
Available Environment Groups:
Server
Minimal Install
Workstation
Virtualization Host
Custom Operating System
Installed Environment Groups:
Server with GUI
Installed Groups:
base-x
Container Management
Guest Desktop Agents
Internet Browser
Multimedia
VMware platform specific packages
Printing Client
Virtualization Client
Virtualization Hypervisor
Virtualization Tools
Core
Fonts
GNOME
Hardware Monitoring Utilities
Hardware Support
Headless Management
Common NetworkManager submodules
Server product core
Standard
Available Groups:
Backup Client
Conflicts AppStream
Debugging Tools
Desktop Debugging and Performance Tools
DNS Name Server
.NET Core Development
FTP Server
GNOME Applications
Graphics Creation Tools
Guest Agents
Input Methods
Internet Applications
Java Platform
Legacy X Window System Compatibility
Office Suite and Productivity
Atomic Host ostree support
KVM platform specific packages
Hyper-v platform specific packages
Remote Desktop Clients
RPM Development Tools
TeX formatting system
Virtualization Platform
Basic Web Server
Additional Development
Anaconda tools
Base
Conflicts BaseOS
Development Tools
Dial-up Networking Support
File and Storage Server
Graphical Administration Tools
Infiniband Support
Large Systems Performance
Legacy UNIX Compatibility
Mail Server
Mainframe Access
Network File System Client
Network Servers
Networking Tools
Performance Tools
Platform Development
Python Web
Remote Management for Linux
Scientific Support
Security Tools
Smart Card Support
Windows File Server
System Tools
Workstation product core
################# 安装java #################################
[root@alexw-device ~]# dnf group info "Java Platform"
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:08:27 ago on Wed 16 Nov 2022 09:27:27 PM CST.
Group: Java Platform
Description: Java support for the Red Hat Enterprise Linux Server and Desktop Platforms.
Mandatory Packages:
java-1.8.0-openjdk
Default Packages:
icedtea-web
[root@alexw-device ~]# dnf group install "Java Platform"
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:08:42 ago on Wed 16 Nov 2022 09:27:27 PM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing group/module packages:
icedtea-web x86_64 1.8.4-4.el8 AppStream 1.7 M
java-1.8.0-openjdk x86_64 1:1.8.0.322.b06-11.el8 AppStream 346 k
Installing dependencies:
copy-jdk-configs noarch 4.0-2.el8 AppStream 31 k
java-1.8.0-openjdk-headless
x86_64 1:1.8.0.322.b06-11.el8 AppStream 34 M
javapackages-filesystem
noarch 5.3.0-1.module+el8+2447+6f56d9a6 AppStream 30 k
javapackages-tools noarch 5.3.0-1.module+el8+2447+6f56d9a6 AppStream 44 k
lksctp-tools x86_64 1.0.18-3.el8 BaseOS 100 k
tagsoup noarch 1.2.1-15.el8 AppStream 118 k
ttmkfdir x86_64 3.0.9-54.el8 AppStream 62 k
tzdata-java noarch 2022a-1.el8 AppStream 191 k
xorg-x11-fonts-Type1 noarch 7.5-19.el8 AppStream 522 k
Enabling module streams:
javapackages-runtime 201801
Installing Groups:
Java Platform
Transaction Summary
================================================================================
Install 11 Packages
Total download size: 37 M
Installed size: 122 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): copy-jdk-configs-4.0-2.el8.noarch.rpm 1.6 MB/s | 31 kB 00:00
(2/11): java-1.8.0-openjdk-1.8.0.322.b06-11.el8 4.0 MB/s | 346 kB 00:00
(3/11): icedtea-web-1.8.4-4.el8.x86_64.rpm 19 MB/s | 1.7 MB 00:00
(4/11): javapackages-filesystem-5.3.0-1.module+ 267 kB/s | 30 kB 00:00
(5/11): javapackages-tools-5.3.0-1.module+el8+2 394 kB/s | 44 kB 00:00
(6/11): tagsoup-1.2.1-15.el8.noarch.rpm 843 kB/s | 118 kB 00:00
(7/11): ttmkfdir-3.0.9-54.el8.x86_64.rpm 405 kB/s | 62 kB 00:00
(8/11): tzdata-java-2022a-1.el8.noarch.rpm 1.7 MB/s | 191 kB 00:00
(9/11): lksctp-tools-1.0.18-3.el8.x86_64.rpm 881 kB/s | 100 kB 00:00
(10/11): java-1.8.0-openjdk-headless-1.8.0.322. 59 MB/s | 34 MB 00:00
(11/11): xorg-x11-fonts-Type1-7.5-19.el8.noarch 2.1 MB/s | 522 kB 00:00
--------------------------------------------------------------------------------
Total 62 MB/s | 37 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: copy-jdk-configs-4.0-2.el8.noarch 1/1
Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.322.b06-11.el8.x 1/1
Preparing : 1/1
Installing : javapackages-filesystem-5.3.0-1.module+el8+2447+6f 1/11
Installing : lksctp-tools-1.0.18-3.el8.x86_64 2/11
Running scriptlet: lksctp-tools-1.0.18-3.el8.x86_64 2/11
Installing : tzdata-java-2022a-1.el8.noarch 3/11
Installing : ttmkfdir-3.0.9-54.el8.x86_64 4/11
Installing : xorg-x11-fonts-Type1-7.5-19.el8.noarch 5/11
Running scriptlet: xorg-x11-fonts-Type1-7.5-19.el8.noarch 5/11
Installing : copy-jdk-configs-4.0-2.el8.noarch 6/11
Installing : java-1.8.0-openjdk-headless-1:1.8.0.322.b06-11.el8 7/11
Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.322.b06-11.el8 7/11
Installing : java-1.8.0-openjdk-1:1.8.0.322.b06-11.el8.x86_64 8/11
Running scriptlet: java-1.8.0-openjdk-1:1.8.0.322.b06-11.el8.x86_64 8/11
Installing : javapackages-tools-5.3.0-1.module+el8+2447+6f56d9a 9/11
Installing : tagsoup-1.2.1-15.el8.noarch 10/11
Installing : icedtea-web-1.8.4-4.el8.x86_64 11/11
Running scriptlet: icedtea-web-1.8.4-4.el8.x86_64 11/11
Running scriptlet: copy-jdk-configs-4.0-2.el8.noarch 11/11
Running scriptlet: java-1.8.0-openjdk-headless-1:1.8.0.322.b06-11.el8 11/11
Running scriptlet: java-1.8.0-openjdk-1:1.8.0.322.b06-11.el8.x86_64 11/11
Running scriptlet: icedtea-web-1.8.4-4.el8.x86_64 11/11
Verifying : copy-jdk-configs-4.0-2.el8.noarch 1/11
Verifying : icedtea-web-1.8.4-4.el8.x86_64 2/11
Verifying : java-1.8.0-openjdk-1:1.8.0.322.b06-11.el8.x86_64 3/11
Verifying : java-1.8.0-openjdk-headless-1:1.8.0.322.b06-11.el8 4/11
Verifying : javapackages-filesystem-5.3.0-1.module+el8+2447+6f 5/11
Verifying : javapackages-tools-5.3.0-1.module+el8+2447+6f56d9a 6/11
Verifying : tagsoup-1.2.1-15.el8.noarch 7/11
Verifying : ttmkfdir-3.0.9-54.el8.x86_64 8/11
Verifying : tzdata-java-2022a-1.el8.noarch 9/11
Verifying : xorg-x11-fonts-Type1-7.5-19.el8.noarch 10/11
Verifying : lksctp-tools-1.0.18-3.el8.x86_64 11/11
Installed products updated.
Installed:
copy-jdk-configs-4.0-2.el8.noarch
icedtea-web-1.8.4-4.el8.x86_64
java-1.8.0-openjdk-1:1.8.0.322.b06-11.el8.x86_64
java-1.8.0-openjdk-headless-1:1.8.0.322.b06-11.el8.x86_64
javapackages-filesystem-5.3.0-1.module+el8+2447+6f56d9a6.noarch
javapackages-tools-5.3.0-1.module+el8+2447+6f56d9a6.noarch
lksctp-tools-1.0.18-3.el8.x86_64
tagsoup-1.2.1-15.el8.noarch
ttmkfdir-3.0.9-54.el8.x86_64
tzdata-java-2022a-1.el8.noarch
xorg-x11-fonts-Type1-7.5-19.el8.noarch
Complete!
配置EPEL(Extra Packages for Enterprise Linux)源
- 阿里云镜像站:https://mirrors.aliyun.com/epel-archive
- 本机上用的:https://mirrors.aliyun.com/epel-archive/8.2.2020-11-04/Everything/x86_64
[root@alexw-device ~]# hostnamectl # 确定系统版本
Static hostname: alexw-device
Pretty hostname: alexw_device
Icon name: computer-vm
Chassis: vm
Virtualization: vmware
Operating System: Red Hat Enterprise Linux 8.2 (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8.2:GA
Kernel: Linux 4.18.0-193.el8.x86_64
Architecture: x86-64
############### 修改my.repo ###################
[AppStream]
name=AppStream
baseurl=http://192.168.1.150/iso/AppStream
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
[BaseOS]
name=BaseOS
baseurl=http://192.168.1.150/iso/BaseOS
gpgcheck=0
[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel-archive/8.2.2020-11-04/Everything/x86_64
gpgcheck=0
- 如果要用最新版本仓库(系统版本8.6的)
配置如图:
dnf仅下载
[root@alexw-device ~]# mkdir /var/www/html/soft
[root@alexw-device ~]# ll /var/www/html/soft
total 0
[root@alexw-device ~]# dnf search chrome
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:19:52 ago on Wed 16 Nov 2022 09:48:34 PM CST.
======================== Name & Summary Matched: chrome ========================
chromedriver.x86_64 : WebDriver for Google Chrome/Chromium
chrome-remote-desktop.x86_64 : Remote desktop support for google-chrome &
: chromium
============================= Name Matched: chrome =============================
chrome-gnome-shell.x86_64 : Support for managing GNOME Shell Extensions through
: web browsers
mathjax-winchrome-fonts.noarch : Fonts used by MathJax to display math in the
: browser
=========================== Summary Matched: chrome ============================
webextension-token-signing.x86_64 : Chrome and Firefox extension for signing
: with your eID on the web
[root@alexw-device ~]# dnf install chromedriver.x86_64 --downloadonly --destdir /var/www/html/soft
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:20:24 ago on Wed 16 Nov 2022 09:48:34 PM CST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
chromedriver x86_64 85.0.4183.121-1.el8 epel 9.3 M
Installing dependencies:
chromium-common x86_64 85.0.4183.121-1.el8 epel 16 M
libbsd x86_64 0.9.1-4.el8 epel 106 k
minizip x86_64 2.8.9-2.el8 epel 124 k
minizip1.2 x86_64 1.2.11-24.el8 epel 32 k
Transaction Summary
================================================================================
Install 5 Packages
Total download size: 25 M
Installed size: 106 M
DNF will only download packages for the transaction.
Is this ok [y/N]: y
Downloading Packages:
(1/5): libbsd-0.9.1-4.el8.x86_64.rpm 184 kB/s | 106 kB 00:00
(2/5): minizip-2.8.9-2.el8.x86_64.rpm 237 kB/s | 124 kB 00:00
(3/5): minizip1.2-1.2.11-24.el8.x86_64.rpm 77 kB/s | 32 kB 00:00
(4/5): chromedriver-85.0.4183.121-1.el8.x86_64. 2.1 MB/s | 9.3 MB 00:04
(5/5): chromium-common-85.0.4183.121-1.el8.x86_ 3.1 MB/s | 16 MB 00:05
--------------------------------------------------------------------------------
Total 5.0 MB/s | 25 MB 00:05
Complete!
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
创建内网repo
[root@alexw-device ~]# dnf install createrepo -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:02:14 ago on Wed 16 Nov 2022 10:21:34 PM CST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
createrepo_c x86_64 0.17.7-5.el8 AppStream 89 k
Installing dependencies:
createrepo_c-libs x86_64 0.17.7-5.el8 AppStream 116 k
drpm x86_64 0.4.1-3.el8 AppStream 68 k
libmodulemd x86_64 2.13.0-1.el8 BaseOS 233 k
Transaction Summary
================================================================================
Install 4 Packages
Total download size: 507 k
Installed size: 1.3 M
Downloading Packages:
(1/4): createrepo_c-0.17.7-5.el8.x86_64.rpm 2.6 MB/s | 89 kB 00:00
(2/4): drpm-0.4.1-3.el8.x86_64.rpm 1.4 MB/s | 68 kB 00:00
(3/4): createrepo_c-libs-0.17.7-5.el8.x86_64.rp 2.3 MB/s | 116 kB 00:00
(4/4): libmodulemd-2.13.0-1.el8.x86_64.rpm 13 MB/s | 233 kB 00:00
--------------------------------------------------------------------------------
Total 9.6 MB/s | 507 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libmodulemd-2.13.0-1.el8.x86_64 1/4
Installing : drpm-0.4.1-3.el8.x86_64 2/4
Installing : createrepo_c-libs-0.17.7-5.el8.x86_64 3/4
Installing : createrepo_c-0.17.7-5.el8.x86_64 4/4
Running scriptlet: createrepo_c-0.17.7-5.el8.x86_64 4/4
Verifying : createrepo_c-0.17.7-5.el8.x86_64 1/4
Verifying : createrepo_c-libs-0.17.7-5.el8.x86_64 2/4
Verifying : drpm-0.4.1-3.el8.x86_64 3/4
Verifying : libmodulemd-2.13.0-1.el8.x86_64 4/4
Installed products updated.
Installed:
createrepo_c-0.17.7-5.el8.x86_64 createrepo_c-libs-0.17.7-5.el8.x86_64
drpm-0.4.1-3.el8.x86_64 libmodulemd-2.13.0-1.el8.x86_64
Complete!
[root@alexw-device ~]# createrepo -v /var/www/html/soft # 这一步会默认清空当前已存在的文件夹
22:24:12: Version: 0.17.7 (Features: DeltaRPM LegacyWeakdeps )
22:24:12: Signal handler setup
22:24:12: Thread pool ready
Directory walk started
22:24:12: Dir to scan: /var/www/html/soft/.repodata
22:24:12: Package count: 0
Directory walk done - 0 packages
Temporary output repo path: /var/www/html/soft/.repodata/
22:24:12: Creating .xml.gz files
22:24:12: Setting number of packages
Preparing sqlite DBs
22:24:12: Creating databases
22:24:12: Thread pool user data ready
Pool started (with 5 workers)
Pool finished
22:24:12: Generating repomd.xml
22:24:12: Old repodata doesn't exists: Cannot rename /var/www/html/soft/repodata/ -> /var/www/html/soft/repodata.old.54273.20221116222412.896430: No such file or directory
22:24:12: Renamed /var/www/html/soft/.repodata/ -> /var/www/html/soft/repodata/
22:24:12: Memory cleanup
22:24:12: All done
[root@alexw-device ~]# ll /var/www/html/soft
total 4
drwxr-xr-x. 2 root root 4096 Nov 16 22:24 repodata
[root@alexw-device ~]# dnf install chromedriver.x86_64 --downloadonly --destdir /var/www/html/soft
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:03:32 ago on Wed 16 Nov 2022 10:21:34 PM CST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
chromedriver x86_64 85.0.4183.121-1.el8 epel 9.3 M
Installing dependencies:
chromium-common x86_64 85.0.4183.121-1.el8 epel 16 M
libbsd x86_64 0.9.1-4.el8 epel 106 k
minizip x86_64 2.8.9-2.el8 epel 124 k
minizip1.2 x86_64 1.2.11-24.el8 epel 32 k
Transaction Summary
================================================================================
Install 5 Packages
Total download size: 25 M
Installed size: 106 M
DNF will only download packages for the transaction.
Is this ok [y/N]: y
Downloading Packages:
(1/5): libbsd-0.9.1-4.el8.x86_64.rpm 1.2 MB/s | 106 kB 00:00
(2/5): minizip-2.8.9-2.el8.x86_64.rpm 802 kB/s | 124 kB 00:00
(3/5): minizip1.2-1.2.11-24.el8.x86_64.rpm 418 kB/s | 32 kB 00:00
(4/5): chromedriver-85.0.4183.121-1.el8.x86_64. 2.6 MB/s | 9.3 MB 00:03
(5/5): chromium-common-85.0.4183.121-1.el8.x86_ 3.6 MB/s | 16 MB 00:04
--------------------------------------------------------------------------------
Total 5.8 MB/s | 25 MB 00:04
Complete!
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
测试
[root@alexw-device ~]# vim /etc/yum.repos.d/my.repo
[root@alexw-device ~]# cat /etc/yum.repos.d/my.repo
[AppStream]
enabled=0 # 关闭这个源
name=AppStream
baseurl=http://192.168.1.150/iso/AppStream
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[BaseOS]
enabled=0 # 关闭这个源
name=BaseOS
baseurl=http://192.168.1.150/iso/BaseOS
gpgcheck=0
[epel]
enabled=0 # 关闭这个源
name=epel
baseurl=https://mirrors.aliyun.com/epel-archive/8.2.2020-11-04/Everything/x86_64
gpgcheck=0
[chrome_driver]
enabled=1
name=chrome_driver
baseurl=http://192.168.1.150/soft
gpgcheck=0
[root@alexw-device ~]# dnf clean all
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
27 files removed
[root@alexw-device ~]# dnf search chrome
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
chrome_driver 251 kB/s | 257 B 00:00
============================= Name Matched: chrome =============================
chrome-gnome-shell.x86_64 : Support for managing GNOME Shell Extensions through
: web browsers