<?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>Other Services (其他服务) &#8211; Eternal Center</title>
	<atom:link href="https://eternalcenter-may-1-2022.github.io/category/services/other-services/feed/" rel="self" type="application/rss+xml" />
	<link>https://eternalcenter-may-1-2022.github.io/</link>
	<description></description>
	<lastBuildDate>Sun, 01 May 2022 09:31:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>[内容] SUSE Repository Mirroring Tool (RMT) 代理的设置</title>
		<link>https://eternalcenter-may-1-2022.github.io/rmt-proxy/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Thu, 28 Apr 2022 11:26:11 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[SUSE Repository Mirroring Tool (RMT)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23351</guid>

					<description><![CDATA[将部分内容修改如下： （补充：这里以将代理服务器设置为网址是 https://eternalcenter-may-1-2022.github.io，端口是/ 8000，没有用户和密码为例）]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code># vim /etc/rmt.conf</code></pre>



<p>将部分内容修改如下：</p>



<pre class="wp-block-code"><code>http_client:
  verbose: false
  proxy: https://eternalcenter-may-1-2022.github.io:8000/
  proxy_auth: 
  proxy_user: 
  proxy_password: </code></pre>



<p>（补充：这里以将代理服务器设置为网址是 https://eternalcenter-may-1-2022.github.io，端口是/ 8000，没有用户和密码为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Red Hat Satellite 打补丁或升级</title>
		<link>https://eternalcenter-may-1-2022.github.io/red-hat-satellite-patch-upgrade/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 25 Apr 2022 09:01:00 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23278</guid>

					<description><![CDATA[步骤一：备份系统1.1 关闭 Red Hat Satellite 服务 1.2 备份系统 （补充：这里以备份虚拟环境下的 Red Hat Satellite 为例） 1.2.1 关闭系统 1.2.2 给系统打快照 （步骤略） 1.2.3 启动系统 （步骤略） 步骤二：升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁2.1 检测可升级 RedHat Satellite 版本 2.2 预检测升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁是否能成功 （注意：如果是升级 Red Hat Satellite 的话就指定最新的版本，如果是给 Red Hat Satellite 打补丁的话就选择当前的版本） （补充：这里以指定 6.10.z &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/red-hat-satellite-patch-upgrade/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] Red Hat Satellite 打补丁或升级"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4>步骤一：备份系统<br>1.1 关闭 Red Hat Satellite 服务</h4>



<pre class="wp-block-code"><code># satellite-maintain service stop</code></pre>



<h4>1.2 备份系统</h4>



<p>（补充：这里以备份虚拟环境下的 Red Hat Satellite 为例）</p>



<h4>1.2.1 关闭系统</h4>



<pre class="wp-block-code"><code># poweroff</code></pre>



<h4>1.2.2 给系统打快照</h4>



<p>（步骤略）</p>



<h4>1.2.3 启动系统</h4>



<p>（步骤略）</p>



<h4>步骤二：升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁<br>2.1 检测可升级 RedHat Satellite 版本</h4>



<pre class="wp-block-code"><code># satellite-maintain upgrade list-versions</code></pre>



<h4>2.2 预检测升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁是否能成功</h4>



<pre class="wp-block-code"><code># satellite-maintain upgrade check --target-version 6.10.z</code></pre>



<p>（注意：如果是升级 Red Hat Satellite 的话就指定最新的版本，如果是给 Red Hat Satellite 打补丁的话就选择当前的版本）</p>



<p>（补充：这里以指定 6.10.z 版本的 Red Hat Satellite 为例）</p>



<h4>2.3 升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁</h4>



<pre class="wp-block-code"><code># satellite-maintain upgrade run --target-version 6.10.z</code></pre>



<p>（<br>注意：<br>1) 只有当预检测升级 Red Hat Satellite 或给 Red Hat Satellite 打补丁成功后才能接着执行此步骤<br>2) 如果是升级 Red Hat Satellite 的话就指定最新的版本，如果是给 Red Hat Satellite 打补丁的话就选择当前的版本<br>）</p>



<p>（补充：这里以指定 6.10.z 版本的 Red Hat Satellite 为例）</p>



<h4>步骤三：重启 Red Hat Satellite<br>3.1 关闭 Red Hat Satellite 服务</h4>



<pre class="wp-block-code"><code># satellite-maintain service stop</code></pre>



<h4>3.2 重启 Red Hat Satellite</h4>



<pre class="wp-block-code"><code># reboot</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[[内容] Linux 官方软件库列表 （RHEL 8 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/official-software-repository-list-rhel/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 23 Apr 2022 15:24:12 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Software (系统软件)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23248</guid>

					<description><![CDATA[内容一：基础软件源 内容二：Red Hat Satellite Tool 软件源 （补充：这里以 Red Hat Satellite Tool 6.10 软件源为例）]]></description>
										<content:encoded><![CDATA[
<h4>内容一：基础软件源</h4>



<pre class="wp-block-code"><code>rhel-8-for-x86_64-baseos-rpms</code></pre>



<pre class="wp-block-code"><code>rhel-8-for-x86_64-appstream-rpms</code></pre>



<h4>内容二：Red Hat Satellite Tool 软件源</h4>



<pre class="wp-block-code"><code>satellite-tools-6.10-for-rhel-8-x86_64-rpms</code></pre>



<p>（补充：这里以 Red Hat Satellite Tool 6.10 软件源为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] 全球公共免费 DNS</title>
		<link>https://eternalcenter-may-1-2022.github.io/free-dns/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Thu, 14 Apr 2022 15:24:23 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Setting (系统设置)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23164</guid>

					<description><![CDATA[AdGuard Cloudflare COMODO DNS Watch Dyn Level 3 Neustar FreeDNS Google OpenDNS SAFEDNS Symantec]]></description>
										<content:encoded><![CDATA[
<h2>AdGuard</h2>



<pre class="wp-block-code"><code>94.140.14.14
94.140.14.15
94.140.15.15
94.140.15.16</code></pre>



<h2>Cloudflare</h2>



<pre class="wp-block-code"><code>1.0.0.1
1.0.0.2
1.0.0.3
1.1.1.1
1.1.1.2
1.1.1.3</code></pre>



<h2>COMODO</h2>



<pre class="wp-block-code"><code>8.20.247.20
8.26.56.26</code></pre>



<h2>DNS Watch</h2>



<pre class="wp-block-code"><code>84.200.69.80
84.200.70.40</code></pre>



<h2>Dyn</h2>



<pre class="wp-block-code"><code>216.146.35.35
216.146.36.36</code></pre>



<h2>Level 3</h2>



<pre class="wp-block-code"><code>209.244.0.3
209.244.0.4</code></pre>



<h2>Neustar</h2>



<pre class="wp-block-code"><code>156.154.70.1
156.154.71.1</code></pre>



<h2>FreeDNS</h2>



<pre class="wp-block-code"><code>37.235.1.174
37.235.1.177</code></pre>



<h2>Google</h2>



<pre class="wp-block-code"><code>8.8.4.4
8.8.8.8</code></pre>



<h2>OpenDNS</h2>



<pre class="wp-block-code"><code>208.67.220.220
208.67.222.222</code></pre>



<h2>SAFEDNS</h2>



<pre class="wp-block-code"><code>195.46.39.39
195.46.39.40</code></pre>



<h2>Symantec</h2>



<pre class="wp-block-code"><code>199.85.126.10
199.85.137.10</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[排错] 解决 Linux 日志报错：“hash:/etc/aliases is unavailable.open database /etc/aliases.db” 或者 “error: open database /etc/aliases.db: No such file or directory”</title>
		<link>https://eternalcenter-may-1-2022.github.io/debug-hash-etc-aliases-is-unavailable-open-database-etc-aliases-db-or-error-open-database-etc-aliases-db-no-such-file-or-directory/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 04 Apr 2022 09:54:35 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=22729</guid>

					<description><![CDATA[报错代码： 或者： 解决方法：]]></description>
										<content:encoded><![CDATA[
<h2>报错代码：</h2>



<pre class="wp-block-code"><code>hash:/etc/aliases is unavailable.open database /etc/aliases.db</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>error: open database /etc/aliases.db: No such file or directory</code></pre>



<h2>解决方法：</h2>



<pre class="wp-block-code"><code># newaliases</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[排错] 解决 openSUSE &#038; SLE 升级系统时报错 “Can&#8217;t get available migrations from server: SUSE::Connect::ApiError: Multiple base products found:&#8230;&#8230;”</title>
		<link>https://eternalcenter-may-1-2022.github.io/debug-cant-get-available-migrations-from-server-suseconnectapierror-multiple-base-products-found/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Thu, 03 Mar 2022 08:00:33 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[SUSE Repository Mirroring Tool (RMT)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Computer & System Hardware & System Installation & System Upgradation (系统电脑 & 系统硬件 & 系统安装 & 系统升级)]]></category>
		<category><![CDATA[System Upgradation (系统升级)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=22328</guid>

					<description><![CDATA[报错代码： 分析： 当上一次升级失败或者升级回滚了以后可能会报此类错误 解决方法： 方法一：通过 SUSEConnect 命令回滚1.1 通过 SUSEConnect 命令回滚 # SUSEConnect &#8211;rollback 1.2 重新升级 （步骤略） 步骤二：取消注册再重新注册2.1 取消注册再重新注册 （步骤略） 2.2 重新升级 （步骤略） 参考文献： https://www.suse.com/support/kb/doc/?id=000019523]]></description>
										<content:encoded><![CDATA[
<h2>报错代码：</h2>



<pre class="wp-block-code"><code>Can't get available migrations from server: SUSE::Connect::ApiError: Multiple base products found: ......</code></pre>



<h2>分析：</h2>



<p>当上一次升级失败或者升级回滚了以后可能会报此类错误</p>



<h2>解决方法：</h2>



<h4>方法一：通过 SUSEConnect 命令回滚<br>1.1 通过 SUSEConnect 命令回滚</h4>



<p># SUSEConnect &#8211;rollback</p>



<h4>1.2 重新升级</h4>



<p>（步骤略）</p>



<h4>步骤二：取消注册再重新注册<br>2.1 取消注册再重新注册</h4>



<p>（步骤略）</p>



<h4>2.2 重新升级</h4>



<p>（步骤略）</p>



<h2>参考文献：</h2>



<p class="has-text-align-center">https://www.suse.com/support/kb/doc/?id=000019523</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 监控普通登录记录 （排除 SFTP 登录记录只监控普通登录记录）</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-login-log-exclude-sftp/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 15 Feb 2022 14:52:50 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[SFTP]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Monitor (监控)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[Storage Services (存储服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21977</guid>

					<description><![CDATA[注意： 在排除 SFTP 登录记录只监控普通登录记录前要先开启 SFTP 日志： 介绍： 作者：朱明宇名称：监控普通登录记录 （排除 SFTP 登录记录只监控普通登录记录）作用：监控普通登录记录 （排除 SFTP 登录记录只监控普通登录记录） 使用方法：1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本4. 普通登录记录会同时记录在系统日志和 $logfile 里 脚本分割线里的变量：1. logfile=logfile.txt #用户保存记录的文件2. prompt=&#8221;and no sftp info&#8221; #记录里普通登录记录的文件 脚本：]]></description>
										<content:encoded><![CDATA[
<h2 id="注意">注意：</h2>



<p>在排除 SFTP 登录记录只监控普通登录记录前要先开启 SFTP 日志：</p>



<div class="wp-container-1 wp-block-buttons">
<div class="wp-block-button aligncenter is-style-outline"><a class="wp-block-button__link" href="https://eternalcenter-may-1-2022.github.io/sftp-log/" style="border-radius:0px">SFTP 日志的开启</a></div>
</div>



<h2 id="介绍">介绍：</h2>



<p>作者：朱明宇<br>名称：监控普通登录记录 （排除 SFTP 登录记录只监控普通登录记录）<br>作用：监控普通登录记录 （排除 SFTP 登录记录只监控普通登录记录）</p>



<p>使用方法：<br>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本<br>4. 普通登录记录会同时记录在系统日志和 $logfile 里</p>



<p>脚本分割线里的变量：<br>1. logfile=logfile.txt #用户保存记录的文件<br>2. prompt=&#8221;and no sftp info&#8221; #记录里普通登录记录的文件</p>



<h2 id="脚本">脚本：</h2>



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

####################### Separator ########################

logfile=logfile.txt
prompt="and no sftp info"

####################### Separator ########################

checktime=`date +%Y-%m-%dT%H -d "-1 day"`

for i in `cat -n /var/log/messages | grep $check_time | grep 'Started Session' | grep -v 'root' | awk '{print $1}'`

do
   line=`sed -n $&#91;i]p /var/log/messages`
   time=`echo $line | awk '{print $1}'`
   session=`echo $line | awk '{print $6}'`
   user=`echo $line | awk '{print $9}'`
   user=${user%.}

   message="ACCESS CHECK LOG: Time:$time Session:$session $user has accessed `hostname`, $prompt"

   let sftpline=i+3

   sed -n $&#91;sftpline]p /var/log/messages | grep sftp-server &amp;&gt; /dev/null
   if &#91; $? -ne 0 ];then
           echo $message
           echo $message &gt;&gt; $logfile.txt
           logger $message
   fi
   echo
done</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] SUSE 命令 SUSEConnect （注册客户端到 SUSE Repository Mirroring Tool (RMT)）</title>
		<link>https://eternalcenter-may-1-2022.github.io/suseconnect/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 15 Feb 2022 13:27:33 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[SUSE Repository Mirroring Tool (RMT)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Software (系统软件)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21968</guid>

					<description><![CDATA[如果是 HTTP 协议： 或者： 如果是 HTTPS 协议： 或者：]]></description>
										<content:encoded><![CDATA[
<p>如果是 HTTP 协议：</p>



<pre class="wp-block-code"><code># SUSEConnect -u http://&lt;/<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: -webkit-standard; font-size: medium; white-space: normal;">SUSE Repository Mirroring Tool (RMT</span>) Server's IP address or FQDN&gt;</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># SUSEConnect --url http://&lt;/<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: -webkit-standard; font-size: medium; white-space: normal;">SUSE Repository Mirroring Tool (RMT</span>) Server's IP address or FQDN></code></pre>



<p>如果是 HTTPS 协议：</p>



<pre class="wp-block-code"><code># SUSEConnect -u https://&lt;/<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: -webkit-standard; font-size: medium; white-space: normal;">SUSE Repository Mirroring Tool (RMT</span>) Server's IP address or FQDN&gt;</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># SUSEConnect --url https://&lt;/<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: -webkit-standard; font-size: medium; white-space: normal;">SUSE Repository Mirroring Tool (RMT</span>) Server's IP address or FQDN></code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] PXE 新系统模板的添加</title>
		<link>https://eternalcenter-may-1-2022.github.io/pxe-template-add/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 12 Feb 2022 15:14:50 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Pre-boot Execution Environment (PXE)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Computer & System Hardware & System Installation & System Upgradation (系统电脑 & 系统硬件 & 系统安装 & 系统升级)]]></category>
		<category><![CDATA[System Installation (系统安装)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21908</guid>

					<description><![CDATA[步骤目录： 步骤一：准备安装镜像1.1 从官网上下载安装镜像1.2 挂载安装镜像1.2.1 创建用于挂载安装镜像的目录1.2.2 挂载安装镜像 步骤二：准备用于进行 PXE 安装的数据2.1 准备系统安装数据2.1.1 创建用于存放系统安装数据的目录2.1.2 拷贝安装镜像里的数据到用于存放系统安装数据的目录2.1.2.1 拷贝安装镜像里的普通数据到用于存放系统安装数据的目录2.1.2.2 拷贝安装镜像里的 .treeinfo 文件到用于存放系统安装数据的目录2.2 准备安装引导文件2.2.1 创建用于存放安装引导文件的目录2.2.1.1 创建用于存放 BIOS 安装引导文件的目录2.2.1.2 创建用于存放 EFI 安装引导文件的目录2.2.2 拷贝安装镜像里的安装引导文件到存放安装引导文件的目录2.2.2.1 拷贝安装镜像里的 BIOS 安装引导文件到存放 BIOS 安装引导文件的目录2.2.2.2 拷贝安装镜像里的 EFI 安装引导文件到存放 EFI 安装引导文件的目录2.3 准备系统安装配置文件2.3.1 进入到用于存放系统安装配置文件的目录2.3.2 创建系统安装配置文件2.3.2.1 创建 BIOS 系统安装配置文件2.3.2.2 创建 EFI 系统安装配置文件2.3.3 设置系统安装配置文件的权限2.3.3.1 设置 BIOS 系统安装配置文件的权限2.3.3.2 设置 EFI 系统安装配置文件的权限2.4 修改系统安装菜单文件 pxelinux.cfg2.4.1 修改 BIOS &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/pxe-template-add/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] PXE 新系统模板的添加"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="步骤目录">步骤目录：</h2>



<h4 id="步骤一-准备安装镜像1-1-从官网上下载安装镜像1-2-挂载安装镜像1-2-1-创建用于挂载安装镜像的目录1-2-2-挂载安装镜像">步骤一：准备安装镜像<br>1.1 从官网上下载安装镜像<br>1.2 挂载安装镜像<br>1.2.1 创建用于挂载安装镜像的目录<br>1.2.2 挂载安装镜像</h4>



<h4 id="步骤二-准备用于进行-pxe-安装的数据2-1-准备系统安装数据2-1-1-创建用于存放系统安装数据的目录2-1-2-拷贝安装镜像里的数据到用于存放系统安装数据的目录2-1-2-1-拷贝安装镜像里的普通数据到用于存放系统安装数据的目录2-1-2-2-拷贝安装镜像里的-treeinfo-文件到用于存放系统安装数据的目录2-2-准备安装引导文件2-2-1-创建用于存放安装引导文件的目录2-2-1-1-创建用于存放-bios-安装引导文件的目录2-2-1-2-创建用于存放-efi-安装引导文件的目录2-2-2-拷贝安装镜像里的安装引导文件到存放安装引导文件的目录2-2-2-1-拷贝安装镜像里的-bios-安装引导文件到存放-bios-安装引导文件的目录2-2-2-2-拷贝安装镜像里的-efi-安装引导文件到存放-efi-安装引导文件的目录2-3-准备系统安装配置文件2-3-1-进入到用于存放系统安装配置文件的目录2-3-2-创建系统安装配置文件2-3-2-1-创建-bios-系统安装配置文件2-3-2-2-创建-efi-系统安装配置文件2-3-3-设置系统安装配置文件的权限2-3-3-1-设置-bios-系统安装配置文件的权限2-3-3-2-设置-efi-系统安装配置文件的权限2-4-修改系统安装菜单文件-pxelinux-cfg2-4-1-修改-bios-系统安装菜单文件-pxelinux-cfg2-4-2-修改-efi-系统安装菜单文件-grub-cfg">步骤二：准备用于进行 PXE 安装的数据<br>2.1 准备系统安装数据<br>2.1.1 创建用于存放系统安装数据的目录<br>2.1.2 拷贝安装镜像里的数据到用于存放系统安装数据的目录<br>2.1.2.1 拷贝安装镜像里的普通数据到用于存放系统安装数据的目录<br>2.1.2.2 拷贝安装镜像里的 .treeinfo 文件到用于存放系统安装数据的目录<br>2.2 准备安装引导文件<br>2.2.1 创建用于存放安装引导文件的目录<br>2.2.1.1 创建用于存放 BIOS 安装引导文件的目录<br>2.2.1.2 创建用于存放 EFI 安装引导文件的目录<br>2.2.2 拷贝安装镜像里的安装引导文件到存放安装引导文件的目录<br>2.2.2.1 拷贝安装镜像里的 BIOS 安装引导文件到存放 BIOS 安装引导文件的目录<br>2.2.2.2 拷贝安装镜像里的 EFI 安装引导文件到存放 EFI 安装引导文件的目录<br>2.3 准备系统安装配置文件<br>2.3.1 进入到用于存放系统安装配置文件的目录<br>2.3.2 创建系统安装配置文件<br>2.3.2.1 创建 BIOS 系统安装配置文件<br>2.3.2.2 创建 EFI 系统安装配置文件<br>2.3.3 设置系统安装配置文件的权限<br>2.3.3.1 设置 BIOS 系统安装配置文件的权限<br>2.3.3.2 设置 EFI 系统安装配置文件的权限<br>2.4 修改系统安装菜单文件 pxelinux.cfg<br>2.4.1 修改 BIOS 系统安装菜单文件 pxelinux.cfg<br>2.4.2 修改 EFI 系统安装菜单文件 grub.cfg</h4>



<h4 id="步骤三-取消挂载安装镜像">步骤三：取消挂载安装镜像</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="步骤一-准备安装镜像1-1-从官网上下载安装镜像">步骤一：准备安装镜像<br>1.1 从官网上下载安装镜像</h4>



<p>（步骤略）</p>



<h4 id="1-2-挂载安装镜像1-2-1-创建用于挂载安装镜像的目录">1.2 挂载安装镜像<br>1.2.1 创建用于挂载安装镜像的目录</h4>



<pre class="wp-block-code"><code># mkdir &lt;directory for mounting the image&gt;</code></pre>



<h4 id="1-2-2-挂载安装镜像">1.2.2 挂载安装镜像</h4>



<pre class="wp-block-code"><code># mount -t iso9660 &lt;image&gt; &lt;directory for mounting the image&gt;</code></pre>



<h4 id="步骤二-准备用于进行-pxe-安装的数据2-1-准备系统安装数据2-1-1-创建用于存放系统安装数据的目录">步骤二：准备用于进行 PXE 安装的数据<br>2.1 准备系统安装数据<br>2.1.1 创建用于存放系统安装数据的目录</h4>



<pre class="wp-block-code"><code># mkdir &lt;directory of data for installing the system&gt;</code></pre>



<p>（注意：用于存放系统安装数据的目录必须要放在能够实现 PXE 安装时网络共享的目录里（例如：通过 httpd 服务进行网络共享））</p>



<h4 id="2-1-2-拷贝安装镜像里的数据到用于存放系统安装数据的目录2-1-2-1-拷贝安装镜像里的普通数据到用于存放系统安装数据的目录">2.1.2 拷贝安装镜像里的数据到用于存放系统安装数据的目录<br>2.1.2.1 拷贝安装镜像里的普通数据到用于存放系统安装数据的目录</h4>



<pre class="wp-block-code"><code># cp -rp &lt;directory for mounting the image&gt;/* &lt;directory of data for installing the system&gt;</code></pre>



<h4 id="2-1-2-2-拷贝安装镜像里的-treeinfo-文件到用于存放系统安装数据的目录">2.1.2.2 拷贝安装镜像里的 .treeinfo 文件到用于存放系统安装数据的目录</h4>



<pre class="wp-block-code"><code># cp -rp &lt;directory for mounting the image&gt;/.treeinfo &lt;directory of data for installing the system&gt;</code></pre>



<h4 id="2-2-准备安装引导文件2-2-1-创建用于存放安装引导文件的目录2-2-1-1-创建用于存放-bios-安装引导文件的目录">2.2 准备安装引导文件<br>2.2.1 创建用于存放安装引导文件的目录<br>2.2.1.1 创建用于存放 BIOS 安装引导文件的目录</h4>



<pre class="wp-block-code"><code># mkdir &lt;directory of BIOS boot file for installing the system&gt;</code></pre>



<p>（注意：用于存放 BIOS 安装引导文件的目录必须要放在能够实现 TFPT 网络共享的目录里）</p>



<h4 id="2-2-1-2-创建用于存放-efi-安装引导文件的目录">2.2.1.2 创建用于存放 EFI 安装引导文件的目录</h4>



<pre class="wp-block-code"><code># mkdir &lt;directory of EFI boot file for installing the system&gt;</code></pre>



<p>（注意：用于存放 EFI 安装引导文件的目录必须要放在能够实现 TFPT 网络共享的目录里）</p>



<h4 id="2-2-2-拷贝安装镜像里的安装引导文件到存放安装引导文件的目录2-2-2-1-拷贝安装镜像里的-bios-安装引导文件到存放-bios-安装引导文件的目录">2.2.2 拷贝安装镜像里的安装引导文件到存放安装引导文件的目录<br>2.2.2.1 拷贝安装镜像里的 BIOS 安装引导文件到存放 BIOS 安装引导文件的目录</h4>



<p>如果是 Rocky Linux &amp; RHEL 的话则拷贝 initrd.img 文件、TRANS.TBL 文件和 vmlinuz 文件：</p>



<pre class="wp-block-code"><code># curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/images/pxeboot/initrd.img -O &lt;directory of BIOS boot file for installing the system&gt;/initrd.img
# curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/images/pxeboot/TRANS.TBL -O &lt;directory of BIOS boot file for installing the system&gt;/TRANS.TBL
# curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/images/pxeboot/vmlinuz -O &lt;directory of BIOS boot file for installing the system&gt;/vmlinuz</code></pre>



<p>如果是 openSUSE &amp; SLE 的话则拷贝 linux 文件和 initrd 文件：</p>



<pre class="wp-block-code"><code># curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/boot/x86_64/loader/linux -O &lt;directory of BIOS boot file for installing the system&gt;/linux
# curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/boot/x86_64/loader/initrd -O &lt;directory of BIOS boot file for installing the system&gt;/initrd</code></pre>



<h4 id="2-2-2-2-拷贝安装镜像里的-efi-安装引导文件到存放-efi-安装引导文件的目录">2.2.2.2 拷贝安装镜像里的 EFI 安装引导文件到存放 EFI 安装引导文件的目录</h4>



<p>如果是 Rocky Linux &amp; RHEL 的话则拷贝 initrd.img 文件、TRANS.TBL 文件和 vmlinuz 文件：</p>



<pre class="wp-block-code"><code># curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/images/pxeboot/initrd.img -O &lt;directory of EFI boot file for installing the system&gt;/initrd.img
# curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/images/pxeboot/TRANS.TBL -O &lt;directory of EFI boot file for installing the system&gt;/TRANS.TBL
# curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/images/pxeboot/vmlinuz -O &lt;directory of EFI boot file for installing the system&gt;/vmlinuz</code></pre>



<p>如果是 openSUSE &amp; SLE 的话则拷贝 linux 文件和 initrd 文件：</p>



<pre class="wp-block-code"><code># curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/boot/x86_64/loader/linux -O &lt;directory of EFI boot file for installing the system&gt;/linux
# curl &lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/boot/x86_64/loader/initrd -O &lt;directory of EFI boot file for installing the system&gt;/initrd</code></pre>



<h4 id="2-3-准备系统安装配置文件2-3-1-进入到用于存放系统安装配置文件的目录">2.3 准备系统安装配置文件<br>2.3.1 进入到用于存放系统安装配置文件的目录</h4>



<pre class="wp-block-code"><code># cd &lt;directory of profile for installing the system&gt;</code></pre>



<p>（注意：进入到用于存放系统安装配置文件的目录必须要放在能够实现 PXE 安装时网络共享的目录里（例如：通过 httpd 服务进行网络共享））</p>



<h4 id="2-3-2-创建系统安装配置文件2-3-2-1-创建-bios-系统安装配置文件">2.3.2 创建系统安装配置文件<br>2.3.2.1 创建 BIOS 系统安装配置文件</h4>



<p>如果是 Rocky Linux &amp; RHEL 的话</p>



<pre class="wp-block-code"><code># vim &lt;BIOS system installation profile&gt;</code></pre>



<p>（步骤略）</p>



<p>（<br>补充：<br>1) 如果是 Rocky Linux &amp; RHEL 的话系统安装配置文件是 CFG 文件，文件名最好以 .cfg 后缀结尾<br>2) 如果是 openSUSE &amp; SLE 的话系统安装配置文件是 XML 文件，文件名最好以 .xml 后缀结尾<br>）</p>



<h4 id="2-3-2-2-创建-efi-系统安装配置文件">2.3.2.2 创建 EFI 系统安装配置文件</h4>



<pre class="wp-block-code"><code># vim &lt;EFI system installation profile&gt;</code></pre>



<p>（步骤略）</p>



<p>（<br>补充：<br>1) 如果是 Rocky Linux &amp; RHEL 的话系统安装配置文件是 CFG 文件，文件名最好以 .cfg 后缀结尾<br>2) 如果是 openSUSE &amp; SLE 的话系统安装配置文件是 XML 文件，文件名最好以 .xml 后缀结尾<br>）</p>



<h4 id="2-3-3-设置系统安装配置文件的权限2-3-3-1-设置-bios-系统安装配置文件的权限">2.3.3 设置系统安装配置文件的权限<br>2.3.3.1 设置 BIOS 系统安装配置文件的权限</h4>



<pre class="wp-block-code"><code># chmod 755 &lt;BIOS system installation profile&gt;</code></pre>



<h4 id="2-3-3-2-设置-efi-系统安装配置文件的权限">2.3.3.2 设置 EFI 系统安装配置文件的权限</h4>



<pre class="wp-block-code"><code># chmod 755 &lt;EFI system installation profile&gt;</code></pre>



<h4 id="2-4-修改系统安装菜单文件-pxelinux-cfg2-4-1-修改-bios-系统安装菜单文件-pxelinux-cfg">2.4 修改系统安装菜单文件 pxelinux.cfg<br>2.4.1 修改 BIOS 系统安装菜单文件 pxelinux.cfg</h4>



<pre class="wp-block-code"><code># vim &lt;directory of file for BIOS system installation menu&gt;/pxelinux.cfg</code></pre>



<p>如果是 Rocky Linux &amp; RHEL 的话，添加以下内容：</p>



<pre class="wp-block-code"><code>......
label Rocky Linux or RHEL
  menu label ^Installation Rocky Linux or RHEL
  kernel &lt;relative directory of pxelinux.cfg of BIOS boot file for installing the system&gt;/vmlinuz
  append initrd=/&lt;relative directory of pxelinux.cfg of BIOS boot file for installing the system&gt;/initrd.img ks=&lt;The URL of the network share when PXE installing&gt;/&lt;BIOS system installation profile&gt;</code></pre>



<p>（注意：这里的 vmlinuz 文件和 initrd.im 文件的位置要写 pxelinux.cfg 文件的相对路径）</p>



<p>如果是 openSUSE &amp; SLE 的话，添加以下内容：</p>



<pre class="wp-block-code"><code>......
label openSUSE or SLE
  menu label ^Installation openSUSE or SLE
  kernel &lt;relative directory of pxelinux.cfg of BIOS boot file for installing the system&gt;/linux
  append initrd=&lt;relative directory of pxelinux.cfg of BIOS boot file for installing the system&gt;/initrd splash=silent showopts install=&lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/ autoyast=&lt;The URL of the network share when PXE installing&gt;/&lt;BIOS system installation profile&gt;</code></pre>



<p>（注意：这里的 linux 文件和 initrd 文件的位置要写 pxelinux.cfg 文件的相对路径）</p>



<p>（注意：用于存放 BIOS 系统安装菜单文件的目录必须要放在能够实现 TFPT 网络共享的目录里）</p>



<h4 id="2-4-2-修改-efi-系统安装菜单文件-grub-cfg">2.4.2 修改 EFI 系统安装菜单文件 grub.cfg</h4>



<pre class="wp-block-code"><code># vim &lt;directory of file for EFI system installation menu&gt;/grub.cfg</code></pre>



<p>如果是 Rocky Linux &amp; RHEL 的话，添加以下内容：</p>



<pre class="wp-block-code"><code>......
label Rocky Linux or RHEL
  menu label ^Installation Rocky Linux or RHEL
  kernel &lt;relative directory of pxelinux.cfg of EFI boot file for installing the system&gt;/vmlinuz
  append initrd=/&lt;relative directory of pxelinux.cfg of EFI boot file for installing the system&gt;/initrd.img ks=&lt;The URL of the network share when PXE installing&gt;/&lt;EFI system installation profile&gt;</code></pre>



<p>（注意：这里的 vmlinuz 文件和 initrd.im 文件的位置要写 pxelinux.cfg 文件的相对路径）</p>



<p>如果是 openSUSE &amp; SLE 的话，添加以下内容：</p>



<pre class="wp-block-code"><code>......
label openSUSE or SLE
  menu label ^Installation openSUSE or SLE
  kernel &lt;relative directory of pxelinux.cfg of EFI boot file for installing the system&gt;/linux
  append initrd=&lt;relative directory of pxelinux.cfg of EFI boot file for installing the system&gt;/initrd splash=silent showopts install=&lt;The URL of the network share when PXE installing&gt;/&lt;directory of data for installing the system&gt;/ autoyast=&lt;The URL of the network share when PXE installing&gt;/&lt;EFI system installation profile&gt;</code></pre>



<p>（注意：这里的 linux 文件和 initrd 文件的位置要写 pxelinux.cfg 文件的相对路径）</p>



<p>（注意：用于存放 EFI 系统安装菜单文件的目录必须要放在能够实现 TFPT 网络共享的目录里）</p>



<h4 id="步骤三-取消挂载安装镜像-1">步骤三：取消挂载安装镜像</h4>



<pre class="wp-block-code"><code># umount &lt;directory for mounting the image&gt;</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[STEP] Red Hat Satellite client register</title>
		<link>https://eternalcenter-may-1-2022.github.io/red-hat-satellite-client-register/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 18 Jan 2022 14:41:36 +0000</pubDate>
				<category><![CDATA[English (英文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21287</guid>

					<description><![CDATA[Step One: Add domain name resolution into /etc/hosts Add the following: Step Two: Install katello-ca-consumer-latest.noarch.rpm2.1 Download katello-ca-consumer-latest.noarch.rpm 2.2 Install katello-ca-consumer-latest.noarch.rpm Step Three: Register to Red Hat Satellite Server Step Four: Install katello-host-tools, katello-host-tools-tracer and katello-agent4.1 Enable rhel-*-satellite-tools-*-rpms repo or satellite-tools-*-rhel-*-rpms4.1.1 For RHEL 7 4.1.2 For RHEL 8 4.2 Install katello-host-tools, katello-host-tools-tracer and katello-agent Step Five: &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/red-hat-satellite-client-register/" class="more-link">Continue reading<span class="screen-reader-text"> "[STEP] Red Hat Satellite client register"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4>Step One: Add domain name resolution into /etc/hosts</h4>



<pre class="wp-block-code"><code># vim /etc/hosts</code></pre>



<p>Add the following:</p>



<pre class="wp-block-code"><code>......
&lt;Redhat Satellite IP address&gt; &lt;Redhat Satellite Server FQDN&gt;</code></pre>



<h4>Step Two: Install katello-ca-consumer-latest.noarch.rpm<br>2.1 Download katello-ca-consumer-latest.noarch.rpm</h4>



<pre class="wp-block-code"><code># curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://&lt;Redhat/ Satellite Server FQDN&gt;/pub/katello-ca-consumer-latest.noarch.rpm</code></pre>



<h4>2.2 Install katello-ca-consumer-latest.noarch.rpm</h4>



<pre class="wp-block-code"><code># yum -y localinstall katello-ca-consumer-latest.noarch.rpm</code></pre>



<h4>Step Three: Register to Red Hat Satellite Server</h4>



<pre class="wp-block-code"><code># subscription-manager register --org="&lt;organization&gt;" --activationkey="&lt;activation key&gt;"</code></pre>



<h4>Step Four: Install katello-host-tools, katello-host-tools-tracer and katello-agent<br>4.1 Enable rhel-*-satellite-tools-*-rpms repo or satellite-tools-*-rhel-*-rpms<br>4.1.1 For RHEL 7</h4>



<pre class="wp-block-code"><code># subscription-manager repos --enable=rhel-\*-satellite-tools-\*-rpms</code></pre>



<h4>4.1.2 For RHEL 8</h4>



<pre class="wp-block-code"><code># subscription-manager repos --enable=satellite-tools-\*-rhel-\*-rpms
# subscription-manager repos --disable=satellite-tools-\*-rhel-\*-eus-rpms</code></pre>



<h4>4.2 Install katello-host-tools, katello-host-tools-tracer and katello-agent</h4>



<pre class="wp-block-code"><code># yum -y install katello-host-tools; yum -y install katello-host-tools-tracer; yum -y install katello-agent</code></pre>



<h4>Step Five: Check<br>5.1 Check registration information</h4>



<pre class="wp-block-code"><code># subscription-manager identity</code></pre>



<h4>5.2 Check license</h4>



<pre class="wp-block-code"><code># subscription-manager list --consumed</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Red Hat Satellite Server 客户端注册的取消</title>
		<link>https://eternalcenter-may-1-2022.github.io/red-hat-satellite-server-client-unregister/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 18 Jan 2022 13:54:51 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21280</guid>

					<description><![CDATA[步骤一：取消 Red Hat Satellite Server 客户端的注册 步骤二：清理 Red Hat Satellite Server 客户端的注册信息]]></description>
										<content:encoded><![CDATA[
<h4>步骤一：取消 Red Hat Satellite Server 客户端的注册</h4>



<pre class="wp-block-code"><code># subscription-manager unregister</code></pre>



<h4>步骤二：清理 Red Hat Satellite Server 客户端的注册信息 </h4>



<pre class="wp-block-code"><code># subscription-manager clean</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] GitHub 代码的更新 （令牌版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/github-push-token/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 01 Jan 2022 13:33:23 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=20763</guid>

					<description><![CDATA[步骤目录： 步骤一：在 GitHub 官网上生成令牌1.1 在 https://github.com/ 上登录或注册 GitHub 用户1.2 在 GitHub 上创建仓库1.3 在 GitHub 官网上生成令牌1.4 复制生成的令牌 步骤二：更新 GitHub 代码2.1 进入有代码需要更新的目录2.2 初始化 Git 环境2.3 添加需要更新的代码2.4 提交刚刚的添加2.5 创建或选择代码库的分支2.6 添加 GitHub 源2.7 通过令牌设置 GitHub 源2.8 将代码更新至 GitHub 具体的操作步骤： 步骤一：在 GitHub 官网上生成令牌1.1 在 https://github.com/ 上登录或注册 GitHub 用户 （步骤略） 1.2 在 GitHub 上创建仓库 右上角 + &#8211;&#62; New repository &#8211;&#62; 填写 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/github-push-token/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] GitHub 代码的更新 （令牌版）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="步骤目录">步骤目录：</h2>



<h4 id="步骤一-在-github-官网上生成令牌-1-1-在-https-github-com-上登录或注册-github-用户-1-2-在-github-上创建仓库-1-3-在-github-官网上生成令牌-1-4-复制生成的令牌">步骤一：在 GitHub 官网上生成令牌<br>1.1 在 https://github.com/ 上登录或注册 GitHub 用户<br>1.2 在 GitHub 上创建仓库<br>1.3 在 GitHub 官网上生成令牌<br>1.4 复制生成的令牌</h4>



<h4 id="步骤二-更新-github-代码-2-1-进入有代码需要更新的目录-2-2-初始化-git-环境-2-3-添加需要更新的代码-2-4-提交刚刚的添加-2-5-创建或选择代码库的分支-2-6-添加-github-源-2-7-通过令牌设置-github-源-2-8-将代码更新至-github">步骤二：更新 GitHub 代码<br>2.1 进入有代码需要更新的目录<br>2.2 初始化 Git 环境<br>2.3 添加需要更新的代码<br>2.4 提交刚刚的添加<br>2.5 创建或选择代码库的分支<br>2.6 添加 GitHub 源<br>2.7 通过令牌设置 GitHub 源<br>2.8 将代码更新至 GitHub</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="步骤一-在-github-官网上生成令牌-1-1-在-https-github-com-上登录或注册-github-用户">步骤一：在 GitHub 官网上生成令牌<br>1.1 在 https://github.com/ 上登录或注册 GitHub 用户</h4>



<p>（步骤略）</p>



<h4 id="1-2-在-github-上创建仓库">1.2 在 GitHub 上创建仓库</h4>



<p>右上角 + &#8211;&gt; New repository &#8211;&gt; 填写 Repository name &#8211;&gt; 勾选 Public &#8211;&gt; Create repository</p>



<p>（注意：只有当要使用的仓库还没有创建时才需要进行此步骤）</p>



<h4 id="1-3-在-github-官网上生成令牌">1.3 在 GitHub 官网上生成令牌</h4>



<p>右上角的头像 &#8211;&gt; Settings &#8211;&gt; Developer settings &#8211;&gt; Personal access tokens &#8211;&gt; Generate new token &#8211;&gt; 勾选需要的 scopes &#8211;&gt; Generate token</p>



<h4 id="1-4-复制生成的令牌">1.4 复制生成的令牌</h4>



<p>（步骤略）</p>



<h4 id="步骤二-更新-github-代码-2-1-进入有代码需要更新的目录">步骤二：更新 GitHub 代码<br>2.1 进入有代码需要更新的目录</h4>



<pre class="wp-block-code"><code># cd github</code></pre>



<p>（补充：这里以进入 github 目录为例）</p>



<h4 id="2-2-初始化-git-环境">2.2 初始化 Git 环境</h4>



<pre class="wp-block-code"><code># git init</code></pre>



<h4 id="2-3-添加需要更新的代码">2.3 添加需要更新的代码</h4>



<pre class="wp-block-code"><code># git add *</code></pre>



<p>（补充：这里以添加当前目录下的所有文件为例）</p>



<h4 id="2-4-提交刚刚的添加">2.4 提交刚刚的添加</h4>



<pre class="wp-block-code"><code># git commit -m "last commit"</code></pre>



<p>（补充：这里以提交时添加 “last commit” 备注为例）</p>



<h4 id="2-5-创建或选择代码库的分支">2.5 创建或选择代码库的分支</h4>



<pre class="wp-block-code"><code># git branch -M main</code></pre>



<p>（补充：这里以创建或选择库里的 main 分支为例）</p>



<h4 id="2-6-添加-github-源">2.6 添加 GitHub 源</h4>



<pre class="wp-block-code"><code># git remote add origin git@github.com:eternalcenter-now/eternalcenter-now.github.io</code></pre>



<p>（补充：这里以添加 GitHub 的 eternalcenter-now 用户的 eternalcenter-now.github.io 库为例）</p>



<p>（注意：这里的 eternalcenter-now 用户和 eternalcenter-now.github.io 库是指在 1.1、1.2 上创建的用户和库）</p>



<h4 id="2-7-通过令牌设置-github-源">2.7 通过令牌设置 GitHub 源</h4>



<pre class="wp-block-code"><code># git remote set-url origin https://gafafhp_Nfaodfwiixma8hPpds4e6asdflim@github.com/eternalcenter-now/eternalcenter-now.github.io</code></pre>



<p>（补充：这里以使用 GitHub 的 gafafhp_Nfaodfwiixma8hPpds4e6asdflim 令牌、eternalcenter-now 用户的 eternalcenter-now.github.io 库为例）</p>



<p>（注意：这里的 eternalcenter-now 用户、eternalcenter-now.github.io 库和 gafafhp_Nfaodfwiixma8hPpds4e6asdflim 令牌是指在 1.1、1.2、1.3 上创建的用户、库和生成的令牌）</p>



<h4 id="2-8-将代码更新至-github">2.8 将代码更新至 GitHub</h4>



<pre class="wp-block-code"><code># git push -u origin main</code></pre>



<p>（补充：这里以将代码更新至 main 分支为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 将同目录下最新的某个目录里的所有文件替换到 GitHub 库里 （Git LFS 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-github-replace-git-lfs/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 18 Dec 2021 13:44:56 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Backup (备份)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=19851</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里作用：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里 使用方法：1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本 脚本分割线里的变量：1. directory=download-eternalcenter #本地的缓冲目录2. gituser=mingyuzhu #GitHub 用户3. gitemail=mingyu.zhu@eternalcenter.com #GitHub 邮箱4. gitrepository=download-eternalcenter #GitHub 库5. gitbranch=’master’ #GitHub 库的分支6. backupfile=all #备份后的文件7. keyword=clone #同目录下要备份目录名称的关键字 注意：需要提前安装 git 和 git-lfs，注册 GitHub，创建相应的 GitHub 库，并且创建和设置了对应的 ssh 密钥 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里<br>作用：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里</p>



<p>使用方法：<br>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本</p>



<p>脚本分割线里的变量：<br>1. directory=download-eternalcenter #本地的缓冲目录<br>2. gituser=mingyuzhu #GitHub 用户<br>3. gitemail=mingyu.zhu@eternalcenter.com #GitHub 邮箱<br>4. gitrepository=download-eternalcenter #GitHub 库<br>5. gitbranch=’master’ #GitHub 库的分支<br>6. backupfile=all #备份后的文件<br>7. keyword=clone #同目录下要备份目录名称的关键字</p>



<p>注意：需要提前安装 git 和 git-lfs，注册 GitHub，创建相应的 GitHub 库，并且创建和设置了对应的 ssh 密钥</p>



<h2>脚本：</h2>



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

####################### Separator ########################

directory=download-eternalcenter
gituser=mingyuzhu
gitemail=mingyu.zhu@eternalcenter.com
gitrepository=download-eternalcenter
gitbranch='master'
backupfile=all
keyword=clone

####################### Separator ########################

backupdirectory=`ls -rtlh | grep $keyword | awk '{print $NF}' | tail -1`

sqlfile=`ls $backupdirectory | grep sql`
tarfile=`ls $backupdirectory | grep tar`

rm -rf $directory
mkdir -p $directory &amp;> /dev/null

echo $gituser
git config --global user.email "$gitemail"
git config --global user.name "$gituser"

rm -rf $directory
mkdir -p $directory &amp;> /dev/null
cd $directory
git init
git lfs install
git remote add origin git@github.com:$gituser/$gitrepository
git pull --rebase origin $gitbranch -f
git lfs track *
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch *' --prune-empty --tag-name-filter cat -- --all
git commit -m 'cleapup'
git push -u origin $gitbranch -f
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now

cd ..

rm -rf $directory
mkdir -p $directory &amp;> /dev/null
cd $directory
git init
git lfs install
git remote add origin git@github.com:$gituser/$gitrepository
git pull --rebase origin $gitbranch -f
git lfs track *
git rm *
git commit -m 'cleapup'

cd ../$backupdirectory/
tar -zcvf ../$directory/$backupfile.tar.gz *
cd ../$directory

git lfs track *
git add *
git status
git commit -m 'upload'
git push -u origin $gitbranch -f
cd ..</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 将同目录下最新的某个目录里的所有文件替换到 GitHub 库里</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-github-replace/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 18 Dec 2021 13:11:35 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Backup (备份)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=19836</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里作用：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里 使用方法：1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本 脚本分割线里的变量：1. directory=download-eternalcenter #本地的缓冲目录2. gituser=mingyuzhu #GitHub 用户3. gitemail=mingyu.zhu@eternalcenter.com #GitHub 邮箱4. gitrepository=download-eternalcenter #GitHub 库5. gitbranch=’master’ #GitHub 库的分支6. backupfile=all #备份后的文件7. keyword=clone #同目录下要备份目录名称的关键字 注意：需要提前安装 git，注册 GitHub，创建相应的 GitHub 库，并且创建和设置了对应的 ssh 密钥 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里<br>作用：将同目录下最新的某个目录里的所有文件替换到 GitHub 库里</p>



<p>使用方法：<br>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本</p>



<p>脚本分割线里的变量：<br>1. directory=download-eternalcenter #本地的缓冲目录<br>2. gituser=mingyuzhu #GitHub 用户<br>3. gitemail=mingyu.zhu@eternalcenter.com #GitHub 邮箱<br>4. gitrepository=download-eternalcenter #GitHub 库<br>5. gitbranch=’master’ #GitHub 库的分支<br>6. backupfile=all #备份后的文件<br>7. keyword=clone #同目录下要备份目录名称的关键字</p>



<p>注意：需要提前安装 git，注册 GitHub，创建相应的 GitHub 库，并且创建和设置了对应的 ssh 密钥</p>



<h2>脚本：</h2>



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

####################### Separator ########################

directory=download-eternalcenter
gituser=mingyuzhu
gitemail=mingyu.zhu@eternalcenter.com
gitrepository=download-eternalcenter
gitbranch='master'
backupfile=all
keyword=clone

####################### Separator ########################

backupdirectory=`ls -rtlh | grep $keyword | awk '{print $NF}' | tail -1`

sqlfile=`ls $backupdirectory | grep sql`
tarfile=`ls $backupdirectory | grep tar`

rm -rf $directory
mkdir -p $directory &amp;> /dev/null

echo $gituser
git config --global user.email "$gitemail"
git config --global user.name "$gituser"

rm -rf $directory
mkdir -p $directory &amp;> /dev/null
cd $directory
git init
git remote add origin git@github.com:$gituser/$gitrepository
git pull --rebase origin $gitbranch -f
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch *' --prune-empty --tag-name-filter cat -- --all
git commit -m 'cleapup'
git push -u origin $gitbranch -f
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now

cd ..

rm -rf $directory
mkdir -p $directory &amp;> /dev/null
cd $directory
git init
git remote add origin git@github.com:$gituser/$gitrepository
git pull --rebase origin $gitbranch -f
git rm *
git commit -m 'cleapup'

cd ../$backupdirectory/
tar -zcvf ../$directory/$backupfile.tar.gz *
cd ../$directory

git add *
git status
git commit -m 'upload'
git push -u origin $gitbranch -f
cd ..</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[排错] 解决 Red Hat Satellite 客户端注册成功但是无法获取软件源</title>
		<link>https://eternalcenter-may-1-2022.github.io/debug-red-hat-satellite-repo-restore/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 05 Nov 2021 12:36:40 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=18179</guid>

					<description><![CDATA[报错代码： 解决方法： 步骤一：确保 /etc/pki/product/69.pem 文件的存在，且权限和下面的一致 步骤二：确保 /etc/pki/product-default/69.pem 文件的存在，且权限和下面的一致 步骤三：如果步骤一和步骤二中的文件不存在3.1 可以从其他正常的客户端那里拷贝 （步骤略） 3.2 可以从以下网址里下载 https://access.redhat.com/labs/rhpc/]]></description>
										<content:encoded><![CDATA[
<h2>报错代码：</h2>



<pre class="wp-block-code"><code># subscription-manager repos
This system has no repositories available through subscriptions.</code></pre>



<h2>解决方法：</h2>



<h4>步骤一：确保 /etc/pki/product/69.pem 文件的存在，且权限和下面的一致</h4>



<pre class="wp-block-code"><code># ls -l /etc/pki/product/69.pem
-rw-r----- 1 root root 2159 Nov  5 17:36 /etc/pki/product/69.pem</code></pre>



<h4>步骤二：确保 /etc/pki/product-default/69.pem 文件的存在，且权限和下面的一致</h4>



<pre class="wp-block-code"><code># ls -l /etc/pki/product-default/69.pem
-rw-r----- 1 644 root 2159 Nov  5 17:36 /etc/pki/product-default/69.pem</code></pre>



<h4>步骤三：如果步骤一和步骤二中的文件不存在<br>3.1 可以从其他正常的客户端那里拷贝</h4>



<p>（步骤略）</p>



<h4>3.2 可以从以下网址里下载</h4>



<p class="has-text-align-left"><a href="https://access.redhat.com/labs/rhpc/" target="_blank" rel="noreferrer noopener">https://access.redhat.com/labs/rhpc/</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Red Hat Satellite 客户端 UUID 的显示</title>
		<link>https://eternalcenter-may-1-2022.github.io/red-hat-satellite-client-uuid/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 05 Nov 2021 12:34:23 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=18176</guid>

					<description><![CDATA[步骤一：规划拓扑1.1 服务器列表 Red Hat Satellite 服务端Red Hat Satellite 客户端 1.2 服务器列表简介 Red Hat Satellite 客户端注册到 Red Hat Satellite 服务端获取软件和补丁 步骤二：获取 Red Hat Satellite 客户端的 UUID （只在 Red Hat Satellite 客户端执行以下步骤） 步骤三：确认 Red Hat Satellite 客户端的 UUID 在服务端中出现 （只在 Red Hat Satellite 服务端执行以下步骤） 步骤四：显示 Red Hat Satellite 客户端在服务端中的具体信息 （只在 Red Hat Satellite 服务端执行以下步骤） （补充：在 vim 中查找对应客户端的 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/red-hat-satellite-client-uuid/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] Red Hat Satellite 客户端 UUID 的显示"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4 id="步骤一-规划拓扑-1-1-服务器列表">步骤一：规划拓扑<br>1.1 服务器列表</h4>



<p>Red Hat Satellite 服务端<br>Red Hat Satellite 客户端</p>



<h4 id="1-2-服务器列表简介">1.2 服务器列表简介</h4>



<p>Red Hat Satellite 客户端注册到 Red Hat Satellite 服务端获取软件和补丁</p>



<h4 id="步骤二-获取-red-hat-satellite-客户端的-uuid">步骤二：获取 Red Hat Satellite 客户端的 UUID</h4>



<p>（只在 Red Hat Satellite 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># subscription-manager facts --list | grep -i UUID</code></pre>



<h4 id="步骤三-确认-red-hat-satellite-客户端的-uuid-在服务端中出现">步骤三：确认 Red Hat Satellite 客户端的 UUID 在服务端中出现</h4>



<p>（只在 Red Hat Satellite 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># cat /var/log/rhsm/rhsm.log | grep -i &lt;client's UUID&gt;</code></pre>



<h4 id="步骤四-显示-red-hat-satellite-客户端在服务端中的具体信息">步骤四：显示 Red Hat Satellite 客户端在服务端中的具体信息</h4>



<p>（只在 Red Hat Satellite 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /var/log/rhsm/rhsm.log</code></pre>



<p>（补充：在 vim 中查找对应客户端的 UUID 并联系上下文进行显示）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Red Hat Satellite Virt-who 账号或密码的更换</title>
		<link>https://eternalcenter-may-1-2022.github.io/virt-who-change/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 05 Nov 2021 12:23:24 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Red Hat Satellite]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=18168</guid>

					<description><![CDATA[内容一：Virt-who 账号的作用 1) Virt-who 的作用是让 Red Hat Satellite 服务器能判断虚拟机在哪一台物理机上运行2) Redhat 的无限量 license 必须要让虚拟机在 license 所在的物理机上运行才能获得软件和补丁3) Virt-who 必须正常无限连 license 才能生效4) 而 Virt-who 账号的作用就是有权限登陆对应的平台，让 Red Hat Satellite 服务器能判断虚拟机在哪一台物理机上运行 内容二：修改 Virt-who 账号或密码2.1 进入 Virt-who 的配置页面 登陆 Satellite 网页 &#8211;&#62; 基础架构 &#8211;&#62; Virt-who Configurations &#8211;&#62; 对应的 Name 的编辑 2.2 修改账号和密码 （步骤略） 内容三：重新部署 Virt-who3.1 进入 Virt-who 的 Deploy 页面 登陆 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/virt-who-change/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] Red Hat Satellite Virt-who 账号或密码的更换"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4>内容一：Virt-who 账号的作用</h4>



<p>1) Virt-who 的作用是让 Red Hat Satellite 服务器能判断虚拟机在哪一台物理机上运行<br>2) Redhat 的无限量 license 必须要让虚拟机在 license 所在的物理机上运行才能获得软件和补丁<br>3) Virt-who 必须正常无限连 license 才能生效<br>4) 而 Virt-who 账号的作用就是有权限登陆对应的平台，让 Red Hat Satellite 服务器能判断虚拟机在哪一台物理机上运行</p>



<h4>内容二：修改 Virt-who 账号或密码<br>2.1 进入 Virt-who 的配置页面</h4>



<p>登陆 Satellite 网页  &#8211;&gt; 基础架构 &#8211;&gt; Virt-who Configurations &#8211;&gt; 对应的 Name 的编辑 </p>



<h4>2.2 修改账号和密码</h4>



<p>（步骤略）</p>



<h4>内容三：重新部署 Virt-who<br>3.1 进入 Virt-who 的 Deploy 页面 </h4>



<p>登陆 Satellite 网页 &#8211;&gt; 基础架构 &#8211;&gt; Virt-who Configurations &#8211;&gt; 对应的 Name &#8211;&gt; Deploy </p>



<h4>3.2 执行里面的步骤</h4>



<p>（步骤略）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[排错] 解决 Linux 发送邮件时报错 “send-mail: fatal: parameter inet_interfaces: no local interface found for ::1”</title>
		<link>https://eternalcenter-may-1-2022.github.io/send-mail-fatal-parameter-inet_interfaces-no-local-interface-found-for-1/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 27 Nov 2020 13:06:51 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=11791</guid>

					<description><![CDATA[报错代码： 解决方法： 步骤一：修改 postfix 的配置文件 将以下内容： 修改为： 步骤二：重启 postfix 服务]]></description>
										<content:encoded><![CDATA[
<h2>报错代码：</h2>



<pre class="wp-block-code"><code>send-mail: fatal: parameter inet_interfaces: no local interface found for ::1</code></pre>



<h2>解决方法：</h2>



<h4>步骤一：修改 postfix 的配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/postfix/main.cf</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
inet_interfaces = localhost
......
inet_protocols = all
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
inet_interfaces = all
......
inet_protocols = all
......</code></pre>



<h4>步骤二：重启 postfix 服务</h4>



<pre class="wp-block-code"><code># systemctl restart postfix</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[实验] Linux 远程日志的集中管理和分文件存储 （通过 Rsyslog 实现）</title>
		<link>https://eternalcenter-may-1-2022.github.io/rsyslog-set/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 12 Oct 2020 14:20:47 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Rsyslog]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System General Log (系统普通日志)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=11535</guid>

					<description><![CDATA[步骤目录： 步骤一：规划拓扑1.1 服务器列表1.2 服务器列表简介 步骤二：系统环境要求 步骤三：配置 rsyslog 服务端3.1 修改 rsyslog 配置文件的案例3.1.1 案例一3.1.2 案例二3.1.3 案例三3.1.4 案例四3.1.5 案例五3.2 重启 rsyslog 服务 步骤四：配置 rsyslog 客户端4.1 修改 rsyslog 客户端的案例4.2 重启 rsyslog 服务 步骤五：测试 rsyslog 服务5.1 在 rsyslog 客户端上发送日志5.2 在 rsyslog 服务端上显示日志 具体的操作步骤： 步骤一：规划拓扑1.1 服务器列表 rsyslog 服务端 IP 地址:192.168.0.11rsyslog 客户端 IP 地址:192.168.0.12 1.2 服务器列表简介 rsyslog 客户端将日志发送给 rsyslog 服务端，并实现分文件存储 步骤二：系统环境要求 1) &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/rsyslog-set/" class="more-link">Continue reading<span class="screen-reader-text"> "[实验] Linux 远程日志的集中管理和分文件存储 （通过 Rsyslog 实现）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="步骤目录">步骤目录：</h2>



<h4 id="步骤一-规划拓扑1-1-服务器列表1-2-服务器列表简介">步骤一：规划拓扑<br>1.1 服务器列表<br>1.2 服务器列表简介</h4>



<h4 id="步骤二-系统环境要求">步骤二：系统环境要求</h4>



<h4 id="步骤三-配置-rsyslog-服务端3-1-修改-rsyslog-配置文件的案例3-1-1-案例一3-1-2-案例二3-1-3-案例三3-1-4-案例四3-1-5-案例五3-2-重启-rsyslog-服务">步骤三：配置 rsyslog 服务端<br>3.1 修改 rsyslog 配置文件的案例<br>3.1.1 案例一<br>3.1.2 案例二<br>3.1.3 案例三<br>3.1.4 案例四<br>3.1.5 案例五<br>3.2 重启 rsyslog 服务</h4>



<h4 id="步骤四-配置-rsyslog-客户端4-1-修改-rsyslog-客户端的案例4-2-重启-rsyslog-服务">步骤四：配置 rsyslog 客户端<br>4.1 修改 rsyslog 客户端的案例<br>4.2 重启 rsyslog 服务</h4>



<h4 id="步骤五-测试-rsyslog-服务5-1-在-rsyslog-客户端上发送日志5-2-在-rsyslog-服务端上显示日志">步骤五：测试 rsyslog 服务<br>5.1 在 rsyslog 客户端上发送日志<br>5.2 在 rsyslog 服务端上显示日志</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="步骤一-规划拓扑1-1-服务器列表">步骤一：规划拓扑<br>1.1 服务器列表</h4>



<p>rsyslog 服务端 IP 地址:192.168.0.11<br>rsyslog 客户端 IP 地址:192.168.0.12</p>



<h4 id="1-2-服务器列表简介">1.2 服务器列表简介</h4>



<p>rsyslog 客户端将日志发送给 rsyslog 服务端，并实现分文件存储</p>



<h4 id="步骤二-系统环境要求">步骤二：系统环境要求</h4>



<p>1) 所有服务器的系统都需要是 CentOS 8 版本<br>2) 所有服务器都要关闭防火墙<br>3) 所有服务器都要关闭 SELinux<br>4) 需要按照拓扑图给对应的服务器配置好 IP 地址和主机名<br>5) 所有服务器都要可以相互 ping 通自己和对方的 IP 地址和主机名</p>



<h4 id="步骤三-配置-rsyslog-服务端3-1-修改-rsyslog-配置文件的案例3-1-1-案例一">步骤三：配置 rsyslog 服务端<br>3.1 修改 rsyslog 配置文件的案例<br>3.1.1 案例一</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将所有 rsyslog 客户端的日志存储在 rsyslog 服务端的 /var/log/message 里<br>）</p>



<h4 id="3-1-2-案例二">3.1.2 案例二</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/%HOSTNAME%.log"
*.* -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/ 下的一个文件里，此文件会以其所属系统名命名<br>）</p>



<h4 id="3-1-3-案例三">3.1.3 案例三</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/remotelog/%HOSTNAME%-%$YEAR%-%$MONTH%-%$DAY%-messages.log"
*.* -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/remotelog 下的一个文件里，此文件会以其创建时间和其所属系统名命名<br>）</p>



<h4 id="3-1-4-案例四">3.1.4 案例四</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/remotelog/%HOSTNAME%-%$YEAR%-%$MONTH%-%$DAY%-messages.log"
:fromhost-ip,!isequal,"127.0.0.1" -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/ 下的一个文件里，此文件会以其创建时间和其所属系统名命名<br>4) 此配置不会单独存储 rsyslog 服务端的日志<br>）</p>



<h4 id="3-1-5-案例五">3.1.5 案例五</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

$template DynFile,"/var/log/syslog/system-%HOSTNAME%/messages.log"
*.* -?DynFile
&amp; ~</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 此配置会将每个 rsyslog 客户端的日志单独存储在 /var/log/ 下某个目录的 messages 文件里，此目录会以其所属系统名命名<br>）</p>



<h4 id="3-2-重启-rsyslog-服务">3.2 重启 rsyslog 服务</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># systemctl restart rsyslog</code></pre>



<p>（<br>补充：<br>1) 使用 UDP 的 514 端口接收日志<br>2) 使用 TCP 的 514 端口接收日志<br>3) 需要在 3.1 修改 rsyslog 配置文件的案例中任选其一完成后在执行此步骤<br>）</p>



<h4 id="步骤四-配置-rsyslog-客户端4-1-修改-rsyslog-客户端的案例">步骤四：配置 rsyslog 客户端<br>4.1 修改 rsyslog 客户端的案例</h4>



<p>（只在 rsyslog 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rsyslog.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
*.emerg;*.alert;*.crit;*.err;*.warning;*.notice;*.info  @192.168.0.11</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
*.emerg;*.alert;*.crit;*.err;*.warning;*.notice;*.info  @@192.168.0.11</code></pre>



<p>（<br>补充：<br>1) 这里的 192.168.0.11 是指 rsyslog 服务端的 IP 地址<br>2) IP 地址前一个 “@” 符后是指使用 UDP 端口 514 传输日志<br>3) IP 地址前两个 “@” 符后是指使用 TCP 端口 514 传输日志<br>）</p>



<h4 id="4-2-重启-rsyslog-服务">4.2 重启 rsyslog 服务</h4>



<p>（只在 rsyslog 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># systemctl restart rsyslog</code></pre>



<h4 id="步骤五-测试-rsyslog-服务5-1-在-rsyslog-客户端上发送日志">步骤五：测试 rsyslog 服务<br>5.1 在 rsyslog 客户端上发送日志</h4>



<p>（只在 rsyslog 客户端执行以下步骤）</p>



<pre class="wp-block-code"><code># logger "This is our test log"</code></pre>



<p>（补充：这里以发送 This is our test log 信息为例）</p>



<h4 id="5-2-在-rsyslog-服务端上显示日志">5.2 在 rsyslog 服务端上显示日志</h4>



<p>（只在 rsyslog 服务端执行以下步骤）</p>



<pre class="wp-block-code"><code># cat /var/log/* | grep test</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] 远程虚拟化平台的搭建</title>
		<link>https://eternalcenter-may-1-2022.github.io/remote-virtual-platform/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 26 Sep 2020 10:10:37 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Cloud Computing (云计算)]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Computer (系统电脑)]]></category>
		<category><![CDATA[System Computer & System Hardware & System Installation & System Upgradation (系统电脑 & 系统硬件 & 系统安装 & 系统升级)]]></category>
		<category><![CDATA[Virtualization (虚拟化)]]></category>
		<category><![CDATA[VNC]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=10587</guid>

					<description><![CDATA[步骤目录： 步骤一：规划拓扑1.1 电脑列表1.2 服务器列表简介 步骤二：给电脑安装 CentOS 8.2 系统 步骤三：安装图形系统桌面 步骤四：安装中文输入法4.1 安装中文库4.2 确认中文库已经安装4.3 安装中文输入法 步骤五：创建用户5.1 创建用户5.2 给用户设置密码 步骤六：增加 CentOS 8.2 系统的稳定性6.1 延长看门狗喂狗间隔以减少系统被软锁出现 softlockup 的几率6.1.1 临时延长看门狗喂狗间隔的时间6.1.2 永久延长看门狗喂狗间隔的时间6.1.2.1 添加延长看门狗喂狗间隔的设置6.1.2.2 让添加延长看门狗喂狗间隔的设置生效6.1.3 让 softlockup 触发后直接宕机6.2 禁止图形系统桌面的 DNS 和路由以避免系统崩溃6.2.1 添加禁止图形系统桌面的 DNS 和路由的设置6.2.2 让禁止图形系统桌面的 DNS 和路由的设置生效6.3 禁止图形系统界面自动黑屏或自动挂起6.4 让 SSH 联接永久不超时6.4.1 让 SSH 服务端的连接不超时6.4.2 让用户登陆永不超时6.4.2.1 在系统文件里添加让用户登陆永不超时的设置6.4.2.2 让用户登陆永不超时的设置立刻生效6.5 删除不需要的软件包以避免 CPU 占用过高而崩溃（选做） 步骤七：搭建虚拟化平台 步骤八：实现文件共享8.1 安装 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/remote-virtual-platform/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] 远程虚拟化平台的搭建"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="步骤目录">步骤目录：</h2>



<h4 id="步骤一-规划拓扑1-1-电脑列表1-2-服务器列表简介">步骤一：规划拓扑<br>1.1 电脑列表<br>1.2 服务器列表简介</h4>



<h4 id="步骤二-给电脑安装-centos-8-2-系统">步骤二：给电脑安装 CentOS 8.2 系统</h4>



<h4 id="步骤三-安装图形系统桌面">步骤三：安装图形系统桌面</h4>



<h4 id="步骤四-安装中文输入法4-1-安装中文库4-2-确认中文库已经安装4-3-安装中文输入法">步骤四：安装中文输入法<br>4.1 安装中文库<br>4.2 确认中文库已经安装<br>4.3 安装中文输入法</h4>



<h4 id="步骤五-创建用户5-1-创建用户5-2-给用户设置密码">步骤五：创建用户<br>5.1 创建用户<br>5.2 给用户设置密码</h4>



<h4 id="步骤六-增加-centos-8-2-系统的稳定性6-1-延长看门狗喂狗间隔以减少系统被软锁出现-softlockup-的几率6-1-1-临时延长看门狗喂狗间隔的时间6-1-2-永久延长看门狗喂狗间隔的时间6-1-2-1-添加延长看门狗喂狗间隔的设置6-1-2-2-让添加延长看门狗喂狗间隔的设置生效6-1-3-让-softlockup-触发后直接宕机6-2-禁止图形系统桌面的-dns-和路由以避免系统崩溃6-2-1-添加禁止图形系统桌面的-dns-和路由的设置6-2-2-让禁止图形系统桌面的-dns-和路由的设置生效6-3-禁止图形系统界面自动黑屏或自动挂起6-4-让-ssh-联接永久不超时6-4-1-让-ssh-服务端的连接不超时6-4-2-让用户登陆永不超时6-4-2-1-在系统文件里添加让用户登陆永不超时的设置6-4-2-2-让用户登陆永不超时的设置立刻生效6-5-删除不需要的软件包以避免-cpu-占用过高而崩溃-选做">步骤六：增加 CentOS 8.2 系统的稳定性<br>6.1 延长看门狗喂狗间隔以减少系统被软锁出现 softlockup 的几率<br>6.1.1 临时延长看门狗喂狗间隔的时间<br>6.1.2 永久延长看门狗喂狗间隔的时间<br>6.1.2.1 添加延长看门狗喂狗间隔的设置<br>6.1.2.2 让添加延长看门狗喂狗间隔的设置生效<br>6.1.3 让 softlockup 触发后直接宕机<br>6.2 禁止图形系统桌面的 DNS 和路由以避免系统崩溃<br>6.2.1 添加禁止图形系统桌面的 DNS 和路由的设置<br>6.2.2 让禁止图形系统桌面的 DNS 和路由的设置生效<br>6.3 禁止图形系统界面自动黑屏或自动挂起<br>6.4 让 SSH 联接永久不超时<br>6.4.1 让 SSH 服务端的连接不超时<br>6.4.2 让用户登陆永不超时<br>6.4.2.1 在系统文件里添加让用户登陆永不超时的设置<br>6.4.2.2 让用户登陆永不超时的设置立刻生效<br>6.5 删除不需要的软件包以避免 CPU 占用过高而崩溃（选做）</h4>



<h4 id="步骤七-搭建虚拟化平台">步骤七：搭建虚拟化平台</h4>



<h4 id="步骤八-实现文件共享8-1-安装-samba-服务8-2-配置-samba-服务的配置文件8-3-设置-samba-服务共享用户8-3-1-给-samba-服务共享用户设置-samba-共享密码8-3-2-显示-samba-服务共享用户是否可用8-4-生成-samba-服务共享目录8-4-1-生成-samba-服务共享目录8-4-2-给-samba-服务共享目录设置权限8-4-3-给-samba-服务共享目录设置所属主和所属组8-4-4-给-samba-服务共享目录设置-selinux-标签8-4-5-让-samba-服务共享目录上的-selinux-标签立刻生效8-5-启动-samba-服务并设置为开机自动启动8-6-在系统防火墙开放-samba-的端口8-6-1-在系统防火墙开放-samba-的端口8-6-2-让系统防火墙重新加载">步骤八：实现文件共享<br>8.1 安装 Samba 服务<br>8.2 配置 Samba 服务的配置文件<br>8.3 设置 Samba 服务共享用户<br>8.3.1 给 Samba 服务共享用户设置 Samba 共享密码<br>8.3.2 显示 Samba 服务共享用户是否可用<br>8.4 生成 Samba 服务共享目录<br>8.4.1 生成 Samba 服务共享目录<br>8.4.2 给 Samba 服务共享目录设置权限<br>8.4.3 给 Samba 服务共享目录设置所属主和所属组<br>8.4.4 给 Samba 服务共享目录设置 selinux 标签<br>8.4.5 让 Samba 服务共享目录上的 selinux 标签立刻生效<br>8.5 启动 Samba 服务并设置为开机自动启动<br>8.6 在系统防火墙开放 Samba 的端口<br>8.6.1 在系统防火墙开放 Samba 的端口<br>8.6.2 让系统防火墙重新加载</h4>



<h4 id="步骤九-实现远程桌面9-1-安装-vnc-服务9-2-设置-vnc-服务共享用户9-2-1-进入用户9-2-2-给-vnc-服务共享用户设置-vnc-远程密码9-2-3-退出用户9-3-启动-vnc-并设置为开机自动启动9-3-1-创建开启-vnc-的脚本-vnc-sh9-3-1-1-进入到用户9-3-1-2-创建开启-vnc-的脚本-vnc-sh9-3-1-3-退出用户9-3-2-执行开启-vnc-的脚本9-3-2-1-开机执行开启-vnc-的脚本9-3-2-1-1-配置开机执行的文件9-3-2-1-2-给开机执行的文件执行权限9-3-2-2-定期执行开启-vnc-的脚本9-3-2-2-1-进入到用户9-3-2-2-2-配置定期执行的文件9-3-2-2-3-退出用户">步骤九：实现远程桌面<br>9.1 安装 vnc 服务<br>9.2 设置 VNC 服务共享用户<br>9.2.1 进入用户<br>9.2.2 给 VNC 服务共享用户设置 VNC 远程密码<br>9.2.3 退出用户<br>9.3 启动 VNC 并设置为开机自动启动<br>9.3.1 创建开启 VNC 的脚本 ~/vnc.sh<br>9.3.1.1 进入到用户<br>9.3.1.2 创建开启 VNC 的脚本 ~/vnc.sh<br>9.3.1.3 退出用户<br>9.3.2 执行开启 VNC 的脚本<br>9.3.2.1 开机执行开启 VNC 的脚本<br>9.3.2.1.1 配置开机执行的文件<br>9.3.2.1.2 给开机执行的文件执行权限<br>9.3.2.2 定期执行开启 VNC 的脚本<br>9.3.2.2.1 进入到用户<br>9.3.2.2.2 配置定期执行的文件<br>9.3.2.2.3 退出用户</h4>



<h4 id="步骤十-设置-ssh-内网穿透10-1-生成-ssh-密钥10-1-1-进入到用户10-1-2-生成-ssh-密钥10-1-3-退出用户10-2-实现无密钥-ssh10-2-1-进入到用户10-2-2-让电脑可以无密钥-ssh-vps10-2-3-让-vps-可以无密钥-ssh-自己10-2-4-让客户端可以远程-vps-和电脑10-2-5-退出用户10-3-建立电脑到-vps-的-ssh-隧道并设置为开机自启10-3-1-创建建立电脑到-vps-的-ssh-隧道的脚本-ssh-sh10-3-1-1-进入到用户10-3-1-2-创建建立电脑到-vps-的-ssh-隧道的脚本-ssh-sh10-3-1-3-退出用户10-3-2-执行电脑到-vps-的-ssh-隧道的脚本10-3-2-1-开机执行开启电脑到-vps-的-ssh-隧道的脚本10-3-2-1-1-配置开机执行的文件10-3-2-1-2-给开机执行的文件执行权限10-3-3-定期执行电脑到-vps-的-ssh-隧道的脚本10-3-3-1-进入到用户10-3-3-2-配置定期执行的文件10-3-3-3-退出用户10-4-建立-vps-的-ssh-隧道端口映射并设置为开机自启10-4-1-创建建立-vps-的-ssh-隧道端口映射的脚本10-4-1-1-进入到用户10-4-1-2-创建建立-vps-的-ssh-隧道端口映射的脚本10-4-1-3-退出用户10-4-2-执行电脑到-vps-的-ssh-隧道的脚本10-4-2-1-开机执行开启电脑到-vps-的-ssh-隧道的脚本10-4-2-1-1-配置开机执行的文件10-4-2-1-2-给开机执行的文件执行权限10-4-3-定期执行电脑到-vps-的-ssh-隧道的脚本10-4-3-1-进入到用户10-4-3-2-配置定期执行的文件10-4-4-退出用户10-4-5-打开外网-vps-对应端口的防火墙10-4-5-1-打开外网-vps-对应端口的防火墙10-4-5-2-让刚刚外网-vps-刚刚配置的防火墙生效">步骤十：设置 SSH 内网穿透<br>10.1 生成 SSH 密钥<br>10.1.1 进入到用户<br>10.1.2 生成 SSH 密钥<br>10.1.3 退出用户<br>10.2 实现无密钥 SSH<br>10.2.1 进入到用户<br>10.2.2 让电脑可以无密钥 SSH VPS<br>10.2.3 让 VPS 可以无密钥 SSH 自己<br>10.2.4 让客户端可以远程 VPS 和电脑<br>10.2.5 退出用户<br>10.3 建立电脑到 VPS 的 SSH 隧道并设置为开机自启<br>10.3.1 创建建立电脑到 VPS 的 SSH 隧道的脚本 ～/ssh.sh<br>10.3.1.1 进入到用户<br>10.3.1.2 创建建立电脑到 VPS 的 SSH 隧道的脚本 ～/ssh.sh<br>10.3.1.3 退出用户<br>10.3.2 执行电脑到 VPS 的 SSH 隧道的脚本<br>10.3.2.1 开机执行开启电脑到 VPS 的 SSH 隧道的脚本<br>10.3.2.1.1 配置开机执行的文件<br>10.3.2.1.2 给开机执行的文件执行权限<br>10.3.3 定期执行电脑到 VPS 的 SSH 隧道的脚本<br>10.3.3.1 进入到用户<br>10.3.3.2 配置定期执行的文件<br>10.3.3.3 退出用户<br>10.4 建立 VPS 的 SSH 隧道端口映射并设置为开机自启<br>10.4.1 创建建立 VPS 的 SSH 隧道端口映射的脚本<br>10.4.1.1 进入到用户<br>10.4.1.2 创建建立 VPS 的 SSH 隧道端口映射的脚本<br>10.4.1.3 退出用户<br>10.4.2 执行电脑到 VPS 的 SSH 隧道的脚本<br>10.4.2.1 开机执行开启电脑到 VPS 的 SSH 隧道的脚本<br>10.4.2.1.1 配置开机执行的文件<br>10.4.2.1.2 给开机执行的文件执行权限<br>10.4.3 定期执行电脑到 VPS 的 SSH 隧道的脚本<br>10.4.3.1 进入到用户<br>10.4.3.2 配置定期执行的文件<br>10.4.4 退出用户<br>10.4.5 打开外网 VPS 对应端口的防火墙<br>10.4.5.1 打开外网 VPS 对应端口的防火墙<br>10.4.5.2 让刚刚外网 VPS 刚刚配置的防火墙生效</h4>



<h4 id="步骤十一-加强-ssh-的安全性-选做-11-1-禁止-root-被-ssh-选做-11-2-禁止使用密码被-ssh-选做">步骤十一：加强 SSH 的安全性（选做）<br>11.1 禁止 root 被 SSH（选做）<br>11.2 禁止使用密码被 SSH（选做）</h4>



<h4 id="步骤十二-私有远程桌面和虚拟化平台的使用12-1-客户端-ssh-联接电脑的方法12-1-1-客户端和电脑不在同一内网时12-1-2-客户端和电脑在同一内网时12-2-客户端使用电脑虚拟化平台的的方法12-2-1-客户端和电脑不在同一内网时12-2-1-1-在客户端上联接电脑12-2-1-2-通过-ssh-开启虚拟化图形管理平台12-2-2-客户端和电脑在同一内网时12-2-2-1-在客户端上联接电脑12-2-2-2-通过-ssh-开启虚拟化图形管理平台12-3-客户端使用私有远程桌面的方法12-3-1-客户端和电脑不在同一内网时12-3-2-客户端和电脑在同一内网时12-4-客户端在内网和电脑互传数据的方法12-4-1-在-windows-图形客户端上和电脑互传数据的方法12-4-2-在-linux-图形客户端上和电脑互传数据的方法">步骤十二：私有远程桌面和虚拟化平台的使用<br>12.1 客户端 SSH 联接电脑的方法<br>12.1.1 客户端和电脑不在同一内网时<br>12.1.2 客户端和电脑在同一内网时<br>12.2 客户端使用电脑虚拟化平台的的方法<br>12.2.1 客户端和电脑不在同一内网时<br>12.2.1.1 在客户端上联接电脑<br>12.2.1.2 通过 ssh 开启虚拟化图形管理平台<br>12.2.2 客户端和电脑在同一内网时<br>12.2.2.1 在客户端上联接电脑<br>12.2.2.2 通过 ssh 开启虚拟化图形管理平台<br>12.3 客户端使用私有远程桌面的方法<br>12.3.1 客户端和电脑不在同一内网时<br>12.3.2 客户端和电脑在同一内网时<br>12.4 客户端在内网和电脑互传数据的方法<br>12.4.1 在 Windows 图形客户端上和电脑互传数据的方法<br>12.4.2 在 Linux 图形客户端上和电脑互传数据的方法</h4>



<h4 id="步骤十三-客户端直接使用公网-ip-地址联接电脑13-1-实现此步骤所需环境13-2-在路由器上将电脑上的-22-端口映射到路由器上的公网-ip-地址上-这样路由器上的公网-ip-地址就变成电脑的公网-ip-地址了13-3-将电脑的公网-ip-地址放到-vps-上13-3-1-将电脑的公网-ip-地址放到-vps-上的意义13-3-2-创建将电脑的公网-ip-地址放到-vps-上的脚本13-3-2-1-进入到用户用户13-3-2-2-创建将电脑的公网-ip-地址放到-vps-上的脚本13-3-2-3-退出用户用户13-3-3-执行将电脑的公网-ip-地址放到-vps-上的脚本13-3-3-1-进入到用户用户13-3-3-2-配置定期执行的文件13-3-3-3-退出用户用户13-4-通过-ddns-服务显示电脑的公网-ip13-4-1-通过-ddns-服务显示电脑的公网-ip13-4-2-有些-ddns-服务可以在网关路由器上设置-并且通过手机-app-显示现在的公网-ip-地址">步骤十三：客户端直接使用公网 IP 地址联接电脑<br>13.1 实现此步骤所需环境<br>13.2 在路由器上将电脑上的 22 端口映射到路由器上的公网 IP 地址上，这样路由器上的公网 IP 地址就变成电脑的公网 IP 地址了<br>13.3 将电脑的公网 IP 地址放到 VPS 上<br>13.3.1 将电脑的公网 IP 地址放到 VPS 上的意义<br>13.3.2 创建将电脑的公网 IP 地址放到 VPS 上的脚本<br>13.3.2.1 进入到用户用户<br>13.3.2.2 创建将电脑的公网 IP 地址放到 VPS 上的脚本<br>13.3.2.3 退出用户用户<br>13.3.3 执行将电脑的公网 IP 地址放到 VPS 上的脚本<br>13.3.3.1 进入到用户用户<br>13.3.3.2 配置定期执行的文件<br>13.3.3.3 退出用户用户<br>13.4 通过 DDNS 服务显示电脑的公网 IP<br>13.4.1 通过 DDNS 服务显示电脑的公网 IP<br>13.4.2 有些 DDNS 服务可以在网关路由器上设置，并且通过手机 APP 显示现在的公网 IP 地址</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="步骤一-规划拓扑1-1-电脑列表">步骤一：规划拓扑<br>1.1 电脑列表</h4>



<p>1) 一台可以联接公网的电脑<br>2) 一个 CentOS 8.2 系统的安装 U 盘<br>3) 一台可以联接公网并且有公网 IP 地址的 VPS<br>4) 一个可以联接公网并使用 SSH 和 VNC 的客户端</p>



<h4 id="1-2-服务器列表简介">1.2 服务器列表简介</h4>



<p>1) 电脑通过 SSH 建立联接到 VPS 的隧道，此操作会占用 VPS 的一个端口<br>2) VPS 通过 SSH 将联接电脑的隧道端口映射到一个新的端口<br>3) 客户端通过 SSH 联接到 VPS 映射出来的新端口，通过 SSH 或远程桌面使用虚拟化平台<br>4) 客户端和电脑如果在同一内网里则可以通过 Samba 互传数据</p>



<h4 id="步骤二-centos-8-2-系统的安装-u-盘给电脑安装系统">步骤二：CentOS 8.2 系统的安装 U 盘给电脑安装系统</h4>



<p>（只在电脑上执行以下步骤）<br>（步骤略）</p>



<p>（<br>补充：<br>安装系统时可选择以下选项：<br>1) 系统起动方式：BIOS<br>2) Keyboard：English(US)<br>3) Language Support：English(United States)<br>4) Time &amp; Date：Asia/ShangHai<br>5) Installation Source：Local media<br>6) Software Selection：Minial Install<br>7) Installation Destination：将主硬盘里的所有空间都分配给根分区<br>8) KDUMP：Kdump is disabled<br>9) Network &amp; Host Name：开启网络联接并设置好固定 DNS<br>10) SECURITY POLICY：No controller found<br>）</p>



