如何在Ubuntu 20.04上使用UFW设置防火墙

2023-05-16

介绍 (Introduction)

UFW, or Uncomplicated Firewall, is a simplified firewall management interface that hides the complexity of lower-level packet filtering technologies such as iptables and nftables. If you’re looking to get started securing your network, and you’re not sure which tool to use, UFW may be the right choice for you.

UFW或简单的防火墙是简化的防火墙管理界面,它隐藏了诸如iptablesnftables类的低级数据包过滤技术的复杂性。 如果您希望开始保护网络安全,并且不确定使用哪种工具,UFW可能是您的正确选择。

This tutorial will show you how to set up a firewall with UFW on Ubuntu 20.04.

本教程将向您展示如何在Ubuntu 20.04上使用UFW设置防火墙。

先决条件 (Prerequisites)

To follow this tutorial, you will need:

要遵循本教程,您将需要:

  • One Ubuntu 20.04 server with a sudo non-root user, which you can set up by following our Initial Server Setup with Ubuntu 20.04 tutorial.

    一台具有sudo非root用户的Ubuntu 20.04服务器,您可以按照我们的《 Ubuntu 20.04初始服务器设置》教程进行设置 。

UFW is installed by default on Ubuntu. If it has been uninstalled for some reason, you can install it with sudo apt install ufw.

UFW默认安装在Ubuntu上。 如果由于某种原因已将其卸载,则可以使用sudo apt install ufw

第1步—将IPv6与UFW一起使用(可选) (Step 1 — Using IPv6 with UFW (Optional))

This tutorial is written with IPv4 in mind, but will work for IPv6 as well as long as you enable it. If your Ubuntu server has IPv6 enabled, ensure that UFW is configured to support IPv6 so that it will manage firewall rules for IPv6 in addition to IPv4. To do this, open the UFW configuration with nano or your favorite editor.

本教程是在考虑IPv4的前提下编写的,但是只要启用了IPv6,它就可以使用。 如果您的Ubuntu服务器启用了IPv6,请确保将UFW配置为支持IPv6,以便它除了管理IPv4外,还将管理IPv6的防火墙规则。 为此,请使用nano或您喜欢的编辑器打开UFW配置。

  • sudo nano /etc/default/ufw

    须藤nano / etc / default / ufw

Then make sure the value of IPV6 is yes. It should look like this:

然后确保IPV6值为yes 。 它看起来应该像这样:

/etc/default/ufw excerpt
/ etc / default / ufw摘录
IPV6=yes

Save and close the file. Now, when UFW is enabled, it will be configured to write both IPv4 and IPv6 firewall rules. However, before enabling UFW, we will want to ensure that your firewall is configured to allow you to connect via SSH. Let’s start with setting the default policies.

保存并关闭文件。 现在,启用UFW后,它将被配置为写入IPv4和IPv6防火墙规则。 但是,在启用UFW之前,我们将要确保已将防火墙配置为允许您通过SSH连接。 让我们从设置默认策略开始。

步骤2 —设置默认策略 (Step 2 — Setting Up Default Policies)

If you’re just getting started with your firewall, the first rules to define are your default policies. These rules control how to handle traffic that does not explicitly match any other rules. By default, UFW is set to deny all incoming connections and allow all outgoing connections. This means anyone trying to reach your server would not be able to connect, while any application within the server would be able to reach the outside world.

如果您刚开始使用防火墙,则定义的第一条规则是默认策略。 这些规则控制如何处理与其他任何规则都不明确匹配的流量。 默认情况下,UFW设置为拒绝所有传入连接并允许所有传出连接。 这意味着尝试访问您的服务器的任何人都将无法连接,而服务器中的任何应用程序都将可以访问外部。

Let’s set your UFW rules back to the defaults so we can be sure that you’ll be able to follow along with this tutorial. To set the defaults used by UFW, use these commands:

