练镇中 發表於 2024-8-25 22:42:00

第一篇:Linux概述、系统部署、Xshell远程连接

<h2><span style="background-color: rgba(255, 102, 0, 1)">Linux概述</span></h2>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>Linux中常见错误提醒⭐⭐⭐⭐⭐</h3>
<p>常见的错误提醒:https://www.jianshu.com/p/99ec5bb4183f</p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>Linux简介</h3>
<p>Linux与windows类似,都是操作系统,Linux一般用于企业环境,相对稳定</p>
<table class="cnblogs_Highlighter" style="height: 92px; width: 371px" border="0" align="center">
<tbody>
<tr>
<td>&nbsp;</td>
<td>共同点</td>
<td>区别</td>
</tr>
<tr>
<td>Linux</td>
<td>操作系统</td>
<td>免费使用,较为稳定</td>
</tr>
<tr>
<td>Windows</td>
<td>操作系统</td>
<td>收费,漏洞相对较多</td>
</tr>
</tbody>
</table>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>Linux发展</h3>
<table class="cnblogs_Highlighter" style="height: 184px; width: 696px" border="0" align="center">
<tbody>
<tr>
<td>Unix</td>
<td>Mint(mini unix)</td>
<td>组织:<strong>自由软件基金会(FSF)</strong></td>
<td>Linux内核</td>
</tr>
<tr>
<td>贝尔实验室</td>
<td>谭宁邦,主要用户教学</td>
<td>斯托曼</td>
<td>林纳斯·托瓦兹</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>
<p><strong>GPL公共通用许可证</strong><br>--所有软件开源,可以随意修改<br>--修改后的内容,也要开源</p>
<p>项目:<strong>GNU项目</strong>,弄出了个系统</p>
<p>Linux也可以叫做GNU/Linux</p>





































</td>
<td>&nbsp;</td>





































</tr>





































</tbody>





































</table>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>Linux组成⭐⭐⭐</h3>
<p>蛋壳:Linux各种命令,服务,软件</p>
<p>蛋清:<span style="color: rgba(255, 0, 0, 1)"><strong>命令解释器</strong></span>(解释运行Linux命令)(将用户输入的命令转换为系统能理解和执行的指令)</p>
<p>蛋黄:Linux内核(控制硬件,无法直接操作内核)</p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825183434312-2008550011.png" alt="" width="528" height="209" loading="lazy"></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>LInux发行版本⭐⭐⭐⭐⭐</h3>
<p>发行版本:通过<strong>内核</strong>+<strong>命令解释器</strong>+<strong>不同应用程序/桌面</strong>组成</p>
<p>核心掌握:Debian、Ubuntu、红帽RHEL、CentOs、中标麒麟Kylin</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 主流Linux系列</span><span style="color: rgba(0, 128, 0, 1)">
#</span><span style="color: rgba(0, 128, 0, 1)"> Debian系列</span>
<span style="color: rgba(0, 0, 0, 1)"><strong>    Debian系统</strong>:更新频率低,较为稳定安全,可以用于企业环境
    <strong><span style="color: rgba(255, 0, 0, 1)">Ubuntu系统(乌班图)</span></strong>:桌面美观,使用方便,常用于开发
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 红帽系列</span>
<span style="color: rgba(0, 0, 0, 1)"><strong>    Redhat</strong> enterprise Linux(RHEL红帽企业版)
   <span style="color: rgba(255, 0, 0, 1)"> <strong>Centos系统</strong></span>:基本国内最常用的LInux系统(被Redhat收购)
    Rocky Linux:centos系统创始人新出的Linux系统
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 国产系列</span>
<span style="color: rgba(0, 0, 0, 1)"><strong>    中标麒麟国产Linux(Kylin)</strong>:有桌面环境,由服务器版本
    红旗Linux
    欧拉系统(openeuler,华为)
    各种厂商的Linux系统
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 其他系列(了解)</span>
    Suse、OpenSUSE</pre>
