2026-02-02
8
之前都是在虚拟平台安装Centos,第一次使用U盘在实体机上安装,使用的镜像是CentOS-7-x86_64-Minimal-2009.iso进不了安装页面,卡在Starting dracut initqueue hook,网上搜索得知是由于安装程序无法确定安装文件的位置,解决方法是修改U盘的驱动器名称,Centos默认会寻找Label名为"CentOS 7 x86_64"驱动器加载安装程序,不知道是不是由于U盘是使用Windows烧录的原因,磁盘名称有长度限制变成了“CentOS 7 x8”,导致无法正确启动安装程序,包括直接复制iso文件中的内容到U盘根目录下时,不正确设置驱动器名称时也会出现此情况,解决方法如下:在选择U盘引导后的引导启动界面选择第一项"Install CentOS 7",按键盘E键修改,修改前:linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet修改后:linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x8 quiet改为U盘实际的名称,按CTRL+X,即可顺利完成安装。---------结束----------------------------------------下面说我踩过的坑,我参照网上的使用安装U盘实际挂载路径代替LABEL方式进行指定也不能正常安装,因为我最开是直接解压复制iso文件到U盘的,LABEL值为空,所以第一时间没有考虑修改Label,这里说一下使用实际挂载路径的修改方式1.先查看挂载的磁盘,在引导时按E修改linuxefi /images/pxeboot/vmlinuz linux dd nomodeset quietCTRL+X后可以查看到所有的磁盘挂载路径,我的是sda12.记录磁盘路径后(一般为sda/sdb/scd等字样,我的U盘是sda1),重启继续修改引导项将linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet修改为linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:/dev/sda1 quiet替换其中路径为实际的安装U盘路径,CTRL+X后可以正常加载安装程序了,因为我偷懒使用直接指定路径的方式,导致在最后一步开始安装时出现“设置基础软件仓库时出错”的错误,安装程序又无法找到软件包了,这时候我还没意识到是因为我通过linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:/dev/sda1 quiet指定导致的,一直在网上找在线的软件包网址,每次尝试又会花费近十分钟,也尝试过添加inst.repo参数,都以失败告终,最后决定通过修改实际LABEL方式,成功了,我以为LABEL跟直接写挂载路径一样,结果并不一样。最后修改linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x8 quiet,也就是磁盘名称为“CentOS 7 x8”的情况,完成安装。下面说一下Centos停止更新后软件源的设置,我先贴一下默认的仓库配置文件,位于/etc/yum.repos.d/CentOS-Base.repo# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Basemirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=osinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates[updates]name=CentOS-$releasever - Updatesmirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=updatesinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasmirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=extrasinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusmirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=centosplusinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7可以看到centos通过设置mirrorlist在更新源时获取多个镜像源,根据实际下载速度会进行切换,现在基本所有的镜像源都关掉了,就算有能用的估计过不了多久也会关闭,但是CentOS留了一个Vault存档源:vault.centos.org,可以设置软件包从这里面下载,虽然慢点,但一定会比其他非官方的活的更久。只需要注释掉配置文件中每个片段的mirrorlist行,添加baseurl为vault.centos.org的域名的路径即可,例如[base]中,添加baseurl=http://vault.centos.org/7.9.2009/os/$basearch/,其他类似,完整配置文件如下(注意我的写法是固定为7.9.2009版本,如果你的版本不一致,或者后续需要升级系统,可以尝试用他示例的$releasever变量方式)# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Base#mirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=osinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/baseurl=http://vault.centos.org/7.9.2009/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates [updates]name=CentOS-$releasever - Updates#mirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=updatesinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$releasever - Extras#mirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=extrasinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus#mirrorlist=http://mirrorlist.centos.org/?release=$releaseverarch=$basearchrepo=centosplusinfra=$infra#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7最后执行以下命令后,就可以正常安装软件了sudo yum clean allsudo yum makecache参考:https://blog.csdn.net/xiaoma19961101/article/details/130391436https://blog.csdn.net/weixin_70065088/article/details/144565986
继续阅读»
2025-07-13
408
现有两个网口接入不同的网络,网络A带宽大、延迟高,网段为192.168.4.1;网络B带宽小、延迟低,网段为192.168.8.1想要日常流量走网络A,指定ip或ip段走网络B,可以通过配置路由表实现。网络接入计算机时,系统会默认为该网段添加一条路由表规则 0.0.0.0 (所有ipv4地址)转发 至接入网络的网关地址。多网口设备连接多个网络也是如此。但是他们的越点不同,当匹配到多个规则时系统会选择越点较低的那条规则windows通过route print命令可以查看系统路由表C:\Users\Administratorroute print===========================================================================接口列表 15...c4 83 4f 16 59 c3 ......Intel(R) I210 Gigabit Network Connection 12...00 0c 29 32 93 1c ......Intel(R) PRO/1000 MT Network Connection 1...........................Software Loopback Interface 1 13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 11...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter 14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2===========================================================================IPv4 路由表===========================================================================活动路由:网络目标 网络掩码 网关 接口 跃点数 0.0.0.0 0.0.0.0 192.168.4.1 192.168.4.201 266 0.0.0.0 0.0.0.0 192.168.8.1 192.168.8.102 21其他规则....我这边的情况就是,系统添加了两条0.0.0.0 至对应两个网络的网关规则,流量通过两个网口获取的ip地址出口。我们需要做的是,删掉系统默认配置的0.0.0.0规则,添加0.0.0.0规则出口为网络A(192.168.4.1),指定ip地址出口为网络B(192.168.8.1)删除默认路由规则route delete 0.0.0.0添加0.0.0.0路由规则至网络Aroute add 0.0.0.0 mask 0.0.0.0 192.168.4.1添加指定的ip出口为网络Broute add 42.194.134.128 mask 255.255.255.255 192.168.8.1以上命令执行后可通过route print查看规则是否添加成功可以在命令末尾追加-p 使配置永久生效。metric 10 指定越点为10示例route add 0.0.0.0 mask 0.0.0.0 主网关IP metric 10 -p我这边只是临时使用,加上电脑不关机,因此没有添加越点和永久生效最后的路由表C:\Users\Administratorroute print===========================================================================接口列表 15...c4 83 4f 16 59 c3 ......Intel(R) I210 Gigabit Network Connection 12...00 0c 29 32 93 1c ......Intel(R) PRO/1000 MT Network Connection 1...........................Software Loopback Interface 1 13...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 11...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter 14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2===========================================================================IPv4 路由表===========================================================================活动路由:网络目标 网络掩码 网关 接口 跃点数 0.0.0.0 0.0.0.0 192.168.4.1 192.168.4.201 11 42.194.134.128 255.255.255.255 192.168.8.1 192.168.8.102 21其他规则....这样就实现访问42.194.134.128时走的低延迟的网络B,其他流量走网络A实现大带宽访问互联网
继续阅读»
2025-06-19
528
因为屏幕大小限制,经常需要将Iframe页面在新标签页打开,因此开发一个扩展程序快速在新标签页打开IframeChrome扩展程序需要一个manifest.json用于定义一些基础数据manifest.json:{ "name": "Iframe In New Tab", "description": "Open iframe Page In New Tab Quickly", "version": "1.0", "manifest_version": 3, "action": { "default_popup": "popup.html", "default_icon": "newtab_16.png" }, "permissions": [ "contextMenus" ], "background": { "service_worker": "background.js", "type": "module" }, "icons": { "16": "newtab_16.png", "48": "newtab_48.png", "128": "newtab_128.png" }}需要注意action、permissions、backgroundaction定义安装扩展程序后,浏览器右上方扩展程序按钮相关行为,default_popup为点击扩展程序图标后对应的页面,因为我们程序没有交互,因此给出简单提示popup.html:htmlstyle html, body { min-width: 205px; min-height: 33px; } hr { width: 100%; }/stylebody h1/h1 p bIframe In New Tab/b br Right-click the iframe area for options. /p/body/htmlpermissions为该扩展程序需要的权限,我们的扩展程序需要在浏览器创建右键菜单,因此声明contextMenus扩展程序可以在后台通过扩展程序的"service worker"监听浏览器事件,background用于指定你的相关监听代码,我们会在这里监听扩展程序安装事件,为页面创建右键菜单,以及该菜单的点击事件background.js:// 注册扩展程序安装事件,会在扩展程序被安装、扩展程序更新、浏览器更新时执行chrome.runtime.onInstalled.addListener(function () { chrome.contextMenus.create({ id: "iframe_menu", title: 'Open In New Tab', type: 'normal', contexts: ['frame'] });});// 监听菜单点击事件chrome.contextMenus.onClicked.addListener((info, tab) = { if (info.menuItemId === "iframe_menu") { // 获取iframe的URL const frameUrl = info.frameUrl; if (frameUrl) { chrome.tabs.create({ url: frameUrl, index: tab.index + 1 }); } }});将以上代码及相关图片资源放入一个文件夹中,打开Chrome扩展程序页面,启用开发者模式后,点击加载已解压的扩展程序,即可使用扩展程序使用效果展示:[图片]完整源码:Github参考资料:Hello World extension
继续阅读»
2025-05-09
868
最新版chrome136禁用了默认--user-data-dir的调试功能,--user-data-dir的默认路径为C:\Users\dell\AppData\Local\Google\Chrome\User Data\Default以前只需要指定--remote-debugging-port=9222即可调试,现在需要额外指定--user-data-dir"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\Chrome_data"vscode文档已经更新提示:if this flag isn't given, then the command will open a new window of any running browser and not enter debug mode更改了远程调试开关以提高安全性attaching-to-browsers
继续阅读»