<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Debian &#8211; wqh博客</title>
	<atom:link href="https://wangqianhong.com/tag/debian/feed/" rel="self" type="application/rss+xml" />
	<link>https://wangqianhong.com</link>
	<description>和而不同</description>
	<lastBuildDate>Mon, 04 Aug 2025 10:11:18 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wangqianhong.com/wp-content/uploads/2020/09/cropped-1-1-1-32x32.png</url>
	<title>Debian &#8211; wqh博客</title>
	<link>https://wangqianhong.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Selenium（一） &#124; Debian环境搭建</title>
		<link>https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/</link>
					<comments>https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sat, 04 May 2024 00:36:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Selenium]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3874</guid>

					<description><![CDATA[<p>Python + Selenium 完全可以在 Debian 上运行。大致流程分两步： 安装 Goo&#8230; <a href="https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Selenium（一） &#124; Debian环境搭建</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/">Selenium（一） | Debian环境搭建</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>Python + Selenium 完全可以在 Debian 上运行。大致流程分两步：</p>



<ol><li>安装 Google Chrome 浏览器</li><li>安装 Python、Selenium 及对应的 ChromeDriver</li></ol>



<p>下面以 Debian 11 (“Bullseye”) 为例，演示具体命令。</p>



<h3>在 Debian 上安装 Google Chrome</h3>



<p>Google 官方并不把 Chrome 放到 Debian 默认源，需要先添加 Google 的 apt 仓库。</p>



<pre class="wp-block-preformatted"># 1. 更新本地包列表
<code>sudo apt update</code>

# 2. 安装必要工具
<code>sudo apt install -y wget gnupg2 apt-transport-https ca-certificates</code>

# 3. 导入 Google 的公钥
<code>wget -q -O - https://dl.google.com/linux/linux_signing_key.pub \
| sudo gpg --dearmor -o /usr/share/keyrings/google-linux-signing-keyring.gpg</code>

# 4. 添加 Google Chrome 的 apt 源
<code>echo "deb [signed-by=/usr/share/keyrings/google-linux-signing-keyring.gpg] \
http://dl.google.com/linux/chrome/deb/ stable main" \
| sudo tee /etc/apt/sources.list.d/google-chrome.list</code>

# 5. 再次更新并安装 Chrome
<code>sudo apt update
sudo apt install -y google-chrome-stable</code></pre>



<p>安装完成后，你可以用 <code>google-chrome --version</code> 验证版本。</p>



<h3>安装 Python、Selenium 及 ChromeDriver</h3>



<h4>安装 Python 和 pip</h4>



<p>Debian 11 默认带有 Python3，但可以确保安装最新：</p>



<pre class="wp-block-code"><code>sudo apt install -y python3 python3-venv python3-pip</code></pre>



<h4>安装 Selenium</h4>



<pre class="wp-block-preformatted"># 建议在 virtualenv 中安装
<code>python3 -m venv ~/selenium-env
source ~/selenium-env/bin/activate</code>

# 安装 Selenium 库
<code>pip install --upgrade pip
pip install selenium</code></pre>



<p>如果安装比较慢，可以使用国内镜像源：</p>



<pre class="wp-block-code"><code>pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple</code></pre>



<p>安装 ChromeDriver</p>



<p>ChromeDriver 必须与 Chrome 浏览器版本匹配。可手动下载，也可用 <code>webdriver-manager</code> 自动管理。</p>



<h5>方案 A：手动下载</h5>



<ol><li>查询 Chrome 版本： <code>google-chrome --version </code># 比如输出：Google Chrome <code>115.0.5790.98</code></li><li>到 <a href="https://chromedriver.storage.googleapis.com/index.html">https://chromedriver.storage.googleapis.com/index.html</a> 找到对应的 “115.0.5790.98” 版本，下载 Linux x64 zip。</li><li>解压并移动到 <code>/usr/local/bin</code>： <code>wget -O chromedriver_linux64.zip \ https://chromedriver.storage.googleapis.com/115.0.5790.98/chromedriver_linux64.zip unzip chromedriver_linux64.zip sudo mv chromedriver /usr/local/bin/ sudo chmod +x /usr/local/bin/chromedriver</code></li></ol>



<h5>方案 B：自动管理（推荐开发环境）</h5>



<pre class="wp-block-code"><code>pip install webdriver-manager</code></pre>



<p>在脚本中使用时，示例代码：</p>



<pre class="wp-block-code"><code>from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service

# 自动下载并启动
service = Service(ChromeDriverManager().install())
options = webdriver.ChromeOptions()
# 如果在无头服务器上运行，加上下面两行：
# options.add_argument('--headless')
# options.add_argument('--no-sandbox')

driver = webdriver.Chrome(service=service, options=options)
driver.get("https://www.example.com")
print(driver.title)
driver.quit()</code></pre>



<p>完成以上步骤后，就可以在 Debian 上用 Python + Selenium + ChromeDriver 驱动真实的 Chrome 浏览器来做自动化测试或爬虫／RPA 了。</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/">Selenium（一） | Debian环境搭建</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/05/selenium-debian%e7%8e%af%e5%a2%83%e6%90%ad%e5%bb%ba/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian系统配置</title>
		<link>https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/</link>
					<comments>https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Tue, 16 Apr 2024 06:20:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Debian]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3865</guid>

					<description><![CDATA[<p>Vim配置 修改 ~/.vimrc Debian软件源更新 使用清华的软件源 /etc/apt/so&#8230; <a href="https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Debian系统配置</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/">Debian系统配置</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<h3>Vim配置</h3>



<p>修改 <code>~/.vimrc</code></p>



<pre class="wp-block-code"><code>" 基础设置
set nocompatible        " 关闭兼容模式
set encoding=utf-8
set fileencodings=utf-8,gbk,latin1

" 界面美化
syntax on               " 启用语法高亮
set number              " 显示行号
set relativenumber      " 显示相对行号
set cursorline          " 高亮当前行
set showcmd             " 显示命令
set ruler               " 显示光标位置
set laststatus=2        " 总是显示状态栏
set wildmenu            " 命令行补全增强
set lazyredraw          " 执行宏时不重绘

" 编辑行为
set tabstop=4           " 一个 tab 显示 4 个空格
set shiftwidth=4        " 自动缩进使用 4 个空格
set expandtab           " 用空格代替 tab
set autoindent          " 自动缩进
set smartindent         " 智能缩进
set backspace=2         " 支持用退格删除缩进

" 搜索
set hlsearch            " 高亮搜索
set incsearch           " 增量搜索
set ignorecase          " 忽略大小写
set smartcase           " 智能大小写

" 鼠标支持
set mouse=n             " 在 Normal 模式下启用鼠标支持

" 系统剪贴板（需要 vim-gtk3 支持）
set clipboard=unnamedplus

" 中文支持优化
set helplang=cn
set langmenu=zh_CN.UTF-8
language messages zh_CN.UTF-8</code></pre>



<h3>Debian软件源更新</h3>



<p>使用清华的软件源 /etc/apt/source.list</p>



<pre class="wp-block-code"><code>deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware</code></pre>



<p></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/">Debian系统配置</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2024/04/debian%e7%b3%bb%e7%bb%9f%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian中的vi开启鼠标右键功能</title>
		<link>https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/</link>
					<comments>https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/#respond</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Fri, 14 Oct 2022 12:53:00 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Debian]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=3863</guid>

					<description><![CDATA[<p>debian系统中用鼠标右键粘贴时，会导致后面内容出错，可以修改vi的配置/usr/share/vi&#8230; <a href="https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Debian中的vi开启鼠标右键功能</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/">Debian中的vi开启鼠标右键功能</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p>debian系统中用鼠标右键粘贴时，会导致后面内容出错，可以修改vi的配置<code>/usr/share/vim/vim90/defaults.vim</code></p>



<pre class="wp-block-preformatted">把<code>set mouse=a</code>修改为<code>set mouse-=a</code></pre>



<p>报错修改就可以正常使用鼠标右键功能</p>
<p><a rel="nofollow" href="https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/">Debian中的vi开启鼠标右键功能</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2022/10/debian%e4%b8%ad%e7%9a%84vi%e5%bc%80%e5%90%af%e9%bc%a0%e6%a0%87%e5%8f%b3%e9%94%ae%e5%8a%9f%e8%83%bd/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Linux安装Docker</title>
		<link>https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/</link>
					<comments>https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/#comments</comments>
		
		<dc:creator><![CDATA[wqh_work]]></dc:creator>
		<pubDate>Sun, 13 Sep 2020 23:22:37 +0000</pubDate>
				<category><![CDATA[技术文章]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Docker]]></category>
		<guid isPermaLink="false">https://wangqianhong.com/?p=193</guid>

					<description><![CDATA[<p>前面我们介绍了Win10下面如何安装Docker，这篇主要介绍Linux下面的安装。 卸载旧版本 安&#8230; <a href="https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/" class="more-link read-more" rel="bookmark">继续阅读 <span class="screen-reader-text">Linux安装Docker</span><i class="fa fa-arrow-right"></i></a></p>
<p><a rel="nofollow" href="https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/">Linux安装Docker</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></description>
										<content:encoded><![CDATA[
<p id="block-6bfe58da-01be-4702-a818-c906c065666c">前面我们介绍了Win10下面如何安装Docker，这篇主要介绍Linux下面的安装。</p>



<h3 id="block-8631bb93-4a34-437a-9444-48d2405c323c">卸载旧版本</h3>



<pre id="block-d9d14043-ada6-4f22-856a-5b5a00bdbc23" class="wp-block-code"><code>yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine</code></pre>



<h3 id="block-5e4acf53-79df-468e-bce1-f0cc10940ebd">安装依赖包</h3>



<pre id="block-3dfb0382-93cd-43ea-b107-9ce9baee28d3" class="wp-block-code"><code>yum install -y yum-utils</code></pre>



<h3 id="block-1685e0ff-ddd1-47c3-b621-bfab2934f66c">安装镜像源</h3>



<pre id="block-e16f4683-8b99-41e1-95b3-ce1679945fe7" class="wp-block-code"><code>yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo</code></pre>



<h3 id="block-0e708715-02be-43d0-b66d-e85f1c2f60e7">安装Docker</h3>



<pre id="block-4de129cb-c05b-4189-b65f-c08596482ece" class="wp-block-code"><code>yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</code></pre>



<p id="block-8ce5313b-154b-4115-9f43-b4149b0c9781">安装镜像源之后，如果不能直接安装docker，可能是因为新版的docker对containerd.io版本要求比较高，而centos里面自带的版本比较低，这里需要我们安装containerd.io比较高的版本；如果直接安装完成，就跳过。</p>



<pre id="block-ec42f25c-39ef-4254-a603-174d986581ac" class="wp-block-code"><code>yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm</code></pre>



<p id="block-0adeb2c3-47c4-4c77-9bae-d92fa580d284">安装完成之后，使用命令启动：</p>



<pre id="block-bc57bc37-849d-4a01-9a2a-c7bfe32b493d" class="wp-block-code"><code>systemctl start docker</code></pre>



<p id="block-b1e6539b-b88e-45d9-b82f-3aa999ee09a6">我们需要赋予普通用户使用docker命令的权限，否则docker命令只能root账号使用。</p>



<pre id="block-adcf2736-aebd-4c75-8fd8-6be2e28d6dbf" class="wp-block-code"><code>usermod -aG docker your_account_name</code></pre>



<h3>卸载Docker</h3>



<p>卸载命令：</p>



<pre class="wp-block-code"><code>yum remove docker-ce docker-ce-cli containerd.io .io docker-buildx-plugin docker-compose-plugin</code></pre>



<p>硬盘上的映像、容器、卷或自定义配置文件不会自动删除。要删除所有图像、容器和卷，请执行以下操作：</p>



<pre class="wp-block-code"><code>rm -rf /var/lib/docker
rm -rf /var/lib/containerd</code></pre>



<h3>Centos8</h3>



<pre class="wp-block-preformatted">Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist</pre>



<p>CentOS 8已于2021年12月31日寿终正非，但软件包仍在官方镜像上保留了一段时间，现在他们被转移到https://vault.centos.org。</p>



<p>如果仍然需要运行CentOS 8，可以在/etc/yum.repos.d中更新一下源。使用vault.centos.org代替mirror.centos.org：</p>



<pre class="wp-block-code"><code>$ sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
$ sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*</code></pre>



<h3>Debian</h3>



<p>基本组件安装：</p>



<pre class="wp-block-preformatted">Add Docker's official GPG key:
<code>sudo apt-get update</code>
<code>sudo apt-get install ca-certificates curl</code>
<code>sudo install -m 0755 -d /etc/apt/keyrings</code>
<code>sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc</code>
<code>sudo chmod a+r /etc/apt/keyrings/docker.asc</code>
Add the repository to Apt sources:
<code>echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release &amp;&amp; echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null</code>
<code>sudo apt-get update</code></pre>



<p>安装docker:</p>



<pre class="wp-block-code"><code>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</code></pre>



<p>增加普通用户权限</p>



<pre class="wp-block-code"><code> /usr/sbin/usermod -aG docker 普通账户</code></pre>
<p><a rel="nofollow" href="https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/">Linux安装Docker</a>最先出现在<a rel="nofollow" href="https://wangqianhong.com">wqh博客</a>。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wangqianhong.com/2020/09/centos8%e5%ae%89%e8%a3%85docker/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