</div>
<h2><span style="background-color: rgba(255, 102, 0, 1)">Linux环境部署</span>⭐⭐⭐⭐⭐</h2>
<h3><span style="background-color: rgba(136, 136, 136, 1)"><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span></span>虚拟机概述</h3>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825193817960-1147149524.png" alt="" width="575" height="221" loading="lazy"></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>桥接、NAT、仅主机⭐⭐⭐</h3>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825202116582-691085693.png" alt="" width="448" height="176" loading="lazy"></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>部署Linux系统</h3>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825203839787-34207991.png" alt="" width="469" height="197" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202409/2946572-20240919212023295-1452171569.png" alt="" width="469" height="286" loading="lazy"></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 0, 1)">#</span><strong><span style="color: rgba(255, 0, 0, 1)"> net.ifnames=0 biosdevname=0</span></strong>
<span style="color: rgba(0, 0, 0, 1)">将网卡的名字变成eth0、eth1的形式(centos 7中默认的网卡名是ens33)
</span><span style="color: rgba(0, 0, 0, 1)">没改名成功就退出去重启</span>

<span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 安装流程介绍</span>
<span style="color: rgba(255, 0, 0, 1)">Install centos 7</span><span style="color: rgba(0, 0, 0, 1)">:安装系统,几乎选择这个
<span style="color: rgba(255, 0, 0, 1)">Test this media </span></span><span style="color: rgba(255, 0, 0, 1)">&amp; install centos 7</span><span style="color: rgba(0, 0, 0, 1)">:测试系统的镜像并安装系统(不推荐)
<span style="color: rgba(255, 0, 0, 1)">Troubleshooting</span>:解决Linux无法启动的故障,进入救援模式</span></pre>
</div>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825213451279-1068037272.png" alt="" width="471" height="337" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240826174011990-548888366.png" alt="" width="470" height="459" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825213821329-1663739693.png" alt="" width="469" height="347" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825214428688-464307254.png" alt="" width="466" height="380" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825214549980-1277142248.png" alt="" width="458" height="236" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825215017675-1690886635.png" alt="" width="455" height="462" loading="lazy"></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240827083402076-664296754.png" alt="" loading="lazy"></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>挂起、快照、克隆</h3>
<p><strong>挂起</strong>:把正在运行的虚拟机暂停(好处:虚拟机不用关机)</p>
<p><strong>快照</strong>:给虚拟机当前状态拍摄一个保存节点,这个保存节点可以用于恢复</p>
<p><strong>克隆</strong>:就是用来复制一个<strong><span style="color: rgba(255, 0, 0, 1)">进程</span></strong>,让<span style="color: rgba(255, 0, 0, 1)">新进程和原进程可以共享一些资源,同时又能独立运行</span></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>VMware网络配置(进入系统后配置仅一次)</h3>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240825223042472-1032275446.png" alt="" width="456" height="418" loading="lazy"></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>开启虚拟机蓝屏与虚拟机异常解决⭐⭐⭐</h3>
<ul>
<li>背景:选择开启虚拟机时,windows 10/windows 11蓝屏,windows 7报错</li>
<li>原因:
<ul>
<li>需要windows开启虚拟化支持,</li>
<li>虚拟化支持(vt-x)与windows自带的虚拟化软件hyper-v冲突导致,关闭即可</li>
</ul>
</li>
</ul>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>虚拟化未开启导致蓝屏或报错⭐⭐⭐</h4>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240827094726027-79065447.png" alt="" width="461" height="408" loading="lazy"></p>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>Vmware与hyper-v软件冲突⭐⭐⭐</h4>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240827095542253-219499210.png" alt="" loading="lazy"></p>
<h2><span style="background-color: rgba(255, 102, 0, 1)">Xshell远程连接</span></h2>
<p><strong><span style="color: rgba(255, 0, 0, 1)">Ubuntu和Rocky系统需要配置/etc/ssh/sshd_config文件下的参数PermitRootLogin yes,才能允许使用root用户登录</span></strong></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>远程连接工具介绍</h3>
<p>工作中通过远程连接工具连接LInux系统</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 远程连接工具</span><span style="color: rgba(0, 0, 0, 1)">
windows: Xshell、SecureCRT、Putty(功能简单)、mobaXterm(功能多)
mac: Iterm2、Secure CRT、finalshell</span></pre>
</div>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240827090542429-130280448.png" alt="" width="321" height="195" loading="lazy"></p>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>IP地址、端口、协议⭐⭐</h3>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>IP地址</h4>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"><strong><span style="color: rgba(255, 0, 0, 1)"> ip address</span></strong> 查询设备的ip地址等信息</span><span style="color: rgba(0, 128, 0, 1)">
#</span><span style="color: rgba(0, 128, 0, 1)"> ip地址分为两类</span>
    <span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 局域网ip(内网ip,私网ip)</span>