让我们将UFW规则重新设置为默认值,这样我们就可以确保您能够按照本教程进行操作。 要设置UFW使用的默认值,请使用以下命令:

  • sudo ufw default deny incoming

    sudo ufw默认拒绝传入
  • sudo ufw default allow outgoing

    sudo ufw默认允许传出

These commands set the defaults to deny incoming and allow outgoing connections. These firewall defaults alone might suffice for a personal computer, but servers typically need to respond to incoming requests from outside users. We’ll look into that next.

这些命令将默认设置设置为拒绝传入并允许传出连接。 这些防火墙默认值仅够一台个人计算机就足够了,但是服务器通常需要响应外部用户的传入请求。 接下来,我们将对其进行研究。

步骤3 —允许SSH连接 (Step 3 — Allowing SSH Connections)

If we enabled our UFW firewall now, it would deny all incoming connections. This means that we will need to create rules that explicitly allow legitimate incoming connections — SSH or HTTP connections, for example — if we want our server to respond to those types of requests. If you’re using a cloud server, you will probably want to allow incoming SSH connections so you can connect to and manage your server.

如果我们现在启用UFW防火墙,它将拒绝所有传入连接。 这意味着如果我们希望服务器响应那些类型的请求,我们将需要创建规则,以明确允许合法的传入连接(例如SSH或HTTP连接)。 如果使用的是云服务器,则可能需要允许传入的SSH连接,以便可以连接并管理服务器。

To configure your server to allow incoming SSH connections, you can use this command:

要将服务器配置为允许传入的SSH连接,可以使用以下命令:

  • sudo ufw allow ssh

    须藤UFW允许SSH

This will create firewall rules that will allow all connections on port 22, which is the port that the SSH daemon listens on by default. UFW knows what port allow ssh means because it’s listed as a service in the /etc/services file.

这将创建防火墙规则,该规则将允许端口22上的所有连接,端口22是SSH守护程序默认监听的端口。 UFW知道allow ssh意味着什么端口,因为它在/etc/services文件中被列为/etc/services

However, we can actually write the equivalent rule by specifying the port instead of the service name. For example, this command works the same as the one above:

但是,我们实际上可以通过指定端口而不是服务名称来编写等效规则。 例如,此命令与上面的命令相同:

  • sudo ufw allow 22

    sudo ufw允许22

If you configured your SSH daemon to use a different port, you will have to specify the appropriate port. For example, if your SSH server is listening on port 2222, you can use this command to allow connections on that port:

如果将SSH守护程序配置为使用其他端口,则必须指定适当的端口。 例如,如果您的SSH服务器正在侦听端口2222 ,则可以使用以下命令来允许该端口上的连接:

  • sudo ufw allow 2222

    sudo ufw允许2222

Now that your firewall is configured to allow incoming SSH connections, we can enable it.

现在您的防火墙已配置为允许传入的SSH连接,我们可以启用它。

步骤4 —启用UFW (Step 4 — Enabling UFW)

To enable UFW, use this command:

要启用UFW,请使用以下命令:

  • sudo ufw enable

    sudo ufw启用

You will receive a warning that says the command may disrupt existing SSH connections. We already set up a firewall rule that allows SSH connections, so it should be fine to continue. Respond to the prompt with y and hit ENTER.

您将收到一条警告,指出该命令可能会破坏现有的SSH连接。 我们已经设置了允许SSH连接的防火墙规则,因此可以继续。 用y响应提示,然后按ENTER

The firewall is now active. Run the sudo ufw status verbose command to see the rules that are set. The rest of this tutorial covers how to use UFW in more detail, like allowing or denying different kinds of connections.

防火墙现在处于活动状态。 运行sudo ufw status verbose命令以查看设置的规则。 本教程的其余部分详细介绍了如何使用UFW,例如允许或拒绝各种连接。

步骤5 —允许其他连接 (Step 5 — Allowing Other Connections)

At this point, you should allow all of the other connections that your server needs to respond to. The connections that you should allow depends on your specific needs. Luckily, you already know how to write rules that allow connections based on a service name or port; we already did this for SSH on port 22. You can also do this for:

