<?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>脚本 &#8211; Lhy&#039;s blog</title>
	<atom:link href="https://blog.lhyshome.com/category/%e8%84%9a%e6%9c%ac/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.lhyshome.com</link>
	<description>welcome</description>
	<lastBuildDate>Wed, 11 Mar 2026 12:24:37 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">219834889</site>	<item>
		<title>Ubuntu创建root用户</title>
		<link>https://blog.lhyshome.com/2026/03/11/377/</link>
					<comments>https://blog.lhyshome.com/2026/03/11/377/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Wed, 11 Mar 2026 12:24:34 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=377</guid>

					<description><![CDATA[手动执行： 在 Ubuntu 24.04 桌面版中，出于系统安全考虑，root 用户是被默认禁止直接登录图形界… <span class="read-more"><a href="https://blog.lhyshome.com/2026/03/11/377/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading">手动执行：</h1>



<p>在 Ubuntu 24.04 桌面版中，出于系统安全考虑，root 用户是被默认禁止直接登录图形界面的。如果你确实需要以 root 身份操作桌面，可以按照以下步骤进行配置。</p>



<p><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/26a0.png" alt="⚠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 重要提示</strong>：启用 root 账户登录会带来极大的安全风险。root 拥有系统的最高权限，任何误操作（如误删系统文件）都可能导致系统崩溃或数据丢失。建议仅在必要时（如系统维护、特定测试）开启，用完即关。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">操作步骤</h3>



<h4 class="wp-block-heading">第一步：为 root 用户设置密码</h4>



<p>首先，你需要为 root 账户激活一个密码。打开终端，执行以下命令：</p>



<pre class="wp-block-code"><code>sudo passwd root</code></pre>



<p>系统会提示你输入并确认新的 root 密码。输入密码时屏幕不会有任何显示，这是正常的。</p>



<h4 class="wp-block-heading">第二步：修改 GDM 配置文件</h4>



<p>GDM (GNOME Display Manager) 是 Ubuntu 的登录管理器，需要修改其配置以允许 root 登录。</p>



<ol class="wp-block-list">
<li>使用 <code>nano</code> 编辑器打开配置文件（你也可以用 <code>vim</code> 或 <code>gedit</code> 替代 <code>nano</code>）： <br><code>sudo nano /etc/gdm3/custom.conf</code></li>



<li>在文件中找到 <code>[security]</code> 这一行。如果找不到，可以手动在文件末尾添加。在 <code>[security]</code> 下方添加一行，内容如下： <br><code>[security] </code><br><code>AllowRoot=true</code></li>



<li>按 <code>Ctrl+O</code> 保存文件，然后按 <code>Ctrl+X</code> 退出编辑器。</li>
</ol>



<h4 class="wp-block-heading">第三步：修改 PAM 认证配置</h4>



<p>PAM (Pluggable Authentication Modules) 是系统的认证模块，它里面有一条规则明确禁止 root 登录图形界面，我们需要把它注释掉。</p>



<ol class="wp-block-list">
<li>编辑第一个 PAM 文件： <br><code>sudo nano /etc/pam.d/gdm-password</code> <br>找到下面这一行，并在行首添加一个 <code>#</code> 号将其注释掉： <br><code># auth required pam_succeed_if.so user != root quiet_success</code> <br>保存并退出 (<code>Ctrl+O</code>, <code>Ctrl+X</code>)。</li>



<li>用同样的方法编辑第二个 PAM 文件：<br><code>sudo nano /etc/pam.d/gdm-autologin</code><br>同样找到并注释掉这一行：<br><code># auth required pam_succeed_if.so user != root quiet_success</code><br>保存并退出。</li>
</ol>



<h4 class="wp-block-heading">第四步：（可选）修复 root 用户的环境配置文件</h4>



<p>首次以 root 登录时，可能会遇到一个关于 <code>/.profile</code> 文件的错误提示。为了避免这个问题，可以提前修复它。</p>



<ol class="wp-block-list">
<li>编辑 root 目录下的 <code>.profile</code> 文件： <br><code>sudo nano /root/.profile</code></li>



<li>找到文件的最后一行，通常是： <br><code>mesg n 2&gt; /dev/null || true</code></li>



<li>将其修改为：<br><code>tty -s &amp;&amp; mesg n || true</code><br>保存并退出。</li>
</ol>



<h4 class="wp-block-heading">第五步：重启系统</h4>



<p>所有配置完成后，需要重启系统以使更改生效：</p>



<pre class="wp-block-code"><code>sudo reboot</code></pre>



<h4 class="wp-block-heading">第六步：以 root 身份登录</h4>



<p>系统重启后，在登录界面，你会发现列表中没有 root 用户。此时，需要点击 <strong>“未列出？”</strong> 或者 <strong>“Other”</strong> 选项。</p>



<p>在弹出的输入框中，用户名输入 <code>root</code>，密码输入你在第一步设置的密码，即可登录到 GNOME 桌面。</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 完成后的小建议</strong><br>完成你的工作后，为了系统安全，建议你按照操作步骤的反向操作，将配置改回去（即注释掉 <code>AllowRoot=true</code>，并恢复 PAM 文件中被注释的行），然后重启系统，恢复使用普通用户。</p>



<h1 class="wp-block-heading">脚本执行</h1>



<div class="wp-block-file"><a id="wp-block-file--media-12f8c3e0-ad76-4157-983a-8d3b4f9fecc6" href="https://blog.lhyshome.com/wp-content/uploads/2026/03/ubuntu-root-login.zip">ubuntu-root-login.zip</a><a href="https://blog.lhyshome.com/wp-content/uploads/2026/03/ubuntu-root-login.zip" class="wp-block-file__button wp-element-button" download aria-describedby="wp-block-file--media-12f8c3e0-ad76-4157-983a-8d3b4f9fecc6">下载</a></div>



<p>上述文件包含</p>



<figure class="wp-block-image size-full"><img decoding="async" width="221" height="89" src="https://blog.lhyshome.com/wp-content/uploads/2026/03/image-17.png" alt="" class="wp-image-382"/></figure>



<p>enable-root-login.sh 是开启root权限的一键脚本<br>disable-root-login.sh 是关闭root登陆权限的一键脚本</p>



<p><strong>1. 赋予执行权限：</strong></p>



<p>chmod +x enable-root-login.sh<br>或者<br><code>chmod +x disable-root-login.sh</code></p>



<p><strong>2.用 sudo 执行：</strong></p>



<p>sudo ./enable-root-login.sh<br>或者<br><code>sudo ./disable-root-login.sh</code></p>



<h1 class="wp-block-heading">脚本执行成功后</h1>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1019" height="735" src="https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20.png" alt="" class="wp-image-387" srcset="https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20.png 1019w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20-300x216.png 300w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20-768x554.png 768w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20-660x476.png 660w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20-500x361.png 500w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-20-800x577.png 800w" sizes="(max-width: 1019px) 100vw, 1019px" /></figure>



<p>点击&#8221;未列出?&#8221;，就可以使用root用户，用<strong>执行命令行所填的密码</strong>来登录ubuntu桌面版系统了</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1019" height="736" src="https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19.png" alt="" class="wp-image-386" srcset="https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19.png 1019w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19-300x217.png 300w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19-768x555.png 768w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19-660x477.png 660w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19-500x361.png 500w, https://blog.lhyshome.com/wp-content/uploads/2026/03/image-19-800x578.png 800w" sizes="(max-width: 1019px) 100vw, 1019px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2026/03/11/377/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">377</post-id>	</item>
		<item>
		<title>系统代理排除内网ip</title>
		<link>https://blog.lhyshome.com/2025/06/11/301/</link>
					<comments>https://blog.lhyshome.com/2025/06/11/301/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Wed, 11 Jun 2025 01:39:41 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[常用命令]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=301</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code>localhost;127.<em>;10.</em>;172.16.<em>;172.17.</em>;172.18.<em>;172.19.</em>;172.20.<em>;172.21.</em>;172.22.<em>;172.23.</em>;172.24.<em>;172.25.</em>;172.26.<em>;172.27.</em>;172.28.<em>;172.29.</em>;172.30.<em>;172.31.</em>;192.168.*</code></pre>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2025/06/11/301/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">301</post-id>	</item>
		<item>
		<title>windows系统 bat开机执行路径</title>
		<link>https://blog.lhyshome.com/2025/04/27/296/</link>
					<comments>https://blog.lhyshome.com/2025/04/27/296/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Sun, 27 Apr 2025 07:30:27 +0000</pubDate>
				<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[bat]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=296</guid>

					<description><![CDATA[C:\Users\Administrator\AppData\Roaming\Microsoft\Window… <span class="read-more"><a href="https://blog.lhyshome.com/2025/04/27/296/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<p>C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2025/04/27/296/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">296</post-id>	</item>
		<item>
		<title>prometheus部署</title>
		<link>https://blog.lhyshome.com/2025/04/22/294/</link>
					<comments>https://blog.lhyshome.com/2025/04/22/294/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Tue, 22 Apr 2025 03:23:57 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[grafana]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[prometheus]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=294</guid>

					<description><![CDATA[prometheus docker部署 prometheus.yml 配置文件 grafana docker部… <span class="read-more"><a href="https://blog.lhyshome.com/2025/04/22/294/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">prometheus docker部署</h2>



<pre class="wp-block-code"><code>docker run -d \
--name=prometheus \
-p 9090:9090 \
-v /home/prometheus/config/prometheus.yml:/etc/prometheus/prometheus.yml \
-v /home/prometheus/prometheus:/prometheus \
{harborPath}/prom/prometheus:v3.3.0</code></pre>



<h3 class="wp-block-heading">prometheus.yml 配置文件</h3>



<pre class="wp-block-code"><code># my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=&lt;job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: &#91;"{prometheus.path}"]
       # The label name is added as a label `label_name=&lt;label_value>` to any timeseries scraped from this config.
        labels:
          app: "prometheus"

  - job_name: 'Aserver'
    static_configs:
      - targets: &#91; '{Aserver.path}' ]
        labels:
          app: "Aserver"
  - job_name: 'Bserver'
    static_configs:
      - targets: &#91; '{Bserver.path}' ]
        labels:
          app: "Bserver"

  - job_name: '200mysql'
    static_configs:
      - targets: &#91;'{mysql.path}']
        labels:
          instance: "200mysql"
          app: "200mysql"</code></pre>



<h2 class="wp-block-heading">grafana docker部署</h2>



<pre class="wp-block-code"><code>docker run -d \
--name=grafana \
-p 3000:3000 \
-v /home/grafana/grafana:/var/lib/grafana \
-e "GF_SECURITY_ADMIN_PASSWORD={password}" \
{harborPath}/grafana/grafana:11.6.0</code></pre>



<h2 class="wp-block-heading">服务器监控收集器 docker部署</h2>



<pre class="wp-block-code"><code>docker run -d \
--name 200-exporter \
--restart=always \
-p 9100:9100 \
-v /proc:/host/proc:ro \
-v /sys:/host/sys:ro \
-v /:/rootfs:ro \
{harborPath}/prom/node-exporter:241003</code></pre>



<h2 class="wp-block-heading">mysql监控收集器 docker部署</h2>



<pre class="wp-block-code"><code>docker run -d \
-p 9104:9104 \
--name=mysqld-exporter \
-v /home/prometheus/mysql/.my.cnf:/.my.cnf \
{harborPath}/prom/mysqld-exporter:v0.17.2</code></pre>



<h3 class="wp-block-heading">.my.cnf 配置文件</h3>



<pre class="wp-block-code"><code>&#91;client]
user={mysql.user}
password={mysql.password}
host={mysql.host}
port={mysql.port}</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2025/04/22/294/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">294</post-id>	</item>
		<item>
		<title>docker创建proxy-client镜像（设置 -e 参数配置）</title>
		<link>https://blog.lhyshome.com/2024/12/30/257/</link>
					<comments>https://blog.lhyshome.com/2024/12/30/257/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Mon, 30 Dec 2024 03:04:33 +0000</pubDate>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[harbor]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[proxy-client]]></category>
		<category><![CDATA[内网穿透]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=257</guid>

					<description><![CDATA[文件夹目录 dockerFile ep.sh config.template docker构建及上传 进入pr… <span class="read-more"><a href="https://blog.lhyshome.com/2024/12/30/257/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">文件夹目录</h2>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="321" height="392" src="https://blog.lhyshome.com/wp-content/uploads/2024/12/image-2.png" alt="" class="wp-image-259" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/12/image-2.png 321w, https://blog.lhyshome.com/wp-content/uploads/2024/12/image-2-246x300.png 246w" sizes="auto, (max-width: 321px) 100vw, 321px" /></figure>



<h2 class="wp-block-heading">dockerFile</h2>



<pre class="wp-block-code"><code>FROM {harbor}/test/openjdk:8-jre
LABEL authors="lhyshome_pc"
ENV TZ=Asia/Shanghai
ADD ./proxy-client /proxy-client
ADD ./ep.sh /ep.sh
RUN apt-get update &amp;&amp; apt-get install -y procps
RUN apt-get update &amp;&amp; apt-get install -y dos2unix
RUN dos2unix /ep.sh &amp;&amp; chmod +x /ep.sh
ENTRYPOINT &#91;"/ep.sh"]</code></pre>



<h2 class="wp-block-heading">ep.sh </h2>



<pre class="wp-block-code"><code>#!/bin/bash

echo "entrypoint.sh start"
# 定义目标配置文件路径
CONFIG_FILE=proxy-client/conf/config.properties

# 替换占位符为环境变量的值
sed -e "s|{{CLIENT_KEY}}|${CLIENT_KEY:-CLIENT_KEY}|g" \
    -e "s|{{SERVER_HOST}}|${SERVER_HOST:-127.0.0.1}|g" \
    -e "s|{{SERVER_PORT}}|${SERVER_PORT:-80}|g" \
    proxy-client/conf/config.template > $CONFIG_FILE

echo "Generated config file:"
cat $CONFIG_FILE

# 启动主程序（根据需要替换为实际启动命令）
exec "proxy-client/bin/startup.sh"</code></pre>



<h2 class="wp-block-heading">config.template</h2>



<pre class="wp-block-code"><code>client.key={{CLIENT_KEY}}
server.host={{SERVER_HOST}}
server.port={{SERVER_PORT}}</code></pre>



<h2 class="wp-block-heading">docker构建及上传</h2>



<p>进入proxy-client的上级目录</p>



<pre class="wp-block-code"><code>docker build -t {harbor}/test/proxy-client:v1.0.0 ./
docker push {harbor}/test/proxy-client:v1.0.0
docker image rm {harbor}/test/proxy-client:v1.0.0</code></pre>



<h2 class="wp-block-heading">docker部署命令</h2>



<p>docker run -e CLIENT_KEY=xxxxx -e SERVER_HOST=xxx.xxx.xxx.xxx -e SERVER_PORT=xxxx &#8211;name proxy-client &#8211;privileged=true &#8211;restart=always -d {harbor}/test/proxy-client:v1.0.0</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/12/30/257/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">257</post-id>	</item>
		<item>
		<title>基于kkFileView的文件预览，docker部署</title>
		<link>https://blog.lhyshome.com/2024/08/15/209/</link>
					<comments>https://blog.lhyshome.com/2024/08/15/209/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Thu, 15 Aug 2024 02:53:14 +0000</pubDate>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[kkFileView]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=209</guid>

					<description><![CDATA[下载 github下载地址：https://github.com/kekingcn/kkFileView 下载… <span class="read-more"><a href="https://blog.lhyshome.com/2024/08/15/209/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">下载</h2>



<p>github下载地址：<br>https://github.com/kekingcn/kkFileView</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="543" src="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-1024x543.png" alt="" class="wp-image-210" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-1024x543.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-300x159.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-768x407.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-1536x815.png 1536w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-500x265.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-800x424.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-1280x679.png 1280w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1-660x350.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-1.png 1587w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>下载源码的zip包</p>



<h2 class="wp-block-heading">安装</h2>



<p>将下载的源码打开后，将源码docker路径下的文件夹上传至服务器</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="391" height="592" src="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-2.png" alt="" class="wp-image-211" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-2.png 391w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-2-198x300.png 198w" sizes="auto, (max-width: 391px) 100vw, 391px" /></figure>



<p>在服务器执行docker build ../../Dockerfile 构建kkFileView的运行的基板</p>



<p>对源码 maven package后将server/target下的 kkFileView-4.4.0-beta.tar.gz 文件和根目录的Dockerfile（注意这里的Dockerfile和之前步骤的Dockerfile不是同一个，作用也不一样）上传至服务器</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="330" height="646" src="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-3.png" alt="" class="wp-image-212" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-3.png 330w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-3-153x300.png 153w" sizes="auto, (max-width: 330px) 100vw, 330px" /></figure>



<p>修改Dockerfile中的 ADD ./kkFileView-4.4.0-beta.tar.gz /opt/ 这一行  将kkFileView-4.4.0-beta.tar.gz的路径改为服务器上对应的 绝对路径或者相对路径，对当前DockerFile执行docker build ，构建完成后将会出现kkFileView的执行docker镜像</p>



<p>用docker run启动当前镜像 暴露8012端口到宿主机</p>



<p>在服务器防火墙上对8012端口放行</p>



<h2 class="wp-block-heading">验证</h2>



<p>http://服务器ip:8012</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="596" src="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-1024x596.png" alt="" class="wp-image-213" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-1024x596.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-300x175.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-768x447.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-500x291.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-800x466.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-1280x745.png 1280w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4-660x384.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/08/image-4.png 1522w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>出现这个页面则为部署成功</p>



<p>http://服务器ip:8012/onlinePreview?url=aHR0cDovLzE5Mi4xNjguMC4yMDA6NTI0NC9wL0Rvd25sb2Fkcy8lRTYlOTYlQjAlRTUlQkIlQkElRTYlOTYlODclRTYlQTElQTMuZG9jeD9zaWduPW53RHB2MVhoS2NXQ3pPODVfa2tPbE85MFo1NGp2YnNXdXA0VlRacnlmaUU9OjA%3D</p>



<p><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">注意http://服务器ip:8012/onlinePreview?url= 后拼接的地址为文件下载地址，且必须经过base64编码后的请求地址</mark></p>



<h2 class="wp-block-heading">官方操作文档</h2>



<p>https://kkfileview.keking.cn</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/08/15/209/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">209</post-id>	</item>
		<item>
		<title>windows hyper-v给linux(centos/rocky)扩容空间</title>
		<link>https://blog.lhyshome.com/2024/08/07/203/</link>
					<comments>https://blog.lhyshome.com/2024/08/07/203/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Wed, 07 Aug 2024 06:06:47 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[hyperv]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=203</guid>

					<description><![CDATA[1.hyper操作 （1）虚拟机关机后，在设置中，查看硬盘驱动器中的虚拟磁盘及编号， （2）编辑磁盘-&#62;… <span class="read-more"><a href="https://blog.lhyshome.com/2024/08/07/203/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">1.hyper操作</h2>



<p>（1）虚拟机关机后，在设置中，查看硬盘驱动器中的虚拟磁盘及编号，</p>



<p>（2）编辑磁盘-&gt;查找磁盘中选中刚才的编号磁盘</p>



<p>（3）操作时扩容（大小填的不是增量 ，是扩容以后的空间）</p>



<h2 class="wp-block-heading">2.linux扩容，使用LVM管理空间</h2>



<p>（1）查询磁盘容量</p>



<pre class="wp-block-code"><code>fdisk -l</code></pre>



<p>（2）新增分区</p>



<pre class="wp-block-code"><code>fdisk /dev/sda #进入硬盘分区环境
# 输入m查询可以使用的命令
# 输入命令：n ,创建新的分区，回车到底，使用命令
# 最后输入命令：w 保存（保存不了可以重启后再尝试保存）。
fdisk -l #可以查看新增的分区</code></pre>



<p>（3）修改分区类型</p>



<pre class="wp-block-code"><code>fdisk /dev/sda #进入硬盘分区环境
# 输入命令：t，
# 输入上一步新增的分区数字编号
# 然后输入：8e，将新建的分区磁盘类型修改为Linux LVM
# 输入命令：w，保存
fdisk -l #可以查看新增的分区已经修改了类型</code></pre>



<p>（4）用命令pvdisplay查看当前物理卷</p>



<pre class="wp-block-code"><code>pvcreate /dev/sda3 #创建新的物理卷
vgdisplay #查看现有的卷组，注意卷组命令VG Name的值。</code></pre>



<p>（5）使用vgextend将新的物理卷添加到卷组中</p>



<pre class="wp-block-code"><code>vgextend {VGName} /dev/sda3 #将{VGName}替换成上一步查询到的VGName</code></pre>



<p>（6）查看逻辑卷路径</p>



<pre class="wp-block-code"><code>lvdisplay</code></pre>



<p>（7）扩展逻辑卷   </p>



<pre class="wp-block-code"><code>lvresize -l +100%FREE /dev/{VGName}/root</code></pre>



<p>（8）使用命令 ,查看文件系统类型为xfs</p>



<pre class="wp-block-code"><code>mount |grep root</code></pre>



<p>（9）使用命令&#8221;xfs_growfs&#8221;对xfs文件系统进行扩容</p>



<pre class="wp-block-code"><code>xfs_growfs /dev/mapper/{VGName}-root</code></pre>



<p>（10）可以看到路径&#8221;/&#8221;扩容成功</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/08/07/203/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">203</post-id>	</item>
		<item>
		<title>如何将内网的服务用域名访问</title>
		<link>https://blog.lhyshome.com/2024/07/25/192/</link>
					<comments>https://blog.lhyshome.com/2024/07/25/192/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Thu, 25 Jul 2024 01:47:03 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[内网穿透]]></category>
		<category><![CDATA[域名]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=192</guid>

					<description><![CDATA[本次所需 域名，云服务器（为了云服务器的公网IP），内网穿透工具。本贴域名与云服务器皆为阿里云系。云服务器安装… <span class="read-more"><a href="https://blog.lhyshome.com/2024/07/25/192/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">本次所需</h2>



<p>域名，云服务器（为了云服务器的公网IP），内网穿透工具。本贴域名与云服务器皆为阿里云系。云服务器安装nginx，和内网穿透工具服务端。</p>



<h2 class="wp-block-heading">部署操作</h2>



<h3 class="wp-block-heading">阿里云</h3>



<p class="has-text-align-left">在阿里云的云解析DNS上将已有二级域名（eg.： example.com）解析为三级域名（eg.：alist.example.com）方便后续操作。记录值设为已有云服务器公网IP地址。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="300" src="https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-1024x300.png" alt="" class="wp-image-193" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-1024x300.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-300x88.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-768x225.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-1536x450.png 1536w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-500x147.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-800x235.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-1280x375.png 1280w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4-660x194.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-4.png 1910w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">内网穿透工具</h3>



<p>登录云服务器上部署的内网穿透工具后台，将内网的IP和端口映射到服务器上的具体某一端口。</p>



<p>eg.：将内网端口映射到服务器的8080端口</p>



<h3 class="wp-block-heading">云服务器</h3>



<p>在nginx里添加对应配置脚本，将nginx的80端口（或其他端口）代理到内网映射的对应端口上</p>



<pre class="wp-block-code"><code>upstream example {
    server 127.0.0.1:8080 ;
}

server {
    listen 80;
    server_name alist.example.com;
    location / {
       proxy_pass http://example;
    }
}</code></pre>



<h2 class="wp-block-heading">结束</h2>



<p>即可以通过访问alist.example.com域名可以访问到服务器的对应端口，再经由内网穿透工具访问到内网的具体服务上。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/07/25/192/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">192</post-id>	</item>
		<item>
		<title>Linux系统docker安装AList</title>
		<link>https://blog.lhyshome.com/2024/07/25/183/</link>
					<comments>https://blog.lhyshome.com/2024/07/25/183/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Thu, 25 Jul 2024 01:08:42 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[AList]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=183</guid>

					<description><![CDATA[docker命令 执行后docker容器的log中会展示出admin账号的密码 页面登陆127.0.0.1:5… <span class="read-more"><a href="https://blog.lhyshome.com/2024/07/25/183/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">docker命令</h2>



<pre class="wp-block-code"><code>docker run -d --restart=unless-stopped -v /home/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:v3.36.0</code></pre>



<p>执行后docker容器的log中会展示出admin账号的密码</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="199" src="https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-1024x199.png" alt="" class="wp-image-184" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-1024x199.png 1024w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-300x58.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-768x149.png 768w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-500x97.png 500w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-800x156.png 800w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-1280x249.png 1280w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2-660x128.png 660w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-2.png 1414w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>页面登陆127.0.0.1:5244</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="601" height="574" src="https://blog.lhyshome.com/wp-content/uploads/2024/07/image-3.png" alt="" class="wp-image-185" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/07/image-3.png 601w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-3-300x287.png 300w, https://blog.lhyshome.com/wp-content/uploads/2024/07/image-3-500x478.png 500w" sizes="auto, (max-width: 601px) 100vw, 601px" /></figure>



<p>看到该页面即部署成功</p>



<h2 class="wp-block-heading">nginx配置（可选）</h2>



<p>如果需要使用域名访问，nginx反向代理如下</p>



<pre class="wp-block-preformatted">upstream alist {<br>    server 127.0.0.1:5244 ;<br>}<br><br>server {<br>    listen 80;<br>    server_name alist.example.com;<br>    location / {<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>        proxy_set_header Host $http_host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header Range $http_range;<br>        proxy_set_header If-Range $http_if_range;<br>        proxy_redirect off;<br>        # the max size of file to upload<br>        client_max_body_size 20000m;<br>        proxy_pass http://alist;<br>    }<br>}</pre>



<h2 class="wp-block-heading">AList官方文档</h2>



<p>https://alist.nn.ci/zh</p>



<h2 class="wp-block-heading">AList github地址</h2>



<p>https://github.com/alist-org/alist/tree/main</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/07/25/183/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">183</post-id>	</item>
		<item>
		<title>k8s中通过yml给容器配置hosts</title>
		<link>https://blog.lhyshome.com/2024/05/30/149/</link>
					<comments>https://blog.lhyshome.com/2024/05/30/149/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Thu, 30 May 2024 01:16:59 +0000</pubDate>
				<category><![CDATA[脚本]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[k8s]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=149</guid>

					<description><![CDATA[pod配置 在Kubernetes中，如果你想要为你的容器配置特定的hosts条目，你可以使用Pod的host… <span class="read-more"><a href="https://blog.lhyshome.com/2024/05/30/149/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">pod配置</h2>



<p>在Kubernetes中，如果你想要为你的容器配置特定的hosts条目，你可以使用Pod的<code>hostAliases</code>字段来实现。以下是一个YAML配置的例子，展示了如何为Pod添加额外的hosts条目：</p>



<pre class="wp-block-code"><code>apiVersion: v1
kind: Pod
metadata:
  name: custom-hosts-pod
spec:
  containers:
  - name: example
    image: nginx
  hostAliases:
  - ip: "123.45.67.89"
    hostnames:
    - "my.custom.domain"</code></pre>



<p>在这个例子中，当Pod中的容器访问<code>my.custom.domain</code>时，它会被解析为<code>123.45.67.89</code>。这个功能可以用来添加临时的或者特定于Pod的hosts条目，而不需要修改节点的<code>/etc/hosts</code>文件。</p>



<h2 class="wp-block-heading">deployment配置</h2>



<p>在Kubernetes中，Deployment资源通常用于部署和管理Pod的副本集合。Deployment不直接支持配置hosts文件，因为这是在Pod级别进行的。但是，你可以通过定义Pod的hosts文件来实现相似的效果。</p>



<p>要在Kubernetes Deployment中配置hosts，你可以在Pod的spec中使用<code>hostAliases</code>字段来添加额外的主机名和IP地址到/etc/hosts文件中。下面是一个YAML配置的例子：</p>



<pre class="wp-block-code"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      hostAliases:
      - ip: "123.45.67.89"
        hostnames:
        - "my.custom.domain"
      containers:
      - name: my-container
        image: my-image
        ports:
        - containerPort: 80</code></pre>



<p>在这个配置中，Deployment的每个Pod都将拥有一个额外的hosts条目，将<code>my.custom.domain</code>解析到IP&nbsp;<code>123.45.67.89</code>。这样，Pod内的应用程序将能够使用定义的域名进行网络访问。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/05/30/149/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">149</post-id>	</item>
	</channel>
</rss>