<p>（这里以将 IP 地址设置为固定 IP 地址 192.168.0.1，DNS 设置为固定 DNS 8.8.8.8 为例）</p>



<h4 id="步骤三-安装图形系统桌面">步骤三：安装图形系统桌面</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># yum groupinstall -y "Server with GUI"</code></pre>



<h4 id="步骤四-安装中文输入法4-1-安装中文库">步骤四：安装中文输入法<br>4.1 安装中文库</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># yum -y install langpacks-zh_CN</code></pre>



<h4 id="4-2-确认中文库已经安装">4.2 确认中文库已经安装</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># locale -a</code></pre>



<h4 id="4-3-安装中文输入法">4.3 安装中文输入法</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># yum -y install ibus ibus-libpinyin</code></pre>



<h4 id="步骤五-创建用户用户5-1-创建用户用户">步骤五：创建用户用户<br>5.1 创建用户用户</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># useradd zhumingyu</code></pre>



<p>（补充：这里创建用户 zhumingyu 为例）</p>



<h4 id="5-2-给用户用户设置密码">5.2 给用户用户设置密码</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># passwd zhumingyu</code></pre>



<p>（补充：这里创建用户 zhumingyu 为例）</p>



<h4 id="步骤六-增加-centos-系统的稳定性6-1-延长看门狗喂狗间隔以减少系统被软锁出现-softlockup-的几率6-1-1-临时延长看门狗喂狗间隔的时间">步骤六：增加 CentOS 系统的稳定性<br>6.1 延长看门狗喂狗间隔以减少系统被软锁出现 softlockup 的几率<br>6.1.1 临时延长看门狗喂狗间隔的时间</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># sysctl -w kernel.watchdog_thresh=60</code></pre>