此时,您应该允许服务器需要响应的所有其他连接。 您应允许的连接取决于您的特定需求。 幸运的是,您已经知道如何编写规则以允许基于服务名称或端口进行连接; 我们已经在端口22上针对SSH进行了此操作。 您也可以这样做:

  • HTTP on port 80, which is what unencrypted web servers use, using sudo ufw allow http or sudo ufw allow 80

    端口80上的HTTP,这是未加密的Web服务器使用的sudo ufw allow http ,使用sudo ufw allow httpsudo ufw allow 80

  • HTTPS on port 443, which is what encrypted web servers use, using sudo ufw allow https or sudo ufw allow 443

    加密的Web服务器使用的端口443上的HTTPS,使用sudo ufw allow httpssudo ufw allow 443

There are several others ways to allow other connections, aside from specifying a port or known service.

除了指定端口或已知服务之外,还有其他几种方式允许其他连接。

特定端口范围 (Specific Port Ranges)

You can specify port ranges with UFW. Some applications use multiple ports, instead of a single port.

您可以使用UFW指定端口范围。 某些应用程序使用多个端口,而不是单个端口。

For example, to allow X11 connections, which use ports 6000-6007, use these commands:

例如,为了允许X11连接,它使用端口6000 - 6007 ,使用这些命令:

  • sudo ufw allow 6000:6007/tcp

    sudo ufw允许6000 : 6007 / tcp

  • sudo ufw allow 6000:6007/udp

    sudo ufw允许6000 : 6007 / udp

When specifying port ranges with UFW, you must specify the protocol (tcp or udp) that the rules should apply to. We haven’t mentioned this before because not specifying the protocol automatically allows both protocols, which is OK in most cases.

使用UFW指定端口范围时,必须指定规则应适用的协议( tcpudp )。 我们之前没有提到这一点,因为未指定协议会自动允许这两种协议,这在大多数情况下是可以的。

特定的IP地址 (Specific IP Addresses)

When working with UFW, you can also specify IP addresses. For example, if you want to allow connections from a specific IP address, such as a work or home IP address of 203.0.113.4, you need to specify from, then the IP address:

使用UFW时,您还可以指定IP地址。 例如,如果要允许来自特定IP地址的连接(例如203.0.113.4的工作或家庭IP地址), 203.0.113.4需要指定from ,然后指定IP地址:

  • sudo ufw allow from 203.0.113.4

    sudo ufw允许从203.0.113.4

You can also specify a specific port that the IP address is allowed to connect to by adding to any port followed by the port number. For example, If you want to allow 203.0.113.4 to connect to port 22 (SSH), use this command:

您还可以通过添加to any port后跟端口号to any port指定允许IP地址连接的特定端口。 例如,如果要允许203.0.113.4连接到端口22 (SSH),请使用以下命令:

  • sudo ufw allow from 203.0.113.4 to any port 22

    sudo ufw允许从203.0.113.4到任何端口22

子网路 (Subnets)

If you want to allow a subnet of IP addresses, you can do so using CIDR notation to specify a netmask. For example, if you want to allow all of the IP addresses ranging from 203.0.113.1 to 203.0.113.254 you could use this command:

如果要允许IP地址的子网,可以使用CIDR表示法指定网络掩码。 例如,如果要允许所有IP地址从203.0.113.1203.0.113.254 ,可以使用以下命令:

  • sudo ufw allow from 203.0.113.0/24

    sudo ufw允许从203.0.113.0 / 24

Likewise, you may also specify the destination port that the subnet 203.0.113.0/24 is allowed to connect to. Again, we’ll use port 22 (SSH) as an example:

同样,您也可以指定允许子网203.0.113.0/24连接到的目标端口。 同样,我们将使用端口22 (SSH)作为示例:

  • sudo ufw allow from 203.0.113.0/24 to any port 22

    sudo ufw允许从203.0.113.0 / 24到任何端口22

与特定网络接口的连接 (Connections to a Specific Network Interface)

If you want to create a firewall rule that only applies to a specific network interface, you can do so by specifying “allow in on” followed by the name of the network interface.