<span style="color: rgba(0, 0, 0, 1)">      一般只能再某个范围内使用(教室,公司办公室)
      网络设备自动分配,自动获取,一般不固定
      </span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 局域网ip</span>
            <strong><span style="color: rgba(255, 0, 0, 1)">10.0.0.xxx
            192.168.xxx.xxx
            172.16.xxx.xxx-172.31.xxx.xxx
    </span></strong><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 公网ip(外网ip)</span>
<span style="color: rgba(0, 0, 0, 1)">      可以再任何有网络的地方使用,访问对应设备,数量有限
      企业购买获得,企业公网ip固定</span></pre>
</div>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>端口</h4>
<p>计算机可以想象成一个密不透风的盒子,盒子上的洞洞就是端口</p>
<p><span style="color: rgba(255, 0, 0, 1)"><strong>计算机中通过端口来区分不同的服务</strong></span></p>
<table class="cnblogs_Highlighter" border="0" align="center">
<tbody>
<tr>
<td>服务</td>
<td>默认端口</td>
</tr>
<tr>
<td>远程连接服务 <span style="color: rgba(255, 0, 0, 1)">sshd</span></td>
<td><span style="color: rgba(255, 0, 0, 1)">22</span></td>
</tr>
<tr>
<td>网站服务 <span style="color: rgba(255, 0, 0, 1)">http</span></td>
<td><span style="color: rgba(255, 0, 0, 1)">80</span></td>
</tr>
<tr>
<td>网站服务加密 <span style="color: rgba(255, 0, 0, 1)">https</span></td>
<td><span style="color: rgba(255, 0, 0, 1)">443</span></td>
</tr>
</tbody>
</table>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>xshell远程连接Ubuntu</h3>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 1.安装 OpenSSH 服务器: </span>
    sudo apt update sudo apt install openssh-<span style="color: rgba(0, 0, 0, 1)">server
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 2.启动 SSH 服务:</span>
<span style="color: rgba(0, 0, 0, 1)">    sudo systemctl start ssh
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 3.检查 SSH 服务状态:</span>
<span style="color: rgba(0, 0, 0, 1)">    sudo systemctl status ssh
</span><span style="color: rgba(0, 128, 0, 1)">#</span><span style="color: rgba(0, 128, 0, 1)"> 4.防火墙设置(确保防火墙允许 SSH 连接):</span>
    sudo ufw allow ssh</pre>
</div>
<h3><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;&nbsp;</span>远程连接排错3部曲⭐⭐⭐⭐⭐</h3>
<p>排障流程:https://www.jianshu.com/p/0bc0b596c1a0</p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240827111515206-196878862.png" alt="" width="448" height="216" loading="lazy"></p>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>检查道路是否畅通</h4>
<table style="height: 67px; width: 372px" border="0">
<tbody>
<tr>
<td style="text-align: center">ping命令格式</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="text-align: center">ping</td>
<td style="text-align: center">空格</td>
<td style="text-align: center">ip或域名</td>
</tr>
</tbody>
</table>
<p><strong>命令在Xshell的本地shell执行相当于在windows环境下执行</strong></p>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240829083615742-2011725107.png" alt="" width="561" height="179" loading="lazy"></p>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>检查是否劫财劫色&nbsp;</h4>
<p>防火墙,安全设备,安全规则拦截</p>
<h4><span style="background-color: rgba(255, 102, 0, 1)">&nbsp;</span>检查是否提供服务(本质:检查端口是否开放)</h4>
<p>检查端口是否开放,端口是否可以被外部访问或连接,可以间接的检验服务是否开启</p>
<table class="cnblogs_Highlighter" border="0" align="center">
<tbody>
<tr>
<td style="text-align: center">telnet检查端口是否可以访问</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="text-align: center"><strong><span style="color: rgba(255, 0, 0, 1)">telnet</span></strong></td>
<td style="text-align: center">ip或域名</td>
<td style="text-align: center">端口</td>
</tr>
</tbody>
</table>
<p><img src="https://img2024.cnblogs.com/blog/2946572/202408/2946572-20240829091943602-1148326528.png" alt="" width="409" height="120" loading="lazy"></p>
<p>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/yuanxiaojiang/p/18379667
頁: [1]
查看完整版本: 第一篇:Linux概述、系统部署、Xshell远程连接