<h4 id="6-1-2-永久延长看门狗喂狗间隔的时间6-1-2-1-添加延长看门狗喂狗间隔的设置">6.1.2 永久延长看门狗喂狗间隔的时间<br>6.1.2.1 添加延长看门狗喂狗间隔的设置</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/sysctl.conf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
kernel.watchdog_thresh=60</code></pre>



<h4 id="6-1-2-2-让添加延长看门狗喂狗间隔的设置生效">6.1.2.2 让添加延长看门狗喂狗间隔的设置生效</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># sysctl -p</code></pre>



<h4 id="6-1-3-让-softlockup-触发后直接宕机">6.1.3 让 softlockup 触发后直接宕机</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># echo 1 &gt; /proc/sys/kernel/softlockup_panic</code></pre>



<h4 id="6-2-禁止图形系统桌面的-dns-和路由以避免系统崩溃6-2-1-添加禁止图形系统桌面的-dns-和路由的设置">6.2 禁止图形系统桌面的 DNS 和路由以避免系统崩溃<br>6.2.1 添加禁止图形系统桌面的 DNS 和路由的设置</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/sysconfig/network-scripts/ifcfg-enp9s0</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
PEERDNS=no
PEERROUTES=no</code></pre>



<p>（补充：这里的 ifcfg-enp9s0 是指网卡对应的配置文件，不同的网卡对应的配置文件不同，这里以网卡名 ifcfg-enp9s0 为例，需要给所有网卡添加此参数，这一步也可以在系统图形系统桌面上设置）</p>