如果要创建仅适用于特定网络接口的防火墙规则,可以通过指定“ allow in on”和网络接口的名称来实现。

You may want to look up your network interfaces before continuing. To do so, use this command:

您可能需要先查找网络接口,然后再继续。 为此,请使用以下命令:

  • ip addr

    IP地址

   
   
Output Excerpt
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state . . . 3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default . . .

The highlighted output indicates the network interface names. They are typically named something like eth0 or enp3s2.

突出显示的输出指示网络接口名称。 它们通常被命名为eth0enp3s2

So, if your server has a public network interface called eth0, you could allow HTTP traffic (port 80) to it with this command:

因此,如果您的服务器具有名为eth0的公共网络接口,则可以使用以下命令允许HTTP流量(端口80 )通过:

  • sudo ufw allow in on eth0 to any port 80

    sudo ufw在eth0上允许进入任何端口80

Doing so would allow your server to receive HTTP requests from the public internet.

这样做将允许您的服务器从公共互联网接收HTTP请求。

Or, if you want your MySQL database server (port 3306) to listen for connections on the private network interface eth1, for example, you could use this command:

或者,例如,如果您希望您MySQL数据库服务器(端口3306 )侦听专用网络接口eth1上的连接,则可以使用以下命令:

  • sudo ufw allow in on eth1 to any port 3306

    sudo ufw允许在eth1上进入任何端口3306

This would allow other servers on your private network to connect to your MySQL database.

这将允许您专用网络上的其他服务器连接到MySQL数据库。

第6步-拒绝连接 (Step 6 — Denying Connections)

If you haven’t changed the default policy for incoming connections, UFW is configured to deny all incoming connections. Generally, this simplifies the process of creating a secure firewall policy by requiring you to create rules that explicitly allow specific ports and IP addresses through.

如果您尚未更改传入连接的默认策略,则UFW被配置为拒绝所有传入连接。 通常,这要求您创建明确允许特定端口和IP地址通过的规则,从而简化了创建安全防火墙策略的过程。

However, sometimes you will want to deny specific connections based on the source IP address or subnet, perhaps because you know that your server is being attacked from there. Also, if you want to change your default incoming policy to allow (which is not recommended), you would need to create deny rules for any services or IP addresses that you don’t want to allow connections for.

但是,有时您可能希望基于源IP地址或子网拒绝特定的连接,这也许是因为您知道服务器正受到来自那里的攻击。 另外,如果要将默认传入策略更改为允许 (不建议这样做),则需要为不想允许连接的任何服务或IP地址创建拒绝规则。

To write deny rules, you can use the commands described above, replacing allow with deny.

要编写拒绝规则,您可以使用上述命令,将allow替换为deny

For example, to deny HTTP connections, you could use this command:

例如,要拒绝HTTP连接,可以使用以下命令:

  • sudo ufw deny http

    sudo ufw拒绝http

Or if you want to deny all connections from 203.0.113.4 you could use this command:

或者,如果您要拒绝203.0.113.4所有连接, 203.0.113.4可以使用以下命令:

  • sudo ufw deny from 203.0.113.4

    sudo ufw从203.0.113.4拒绝

Now let’s take a look at how to delete rules.

现在让我们看一下如何删除规则。

第7步-删除规则 (Step 7 — Deleting Rules)

Knowing how to delete firewall rules is just as important as knowing how to create them. There are two different ways to specify which rules to delete: by rule number or by the actual rule (similar to how the rules were specified when they were created). We’ll start with the delete by rule number method because it is easier.

知道如何删除防火墙规则与知道如何创建防火墙规则一样重要。 有两种不同的方法可以指定要删除的规则:按规则编号或按实际规则(类似于创建规则时如何指定规则)。 我们将从按规则编号删除方法开始,因为它比较容易。

按规则编号 (By Rule Number)

If you’re using the rule number to delete firewall rules, the first thing you’ll want to do is get a list of your firewall rules. The UFW status command has an option to display numbers next to each rule, as demonstrated here:

如果您使用规则号删除防火墙规则,则要做的第一件事就是获取防火墙规则列表。 UFW status命令可以选择在每个规则旁边显示数字,如下所示:

  • sudo ufw status numbered

    sudo ufw状态编号

   
   
Numbered Output:
Status: active To Action From -- ------ ---- [ 1] 22 ALLOW IN 15.15.15.0/24 [ 2] 80 ALLOW IN Anywhere

If we decide that we want to delete rule 2, the one that allows port 80 (HTTP) connections, we can specify it in a UFW delete command like this:

如果我们决定要删除规则2(该规则允许端口80(HTTP)连接),则可以在UFW delete命令中指定它,如下所示:

  • sudo ufw delete 2

    sudo ufw删除2

This would show a confirmation prompt then delete rule 2, which allows HTTP connections. Note that if you have IPv6 enabled, you would want to delete the corresponding IPv6 rule as well.

这将显示确认提示,然后删除允许HTTP连接的规则2。 请注意,如果启用了IPv6,则也要删除相应的IPv6规则。

按实际规则 (By Actual Rule)

The alternative to rule numbers is to specify the actual rule to delete. For example, if you want to remove the allow http rule, you could write it like this:

规则编号的替代方法是指定要删除的实际规则。 例如,如果要删除allow http规则,则可以这样编写:

  • sudo ufw delete allow http

    sudo ufw删除允许http

You could also specify the rule by allow 80, instead of by service name:

您还可以通过allow 80而不是服务名称来指定规则:

  • sudo ufw delete allow 80

    sudo ufw删除允许80

This method will delete both IPv4 and IPv6 rules, if they exist.

此方法将删除IPv4和IPv6规则(如果存在)。

步骤8 —检查UFW状态和规则 (Step 8 — Checking UFW Status and Rules)

At any time, you can check the status of UFW with this command:

您可以随时使用以下命令检查UFW的状态:

  • sudo ufw status verbose

    sudo ufw状态详细

If UFW is disabled, which it is by default, you’ll see something like this:

如果UFW被禁用(默认情况下为UFW),您将看到类似以下内容:


   
   
Output
Status: inactive

If UFW is active, which it should be if you followed Step 3, the output will say that it’s active and it will list any rules that are set. For example, if the firewall is set to allow SSH (port 22) connections from anywhere, the output might look something like this:

如果UFW处于活动状态(如果遵循步骤3,则应该是活动状态),输出将显示该状态为活动状态,并将列出所有设置的规则。 例如,如果防火墙设置为允许从任何地方进行SSH(端口22 )连接,则输出可能类似于以下内容:


   
   
Output
Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), disabled (routed) New profiles: skip To Action From -- ------ ---- 22/tcp ALLOW IN Anywhere

Use the status command if you want to check how UFW has configured the firewall.

如果要检查UFW如何配置防火墙,请使用status命令。

步骤9 —禁用或重置UFW(可选) (Step 9 — Disabling or Resetting UFW (optional))

If you decide you don’t want to use UFW, you can disable it with this command:

如果您决定不想使用UFW,则可以使用以下命令将其禁用:

  • sudo ufw disable

    sudo ufw禁用

Any rules that you created with UFW will no longer be active. You can always run sudo ufw enable if you need to activate it later.

您用UFW创建的任何规则将不再有效。 如果以后需要激活它,可以始终运行sudo ufw enable

If you already have UFW rules configured but you decide that you want to start over, you can use the reset command:

如果已经配置了UFW规则,但是您决定要重新开始,则可以使用reset命令:

  • sudo ufw reset

    sudo ufw重置

This will disable UFW and delete any rules that were previously defined. Keep in mind that the default policies won’t change to their original settings, if you modified them at any point. This should give you a fresh start with UFW.

这将禁用UFW并删除以前定义的任何规则。 请记住,如果您随时修改默认策略,它们将不会更改为其原始设置。 这应该使您从UFW重新开始。

结论 (Conclusion)