<h4 id="6-2-2-让禁止图形系统桌面的-dns-和路由的设置生效">6.2.2 让禁止图形系统桌面的 DNS 和路由的设置生效</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># systemctl restart NetworkManager</code></pre>



<h4 id="6-3-禁止图形系统界面自动黑屏或自动挂起">6.3 禁止图形系统界面自动黑屏或自动挂起</h4>



<p>（只在电脑上执行以下步骤）</p>



<h4 id="6-4-让-ssh-联接永久不超时6-4-1-让-ssh-服务端的连接不超时">6.4 让 SSH 联接永久不超时<br>6.4.1 让 SSH 服务端的连接不超时</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/ssh/sshd_config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
#ClientAliveInterval 0
#ClientAliveCountMax 3
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
ClientAliveInterval 60
ClientAliveCountMax 525600
......</code></pre>



<p>（补充：这样设置会让 SSH 服务端每 60s 就会尝试连接一次客户端，如果 525600 次后没有回应，则断开）</p>



<h4 id="6-4-2-让用户登陆永不超时6-4-2-1-在系统文件里添加让用户登陆永不超时的设置">6.4.2 让用户登陆永不超时<br>6.4.2.1 在系统文件里添加让用户登陆永不超时的设置</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/bashrc</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
export TMOUT=0</code></pre>