Your firewall is now configured to allow (at least) SSH connections. Be sure to allow any other incoming connections that your server needs, while limiting any unnecessary connections, so your server will be functional and secure.

现在,您的防火墙已配置为允许(至少)SSH连接。 确保允许服务器需要的任何其他传入连接,同时限制任何不必要的连接,以便服务器正常运行且安全。

To learn about more common UFW configurations, check out the UFW Essentials: Common Firewall Rules and Commands tutorial.

要了解更多常见的UFW配置,请查看UFW Essentials:通用防火墙规则和命令教程。

翻译自: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在Ubuntu 20.04上使用UFW设置防火墙 的相关文章

  • springboot框架

    1 什么是springboot框架 Spring是一个开源框架 xff0c Spring是于2003 年兴起的一个轻量级的Java 开发框架 xff0c 由Rod Johnson 在其著作 Expert One On One J2EE De
  • Elasticsearch入门及整合springboot

    1 Elasticsearch概述 1 1 搜索是什么 概念 xff1a 用户输入想要的关键词 xff0c 返回含有该关键词的所有信息 场景 xff1a 1 互联网搜索 xff1a 谷歌 百度 各种新闻首页 2 站内搜索 xff08 垂直搜
  • springboot+mybatis-plus+vue完成微信支付(前后端分离)

    微信支付的学习链接 https pay weixin qq com wiki doc api native php chapter 61 9 1 一 数据库准备 t order表 主要完成订单查询 span class token comm
  • springcloud学习笔记

    第一章 微服务的介绍 1 1系统架构演变 随着互联网的发展 xff0c 网站应用的规模也在不断的扩大 xff0c 进而导致系统架构也在不断的进行变化 从互联网早起到现在 xff0c 系统架构大体经历了下面几个过程 单体应用架构 gt 垂直应
  • windows2016 AD域修改密码策略

    1 服务器管理器 gt 工具 gt 组策略管理 2 域 gt 域名 gt 组策略对象 gt Default Domain Policy 域 gt 域名 gt Default Domain Policy同样可以 gt 右键 gt 编辑 3 计
  • 生产者和消费者的三种实现方式(Java)

    什么是生产者消费者问题 生产者消费者问题 xff08 英语 xff1a Producer consumer problem xff09 xff0c 也称有限缓冲问题是一个多线程同步问题的经典案例 该问题描述了共享固定大小缓冲区的两个线程 即
  • 设置桌面GNOME或者KDE

    一 设置GNOME或者KDE为默认的启动桌面环境 方法1 xff1a 修改 etc sysconfig desktop xff0c 根据需要将 DESKTOP 后面的内容改为KDE或GNOME 方法2 xff1a 在当前用户目录下建立 xi
  • windows11安装wsl2遇到的问题:sudo apt-get update报错已解决

    开始是因为在windows11使用mmdetection报错很多 xff0c 我看一些教程说mmcv是只支持linux xff0c 支持windows版本较少 xff0c 所以很难和torch cuda匹配上 xff0c 所以报错较多难安装
  • Ubuntu下AndroidStudio无法启动,报错Missing essential plugin: org.jetbrains.android Please reinstall Android

    Ubuntu下AndroidStudio无法启动 xff0c 报错Missing essential plugin org jetbrains android Please reinstall Android Studio from scr
  • Zookeeper应用场景(五) 分布式锁

    文章目录 分布式锁排他锁 定义锁 获取锁 释放锁 共享锁 定义锁 获取锁 释放锁 弊端 xff1a 群效应改进后的分布式锁实现 分布式锁 分布式锁是控制分布式系统之间同步访问共享资源的 种 式 如果不同的系统或是同 个系统的不同主机之间共享
  • Pr入门学习之选择GPU加速

    Pr入门学习之选择GPU加速 问题解决办法 近期因为需要用到Pr进行视频剪辑 xff0c 所以进行以下Pr学习 xff0c 记录学习过程中遇到的问题 问题 Pr导出视频时太慢 xff0c 后来发现没选择Gpu加速 xff0c 白白浪费了这个
  • HuggingFace简明教程

    视频链接 xff1a HuggingFace简明教程 BERT中文模型实战示例 NLP预训练模型 Transformers类库 datasets类库快速入门 哔哩哔哩 bilibili 1 huggingface简介与安装 什么是huggi
  • 一个程序员的成长之路

    一个程序员的成长之路 接下来就是你要学的东西 xff0c 从简入难 xff0c 由浅入深 xff0c 以下的东西 xff0c 通通都要学会 静态网页 43 HTML 43 Css 43 JavaScript 43 JQuery 43 Boo
  • Jetson TX2 重装系统(刷机)+后续设置(安装Fcitx、解决拼音候选词不显示、换国内源、局域网实现VNC远程桌面)

    xff08 珍爱生命 xff0c 远离TX2 xff01 xff01 xff01 xff09 一 Jetson tx2刷机过程及注意事项 二 安装Fcitx 43 Googlepinyin 三 解决拼音模式下不显示候选词bug 四 Ubun
  • 一篇文章搞懂Python那些事!!!

    1 python安装 1 1 安装地址 xff1a Download Python Python org 1 2 注意事项 xff1a 安装时需要勾选加入path环境安装后需要将python exe和script两个文件的路径加入path
  • Typora安装和使用技巧

    一 Typora安装 官方下载地址 xff1a https typora io 破解版下载地址 xff1a typora破解版安装 路人张的面试笔记 这里的旧版本是一直支持free xff1a 二 Typora使用技巧 常用快捷键 加粗 x
  • Word模板的创建与设置

    Word模板的创建与设置 1 背景 word作为office的一部分 是微软提供的办公文档写作软件 除了文字编辑的功能之外 它还包含很多提高写作效率的自动化功能 目前已成为办公文档 专业论文写作等必不可少的利器 本文内容涵盖了word自动化
  • TCP 服务器程序突然中断 由于send函数导致

    最近在写tcp 客户端服务器操作 设置服务器为单线程多个客户端连入 开发过程中出现 服务器代码运行过程中 在send处突然中断情况 通过GDB调试发现send函数报错提示打开文件错误 由于测试过程纵单节点反复连入客户端 在client so
  • 我为什么选择Linux mint 21.1 “Vera“ ? Mint安装优化调教指南(分辨率DPI、主题美化)

    前言 xff1a 为什么是Mint 笔者算是Linux老用户了 xff0c 作为一个后端开发 xff0c 尝试了多种不同发行版 一开始是Manjaro这种Arch系 xff0c 但是其对于开发而言实在是太过不稳定 xff1b 每次滚动更新都
  • 常用主题建模方法简单对比LSA&PLSA&LDA&HDP

    几种常用的主题建模方法 潜在语义分析 LSA I 概率潜在语义分析 PLSA 潜在狄利克雷分布 LDA 层次狄利克雷过程 HDP LSA I存在的主要问题 SVD计算非常耗时 xff0c 尤其文本处理 xff0c 词和文本数都是非常大的 x