<pre class="wp-block-code"><code># vim /etc/profile</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
export TMOUT=0</code></pre>



<h4 id="6-4-2-2-让用户登陆永不超时的设置立刻生效">6.4.2.2 让用户登陆永不超时的设置立刻生效</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># source /etc/bashrc
# source /etc/profile</code></pre>



<h4 id="6-5-删除不需要的软件包以避免-cpu-占用过高而崩溃-选做">6.5 删除不需要的软件包以避免 CPU 占用过高而崩溃（选做）</h4>



<p>（步骤略）</p>



<h4 id="步骤七-搭建虚拟化平台">步骤七：搭建虚拟化平台</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># yum -y install qemu-kvm libvirt-daemon libvirt-client libvirt-daemon-driver-qemu virt-install virt-manager virt-viewer virt-v2v</code></pre>



<h4 id="步骤八-实现文件共享8-1-安装-samba-服务">步骤八：实现文件共享<br>8.1 安装 Samba 服务</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># yum -y install samba
</code></pre>



<h4 id="8-2-配置-samba-服务的配置文件">8.2 配置 Samba 服务的配置文件</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/samba/smb.conf</code></pre>



<p>将全部内容修改如下：</p>



<pre class="wp-block-code"><code># See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

&#91;global]
workgroup = WORKGROUP
realm = zhumingyu
netbios name = zhumingyu
#encrypt passwords = yes
map to guest = NEVER
security = user
password server = *
name resolve order = bcast host
restrict anonymous = 2
#null passwords = no
#guest account = smb_nobody
#use spnego = yes
client use spnego = yes
server string = ""
host msdfs = no
msdfs root = no
domain master = no
preferred master = no
local master = no
os level = 0
browse list = no
browseable = no
dns proxy = no
wide links = no
public= no
guest ok = no
hosts deny = ALL EXCEPT 192.168.0.2

&#91;share]
valid users = zhumingyu
write list = zhumingyu
read list = zhumingyu
path = /share
guest ok = no
read only = no
browseable = no
writable = yes
public = no
create mask = 0755
directory mask = 0755</code></pre>



<p>（<br>补充：<br>1) 这里以 Samba 服务器的 IP 地址是 192.168.0.1 为例<br>2) 这里的 workgroup = WORKGROUP 是让 Samba 服务属于 WORKGROUP<br>3) 这里的 hosts deny = ALL EXCEPT 192.168.0.2 是只让客户端 192.168.0.3 能够访问服务端的 Samba<br>4) 这里的 sharetest 是这个 Samba 挂载点的名称，挂载这个挂载点的格式就是：//192.168.0.1/share<br>5) 这里的 valid users = zhumingyu 是 Samba 服务共享用户需要手动生成<br>6) 这里的 path = /share 是 Samba 服务共享目录需要手动生成<br>）</p>



<h4 id="8-3-设置-samba-服务共享用户8-3-1-给-samba-服务共享用户设置-samba-共享密码">8.3 设置 Samba 服务共享用户<br>8.3.1 给 Samba 服务共享用户设置 Samba 共享密码</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># smbpasswd -a zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="8-3-2-显示-samba-服务共享用户是否可用">8.3.2 显示 Samba 服务共享用户是否可用</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># pdbedit -L</code></pre>