随机推荐

  • banner2.1新版的使用,图片加载方法

    新版banner没有了设置图片和加载图片的方法 xff0c 弄了好几天才发现要设置适配器才可以使用 使用banner setaAapter方法设置适配器 xff0c 里面创建一个匿名内部类 xff0c 然后继承BannerImageAdap
  • yum解决依赖问题巧用

    1 使用yum查找软件需要用到的依赖包 xff0c 需要使用的命令是 xff1a yum deplist 34 要查找的软件 34 例如要查找 安装 redis 需要 的依赖软件有哪些 xff1a yum deplist redis 2 假
  • ubuntu linux 下载的deb包存放位置

    var cache apt archives
  • VMware快捷启动虚拟机+开机自启动

    场景 需要快速启动vm中的虚拟机服务 实现 编写bat文件 xff08 新建txt文件写完改成 bat文件即可 xff09 span class token string 34 D Dev tools VMware span class t
  • Zookeeper思维导图

  • cnpminstall报错:Connecttimeoutfor5000ms踩坑

    问题 xff1a 安装Head插件 xff0c 执行cnpm install 报错 xff0c 报错如下 xff1a Get binary mirror config latest from https registry npm taoba
  • 解决执行grunt命令报错【Cannot find module 'coffeescript/register'】

    在使用grunt的插件执行grunt命令时报错 xff1a 如图 xff1a 报错信息 xff1a Cannot find module 39 coffeescript register 39 解决办法 xff1a 1 xff1a 删除项目
  • Linux命令(1)

    1 判断一个命令的类型 type xff1a 格式 xff1a type xff08 一个空格 xff09 命令 作用 xff1a 判断该类型是内部还是外部命令 还可以显示该命令文件路径 2 查看一个文件的类型 file 格式 xff1a
  • 关于单链表的理解

    链表是一种物理 存储单元上非连续 非顺序的 存储结构 xff0c 数据元素的逻辑顺序是通过链表中的 指针链接次序实现的 链表由一系列结点 xff08 链表中每一个元素称为结点 xff09 组成 xff0c 结点可以在运行时动态生成 每个结点
  • selinux is active unexpected inconsistency RUN fsck MANUALLY

    启动centos6 5时报错 xff0c 错误主要是 xff1a selinux is active unexpected inconsistency RUN fsck MANUALLY 原因是因为意外关机如断电 xff0c 或者虚拟机中强
  • Linux永久修改主机名

    hostnamectl set hostname xxx
  • 去除重复字母(Java实现)

    题目 去除重复字母 给你一个字符串 s xff0c 请你去除字符串中重复的字母 xff0c 使得每个字母只出现一次 需保证 返回结果的字典序最小 xff08 要求不能打乱其他字符的相对位置 xff09 示例1 输入 xff1a s 61 b
  • JDK介绍(笔记学习)

    JDK介绍 1 JRE和JDK xff08 记忆 xff09 JDK 称为Java开发工具 xff0c 包含了JRE和开发工具 JRE Java运行环境 xff0c 包含了JVM和Java的核心类库 xff08 Java API xff09
  • Collections类(笔记)

    1 Collections的常用功能 重点 import java util Collections java util Collections是集合工具类 xff0c 用来对集合进行操作 常用方法如下 xff1a public stati
  • 计算机网络原理学习笔记第一篇

    计算机网络的出现 世界上第一台电子计算机问世于1946年 xff0c 由于当时造价昂贵 体积极大等原因 xff0c 因此计算机的数量极少 计算机系统是高度集中的 xff0c 它的所有设备都安装在单独的机房中 xff0c 为了提高计算机的利用
  • mac下Tomcat启动成功后浏览器输入localhost:8080拒绝连接的解决办法

    今天根据大佬们的安装教程将Tomcat安装并成功启动 xff0c 而在浏览器中输入localhost xff1a 8080后却出现了 localhost拒绝了我们的连接请求 的字样 xff0c 网上的解决方案五花八门 xff0c 水平也是参
  • Linux中的软件管理

    Linux中的软件管理 yum源头 定义 xff1a yum源是一个软件集合地 xff0c 只需要搜索并安装你想要的软件 yum的全称是Yellowdog Updater Modified xff0c 是一个shell前端软件包管理器 xf
  • Spring拦截器HandlerInterceptor和HandlerInterceptorAdapter

    参考 https blog csdn net zhibo lv article details 81699360 https www cnblogs com jing99 p 11147152 html HandlerInterceptor
  • Java多线程超详解

    引言 随着计算机的配置越来越高 xff0c 我们需要将进程进一步优化 xff0c 细分为线程 xff0c 充分提高图形化界面的多线程的开发 这就要求对线程的掌握很彻底 那么话不多说 xff0c 今天本帅将记录自己线程的学习 程序 xff0c
  • 如何在Ubuntu 20.04上使用UFW设置防火墙

    介绍 Introduction UFW or Uncomplicated Firewall is a simplified firewall management interface that hides the complexity of