<h4 id="8-4-生成-samba-服务共享目录8-4-1-生成-samba-服务共享目录">8.4 生成 Samba 服务共享目录<br>8.4.1 生成 Samba 服务共享目录</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># mkdir /share</code></pre>



<h4 id="8-4-2-给-samba-服务共享目录设置权限">8.4.2 给 Samba 服务共享目录设置权限</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># chmod 755 /share/</code></pre>



<h4 id="8-4-3-给-samba-服务共享目录设置所属主和所属组">8.4.3 给 Samba 服务共享目录设置所属主和所属组</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># chown zhumingyu:zhumingyu /share/</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="8-4-4-给-samba-服务共享目录设置-selinux-标签">8.4.4 给 Samba 服务共享目录设置 selinux 标签</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># semanage fcontext -a -t samba_share_t '/share(/.*)?'</code></pre>



<h4 id="8-4-5-让-samba-服务共享目录上的-selinux-标签立刻生效">8.4.5 让 Samba 服务共享目录上的 selinux 标签立刻生效</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># restorecon -RFvv /share/</code></pre>



<h4 id="8-5-启动-samba-服务并设置为开机自动启动">8.5 启动 Samba 服务并设置为开机自动启动</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># systemctl enable --now smb</code></pre>



<h4 id="8-6-在系统防火墙开放-samba-的端口8-6-1-在系统防火墙开放-samba-的端口">8.6 在系统防火墙开放 Samba 的端口<br>8.6.1 在系统防火墙开放 Samba 的端口</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># firewall-cmd --add-service=samba --permanent</code></pre>



<h4 id="8-6-2-让系统防火墙重新加载">8.6.2 让系统防火墙重新加载</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># firewall-cmd --reload</code></pre>



<h4 id="步骤九-实现远程桌面9-1-安装-vnc-服务">步骤九：实现远程桌面<br>9.1 安装 vnc 服务</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># yum -y install tigervnc tigervnc-server</code></pre>



<h4 id="9-2-设置-vnc-服务共享用户9-2-1-进入用户">9.2 设置 VNC 服务共享用户<br>9.2.1 进入用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="9-2-2-给-vnc-服务共享用户设置-vnc-远程密码">9.2.2 给 VNC 服务共享用户设置 VNC 远程密码</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ vncpasswd</code></pre>



<h4 id="9-2-3-退出用户">9.2.3 退出用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="9-3-启动-vnc-并设置为开机自动启动9-3-1-创建开启-vnc-的脚本-vnc-sh9-3-1-1-进入到用户">9.3 启动 VNC 并设置为开机自动启动<br>9.3.1 创建开启 VNC 的脚本 ~/vnc.sh<br>9.3.1.1 进入到用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="9-3-1-2-创建开启-vnc-的脚本-vnc-sh">9.3.1.2 创建开启 VNC 的脚本 ~/vnc.sh</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ vim ~/vnc.sh</code></pre>



<p>创建以下内容：</p>



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

vncserver -list | grep :1 &amp;&gt; /dev/null || vncserver :1 -localhost -nolisten tcp</code></pre>



<p>（补充：此命令会检查 vncserver :1 会话是否存在，如果不存在，就以禁止非安全远程登陆的方式创建一个）</p>



<h4 id="9-3-1-3-退出用户">9.3.1.3 退出用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="9-3-2-执行开启-vnc-的脚本9-3-2-1-开机执行开启-vnc-的脚本9-3-2-1-1-配置开机执行的文件">9.3.2 执行开启 VNC 的脚本<br>9.3.2.1 开机执行开启 VNC 的脚本<br>9.3.2.1.1 配置开机执行的文件</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rc.local</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
su - zhumingyu -c '/home/zhumingyu/vnc.sh'</code></pre>



<p>（补充：这里以用户 zhumingyu 的身份运行）</p>



<p>或者：</p>



<pre class="wp-block-code"><code>......
su - zhumingyu -c 'vncserver -list | grep :1' &amp;&gt; /dev/null || su - zhumingyu -c 'vncserver :1 -localhost -nolisten tcp'</code></pre>



<p>（<br>补充：<br>1) 如果前面没有创建脚本的话，可以只添加上面“或者”后面的这一行<br>2) 以用户 zhumingyu 的身份运行<br>3) 此命令会检查 vncserver :1 会话是否存在，如果不存在，就以禁止非安全远程登陆的方式创建一个<br>）</p>



<h4 id="9-3-2-1-2-给开机执行的文件执行权限">9.3.2.1.2 给开机执行的文件执行权限</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># chmod u+x /home/zhumingyu/vnc.sh</code></pre>



<h4 id="9-3-2-2-定期执行开启-vnc-的脚本9-3-2-2-1-进入到用户">9.3.2.2 定期执行开启 VNC 的脚本<br>9.3.2.2.1 进入到用户</h4>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="9-3-2-2-2-配置定期执行的文件">9.3.2.2.2 配置定期执行的文件</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ crontab -e</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
0 */1 * * * /home/zhumingyu/vnc.sh</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
0 */1 * * * vncserver -list | grep :1' &amp;&gt; /dev/null || su - zhumingyu -c 'vncserver :1 -localhost -nolisten tcp</code></pre>



<p>（<br>补充：<br>1) 这里以用户 zhumingyu 的身份运行<br>2) 如果前面没有创建脚本的话，可以只添加上面“或者”后面的这一行<br>3) 此命令会检查 vncserver :1 会话是否存在，如果不存在，就以禁止非安全远程登陆的方式创建一个<br>）</p>



<h4 id="9-3-2-2-3-退出用户">9.3.2.2.3 退出用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="步骤十-设置-ssh-内网穿透10-1-生成-ssh-密钥10-1-1-进入到用户">步骤十：设置 SSH 内网穿透<br>10.1 生成 SSH 密钥<br>10.1.1 进入到用户</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="10-1-2-生成-ssh-密钥">10.1.2 生成 SSH 密钥</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ ssh-keygen -b 2048 -t rsa</code></pre>



<p>（补充：建议在创建 SSH 密钥时为 SSH 密钥添加一个密码）</p>



<h4 id="10-1-3-退出用户">10.1.3 退出用户</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="10-2-实现无密钥-ssh10-2-1-进入到用户">10.2 实现无密钥 SSH<br>10.2.1 进入到用户</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="10-2-2-让电脑可以无密钥-ssh-vps">10.2.2 让电脑可以无密钥 SSH VPS</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ ssh-copy-id &lt;public IP address of VPS&gt;</code></pre>



<h4 id="10-2-3-让-vps-可以无密钥-ssh-自己">10.2.3 让 VPS 可以无密钥 SSH 自己</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ ssh-copy-id localhost</code></pre>



<h4 id="10-2-4-让客户端可以远程-vps-和电脑">10.2.4 让客户端可以远程 VPS 和电脑</h4>



<pre class="wp-block-code"><code>$ ssh-copy-id &lt;IP address of computer&gt;
$ ssh-copy-id &lt;public IP address of VPS&gt;</code></pre>



<h4 id="10-2-5-退出用户">10.2.5 退出用户</h4>



<p>（分别在电脑、VPS 和客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="10-3-建立电脑到-vps-的-ssh-隧道并设置为开机自启10-3-1-创建建立电脑到-vps-的-ssh-隧道的脚本-ssh-sh10-3-1-1-进入到用户">10.3 建立电脑到 VPS 的 SSH 隧道并设置为开机自启<br>10.3.1 创建建立电脑到 VPS 的 SSH 隧道的脚本 ～/ssh.sh<br>10.3.1.1 进入到用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="10-3-1-2-创建建立电脑到-vps-的-ssh-隧道的脚本-ssh-sh">10.3.1.2 创建建立电脑到 VPS 的 SSH 隧道的脚本 ～/ssh.sh</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ vim ～/ssh.sh</code></pre>



<p>创建以下内容：</p>



<pre class="wp-block-code"><code>ps -aux | grep -v grep | grep "11000:localhost:22 &lt;IP address of computer&gt;" &amp;&gt; /dev/null || ssh -X -fCNR 11000:localhost:22 &lt;IP address of computer&gt;</code></pre>



<p>（<br>补充：<br>1) 这里以用户 zhumingyu 的身份运行<br>2) 如果 11000 端口没有影射到 22 端口则影射<br>）</p>



<h4 id="10-3-1-3-退出用户">10.3.1.3 退出用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="10-3-2-执行电脑到-vps-的-ssh-隧道的脚本10-3-2-1-开机执行开启电脑到-vps-的-ssh-隧道的脚本10-3-2-1-1-配置开机执行的文件">10.3.2 执行电脑到 VPS 的 SSH 隧道的脚本<br>10.3.2.1 开机执行开启电脑到 VPS 的 SSH 隧道的脚本<br>10.3.2.1.1 配置开机执行的文件</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rc.local</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
su - zhumingyu -c '/home/zhumingyu/ssh.sh'</code></pre>



<p>（补充：这里以用户 zhumingyu 的身份运行）</p>



<p>或者：</p>



<pre class="wp-block-code"><code>......
ps -aux | grep -v grep | grep "11000:localhost:22 &lt;IP address of computer&gt;" &amp;&gt; /dev/null || su - zhumingyu -c 'ssh -X -fCNR 11000:localhost:22 &lt;IP address of computer&gt;'</code></pre>



<p>（<br>补充：<br>1) 如果前面没有创建脚本的话，可以只添加上面“或者”后面的这一行<br>2) 这里以用户 zhumingyu 的身份运行<br>3) 如果 11000 端口没有影射到 22 端口则影射<br>）</p>



<h4 id="10-3-2-1-2-给开机执行的文件执行权限">10.3.2.1.2 给开机执行的文件执行权限</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># chmod +x /etc/rc.local</code></pre>



<h4 id="10-3-3-定期执行电脑到-vps-的-ssh-隧道的脚本10-3-3-1-进入到用户">10.3.3 定期执行电脑到 VPS 的 SSH 隧道的脚本<br>10.3.3.1 进入到用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以 zhumingyu 为例）</p>



<h4 id="10-3-3-2-配置定期执行的文件">10.3.3.2 配置定期执行的文件</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ crontab -e</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
0 */1 * * * /home/zhumingyu/ssh.sh</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
0 */1 * * * ps -aux | grep -v grep | grep "11000:localhost:22 &lt;IP address of computer&gt;" &amp;&gt; /dev/null || ssh -X -fCNR 11000:localhost:22 &lt;IP address of computer&gt;</code></pre>



<p>（补充：如果 11000 端口影射到 22 端口则影射）</p>



<h4 id="10-3-3-3-退出用户">10.3.3.3 退出用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="10-4-建立-vps-的-ssh-隧道端口映射并设置为开机自启10-4-1-创建建立-vps-的-ssh-隧道端口映射的脚本10-4-1-1-进入到用户">10.4 建立 VPS 的 SSH 隧道端口映射并设置为开机自启<br>10.4.1 创建建立 VPS 的 SSH 隧道端口映射的脚本<br>10.4.1.1 进入到用户</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="10-4-1-2-创建建立-vps-的-ssh-隧道端口映射的脚本">10.4.1.2 创建建立 VPS 的 SSH 隧道端口映射的脚本</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ vim ~/sshd.sh</code></pre>



<p>创建以下内容：</p>



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

ps -aux | grep -v grep | grep "*:10000:localhost:11000 localhost" || ssh -X -fCNL *:10000:localhost:11000 localhost</code></pre>



<p>（补充：如果 11000 端口没有影射成 10000 端口则影射）</p>



<h4 id="10-4-1-3-退出用户">10.4.1.3 退出用户</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="10-4-2-执行电脑到-vps-的-ssh-隧道的脚本10-4-2-1-开机执行开启电脑到-vps-的-ssh-隧道的脚本10-4-2-1-1-配置开机执行的文件">10.4.2 执行电脑到 VPS 的 SSH 隧道的脚本<br>10.4.2.1 开机执行开启电脑到 VPS 的 SSH 隧道的脚本<br>10.4.2.1.1 配置开机执行的文件</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/rc.local</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
su - zhumingyu -c '/home/zhumingyu/sshd.sh'</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<p>或者：</p>



<pre class="wp-block-code"><code>......
ps -aux | grep -v grep | grep "*:10000:localhost:11000 localhost" || su - zhumingyu -c 'ssh -X -fCNL *:10000:localhost:11000 localhost'</code></pre>



<p>（<br>补充：<br>1) 如果前面没有创建脚本的话，可以只添加上面“或者”后面的这一行<br>2) 以用户 zhumingyu 的身份运行<br>3) 如果 11000 端口没有影射成 10000 端口则影射<br>）</p>



<h4 id="10-4-2-1-2-给开机执行的文件执行权限">10.4.2.1.2 给开机执行的文件执行权限</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># chmod +x /etc/rc.local</code></pre>



<h4 id="10-4-3-定期执行电脑到-vps-的-ssh-隧道的脚本10-4-3-1-进入到用户用户">10.4.3 定期执行电脑到 VPS 的 SSH 隧道的脚本<br>10.4.3.1 进入到用户用户</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="10-4-3-2-配置定期执行的文件">10.4.3.2 配置定期执行的文件</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ crontab -e</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
0 */1 * * * /home/zhumingyu/sshd.sh</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
0 */1 * * * ps -aux | grep -v grep | grep "*:10000:localhost:11000 localhost" || ssh -X -fCNL *:10000:localhost:11000 localhost</code></pre>



<p>（<br>补充：<br>1) 如果前面没有创建脚本的话，可以只添加上面“或者”后面的这一行<br>2) 如果 11000 端口没有影射成 10000 端口则影射<br>）</p>



<h4 id="10-4-4-退出用户">10.4.4 退出用户</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="10-4-5-打开外网-vps-对应端口的防火墙10-4-5-1-打开外网-vps-对应端口的防火墙">10.4.5 打开外网 VPS 对应端口的防火墙<br>10.4.5.1 打开外网 VPS 对应端口的防火墙</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># firewall-cmd --add-port=10000/tcp --permanent</code></pre>



<p>（补充：这里打开的端口号，是根据前面的设置而定的）</p>



<h4 id="10-4-5-2-让刚刚外网-vps-刚刚配置的防火墙生效">10.4.5.2 让刚刚外网 VPS 刚刚配置的防火墙生效</h4>



<p>（只在 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># firewall-cmd --reload</code></pre>



<h4 id="步骤十一-加强-ssh-的安全性-选做-11-1-禁止-root-被-ssh-选做">步骤十一：加强 SSH 的安全性（选做）<br>11.1 禁止 root 被 SSH（选做）</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/ssh/sshd_config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
PermitRootLogin no
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
PermitRootLogin yes
......</code></pre>



<h4 id="11-2-禁止使用密码被-ssh-选做">11.2 禁止使用密码被 SSH（选做）</h4>



<p>（分别在电脑和 VPS 上执行以下步骤）</p>



<pre class="wp-block-code"><code># vim /etc/ssh/sshd_config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
# PasswordAuthentication yes
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
PasswordAuthentication no
......</code></pre>



<h4 id="步骤十二-私有远程桌面和虚拟化平台的使用12-1-客户端-ssh-联接电脑的方法12-1-1-客户端和电脑不在同一内网时">步骤十二：私有远程桌面和虚拟化平台的使用<br>12.1 客户端 SSH 联接电脑的方法<br>12.1.1 客户端和电脑不在同一内网时</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># ssh -X -p &lt;SSH non standard port number&gt; &lt;user of computer&gt;@&lt;public IP address of VPS&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的 VPS 每小时会生成一个新的 SSH 非标准端口号以用于联接电脑，比如说现在是 14 点，那就会自动生成一个 11014 的 SSH 非标准端口号<br>2) 如果按照前面的步骤操作，这里的用户是 zhumingyu<br>）</p>



<h4 id="12-1-2-客户端和电脑在同一内网时">12.1.2 客户端和电脑在同一内网时</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># ssh -X &lt;user of computer&gt;@&lt;IP address of computer&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的用户用户是 zhumingyu<br>2) 如果按照前面的步骤操作，这里的电脑的 IP 地址是 192.168.0.1<br>）</p>



<h4 id="12-2-客户端使用电脑虚拟化平台的的方法12-2-1-客户端和电脑不在同一内网时12-2-1-1-在客户端上联接电脑">12.2 客户端使用电脑虚拟化平台的的方法<br>12.2.1 客户端和电脑不在同一内网时<br>12.2.1.1 在客户端上联接电脑</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># ssh -X -p &lt;SSH non standard port number&gt; &lt;user of computer&gt;@&lt;public IP address of VPS&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的 VPS 每小时会生成一个新的 SSH 非标准端口号以用于联接电脑，比如说现在是 14 点，那就会自动生成一个 11014 的 SSH 非标准端口号<br>2) 如果按照前面的步骤操作，这里的用户用户是 zhumingyu<br>）</p>



<h4 id="12-2-1-2-通过-ssh-开启虚拟化图形管理平台">12.2.1.2 通过 ssh 开启虚拟化图形管理平台</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># virt-manager</code></pre>



<p>（注意：网络带宽很小则远程桌面会比较卡，建议电脑、客户端和 VPS 的带宽 2m 以上）</p>



<h4 id="12-2-2-客户端和电脑在同一内网时12-2-2-1-在客户端上联接电脑">12.2.2 客户端和电脑在同一内网时<br>12.2.2.1 在客户端上联接电脑</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># ssh -X &lt;user of computer&gt;@&lt;IP address of computer&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的用户用户是 zhumingyu<br>2) 如果按照前面的步骤操作，这里的电脑的 IP 地址是 192.168.0.1<br>）</p>



<h4 id="12-2-2-2-通过-ssh-开启虚拟化图形管理平台">12.2.2.2 通过 ssh 开启虚拟化图形管理平台</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># virt-manager</code></pre>



<p>（注意：网络带宽很小则远程桌面会比较卡，建议电脑、客户端和 VPS 的带宽 2m 以上）</p>



<h4 id="12-3-客户端使用私有远程桌面的方法12-3-1-客户端和电脑不在同一内网时">12.3 客户端使用私有远程桌面的方法<br>12.3.1 客户端和电脑不在同一内网时</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># ssh -p &lt;SSH non standard port number&gt; -L &lt;port number of VNC&gt;:localhost:&lt;port number of VNC&gt; -l &lt;user of computer&gt; &lt;public IP address of VPS&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的 VPS 每小时会生成一个新的 SSH 非标准端口号以用于联接电脑，比如说现在是 14 点，那就会自动生成一个 11014 的 SSH 非标准端口号<br>2) 如果按照前面的步骤操作，这里的 VNC 的端口号是 5901<br>3) 如果按照前面的步骤操作，这里的电脑的用户用户是 zhumingyu<br>）</p>



<p>另开启一个命令行终端：</p>



<pre class="wp-block-code"><code># vncviewer localhost :&lt;number of VNC service&gt;</code></pre>



<p>（补充：如果按照前面的步骤操作，这里的 VNC 服务的编号是 1）</p>



<p>（注意：网络带宽很小则远程桌面会比较卡，建议电脑、客户端和 VPS 的带宽 2m 以上）</p>



<h4 id="12-3-2-客户端和电脑在同一内网时">12.3.2 客户端和电脑在同一内网时</h4>



<p>（只在客户端上执行以下步骤）</p>



<pre class="wp-block-code"><code># vncviewer -via &lt;user of computer&gt;@&lt;IP address of computer&gt; localhost :&lt;number of VNC service&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的电脑的用户是 zhumingyu<br>2) 如果按照前面的步骤操作，这里的电脑的 IP 地址是 192.168.0.1<br>3) 如果按照前面的步骤操作，这里的 VNC 服务的编号是 1<br>）</p>



<h4 id="12-4-客户端在内网和电脑互传数据的方法12-4-1-在-windows-图形客户端上和电脑互传数据的方法">12.4 客户端在内网和电脑互传数据的方法<br>12.4.1 在 Windows 图形客户端上和电脑互传数据的方法</h4>



<p>（只在客户端上执行以下步骤）</p>



<p>在文件目录下栏输入以下内容：</p>



<pre class="wp-block-code"><code>\\&lt;IP address of computer&gt;\&lt;samba directory&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的电脑的 IP 地址是 192.168.0.1<br>2) 如果按照前面的步骤操作，这里的 Samba 项目是 share<br>）</p>



<p>（<br>注意：<br>1) 如果按照前面的步骤操作，只有 IP 地址是 192.168.0.2 和 192.168.0.3 的客户端才能够执行以上步骤<br>2) Windows 客户端建议安装 SecureCRT、Xmanager 和 VNC 客户端以实现 ssh、ssh 调用 virt-manager 和 VNC<br>）</p>



<h4 id="12-4-2-在-linux-图形客户端上和电脑互传数据的方法">12.4.2 在 Linux 图形客户端上和电脑互传数据的方法</h4>



<p>（只在客户端上执行以下步骤）</p>



<p>在文件 &#8211;&gt; 其他位置 &#8211;&gt; 连接到服务器的地址栏里输入以下内容：</p>



<pre class="wp-block-code"><code>smb://&lt;IP address of computer&gt;/&lt;samba directory&gt;</code></pre>



<p>（<br>补充：<br>1) 如果按照前面的步骤操作，这里的电脑的 IP 地址是 192.168.0.1<br>2) 如果按照前面的步骤操作，这里的 Samba 项目是 share<br>）</p>



<p>（注意：如果按照前面的步骤操作，只有 IP 地址是 192.168.0.2 和 192.168.0.3 的客户端才能够执行以上步骤）</p>



<h4 id="步骤十三-客户端直接使用公网-ip-地址联接电脑13-1-实现此步骤所需环境">步骤十三：客户端直接使用公网 IP 地址联接电脑<br>13.1 实现此步骤所需环境</h4>



<p>网关路由器拥有 IP 地址（可以通过给宽带申请公网 IP 地址并将光纤盒设置为桥接模式，在路由器上添加用户和密码实现）</p>



<h4 id="13-2-在路由器上将电脑上的-22-端口映射到路由器上的公网-ip-地址上-这样路由器上的公网-ip-地址就变成电脑的公网-ip-地址了">13.2 在路由器上将电脑上的 22 端口映射到路由器上的公网 IP 地址上，这样路由器上的公网 IP 地址就变成电脑的公网 IP 地址了</h4>



<p>（步骤略）</p>



<h4 id="13-3-将电脑的公网-ip-地址放到-vps-上13-3-1-将电脑的公网-ip-地址放到-vps-上的意义">13.3 将电脑的公网 IP 地址放到 VPS 上<br>13.3.1 将电脑的公网 IP 地址放到 VPS 上的意义</h4>



<p>由于大多数的公网 IP 地址都是动态，定期会变，所以可以通过此方法知道近期的公网 IP 地址是多少</p>



<h4 id="13-3-2-创建将电脑的公网-ip-地址放到-vps-上的脚本13-3-2-1-进入到用户">13.3.2 创建将电脑的公网 IP 地址放到 VPS 上的脚本<br>13.3.2.1 进入到用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="13-3-2-2-创建将电脑的公网-ip-地址放到-vps-上的脚本">13.3.2.2 创建将电脑的公网 IP 地址放到 VPS 上的脚本</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ vim /root/computerip.sh</code></pre>



<p>创建以下内容：</p>



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

computerip=`curl ifconfig.me`
domain=&lt;public IP address of VPS&gt;

ssh athenadb.com \"echo `curl ifconfig.me` &gt; /home/zhumingyu/serverip.txt\"</code></pre>



<p>（补充：将电脑的公网 IP 地址拷贝到 VPS 的 /tmp/computerip.txt 文件里为例）</p>



<h4 id="13-3-2-3-退出用户用户">13.3.2.3 退出用户用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="13-3-3-执行将电脑的公网-ip-地址放到-vps-上的脚本13-3-3-1-进入到用户用户">13.3.3 执行将电脑的公网 IP 地址放到 VPS 上的脚本<br>13.3.3.1 进入到用户用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code># su - zhumingyu</code></pre>



<p>（补充：这里以用户 zhumingyu 为例）</p>



<h4 id="13-3-3-2-配置定期执行的文件">13.3.3.2 配置定期执行的文件</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ crontab -e</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
0 */10 * * * /home/zhumingyu/.crontab/computerip.txt</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
ssh &lt;public IP address of VPS&gt; \"echo `curl ifconfig.me` &gt; /home/zhumingyu/serverip.txt\"</code></pre>



<p>（<br>补充：<br>1) 如果前面没有创建脚本的话，可以只添加上面“或者”后面的这一行<br>2) 将电脑的公网 IP 地址拷贝到 VPS 的 /home/zhumingyu/serverip.txt 文件里<br>）</p>



<h4 id="13-3-3-3-退出用户用户">13.3.3.3 退出用户用户</h4>



<p>（只在电脑上执行以下步骤）</p>



<pre class="wp-block-code"><code>$ exit</code></pre>



<h4 id="13-4-通过-ddns-服务显示电脑的公网-ip13-4-1-通过-ddns-服务显示电脑的公网-ip">13.4 通过 DDNS 服务显示电脑的公网 IP<br>13.4.1 通过 DDNS 服务显示电脑的公网 IP</h4>



<p>由于大多数的公网 IP 地址都是动态，定期会变，所以可以通过此方法知道近期的公网 IP 地址是多少</p>



<h4 id="13-4-2-有些-ddns-服务可以在网关路由器上设置-并且通过手机-app-显示现在的公网-ip-地址">13.4.2 有些 DDNS 服务可以在网关路由器上设置，并且通过手机 APP 显示现在的公网 IP 地址</h4>



<p>（步骤略）</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
