# \#linux

**URL:** https://www.isharkfly.com/tag/linux/37.md

[Latest](https://www.isharkfly.com/latest.md) · [Categories](https://www.isharkfly.com/categories.md) · [Tags](https://www.isharkfly.com/tags.md)

---

## [Ubuntu 防火墙配置](https://www.isharkfly.com/t/ubuntu/13527)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [October 22, 2026, 5:58pm UTC](https://www.isharkfly.com/t/ubuntu/13527 "2026-10-22T17:58:06Z")

</div>

Ubuntu 的防火墙配置可以参考文章：Firewall - Ubuntu Server documentation 22 端口 需要注意的是，在启动防火墙之前，需要先开放 22 端口。 否则 SSH 将会拒绝你连接防火墙。 开放 22 端口的命令为：sudo ufw allow 22 添加端口 如果还希望添加其他端口。 可以使用命令：sudo ufw allow 8161 来逐次添加。 关闭端口 如果想关闭特定的端口，使…

---

## [Usermod 修改 Linux 用户所属的组](https://www.isharkfly.com/t/usermod-linux/10380)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [March 23, 2026, 3:17pm UTC](https://www.isharkfly.com/t/usermod-linux/10380 "2026-03-23T15:17:03Z")

</div>

可用于将一个用户添加到另一个用户组中。 如果希望将 yhu 用户添加到root用户组中： \[root@HAR3SERVER root\]# usermod -G yuchenghu,dba,oinstall,root yhu \[root@HAR3SERVER root\]# id yhu uid=500(yuchenghu) gid=500(yhu) groups=500(yhu),0(root),501(oinstall),502(d…

---

## [Linux 查看某个目录的大小的命令](https://www.isharkfly.com/t/linux/17367)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 1\
**Last updated:** [May 30, 2025, 1:37pm UTC](https://www.isharkfly.com/t/linux/17367 "2025-05-30T13:37:38Z")

</div>

命令为： du -hs /path/to/directory 上面有 2 个参数。 h：把大小转换为可以人为读取的形式。 s：获得整个目录的摘要。 实际执行的效果为： root@src-isharkfly:/var/lib/gitea/data/gitea-repositories/isharkfly# du -hs /home/ubuntu/ 581G /home/ubuntu/ root@src-isharkfly:/v…

---

## [Fedora/REHL 安装 semanage](https://www.isharkfly.com/t/fedora-rehl-semanage/14028)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [July 5, 2022, 7:58pm UTC](https://www.isharkfly.com/t/fedora-rehl-semanage/14028 "2022-07-05T19:58:06Z")

</div>

Semanage是 用于配置SELinux策略某些元素而无需修改或重新编译策略源的工具。 这包括将Linux用户名映射到SELinux 用户身份以及对象（如网络端口，接口和主机）的安全上下文映射。 Semanage是 用于配置SELinux 策略某些元素而无需修改或重新编译策略源的工具。 如果没有 Semanage，你要对 SELinux 配置的话就比较麻烦，但是 SELinux 又是现在 Linux 的标配了，所以这个包也就变得…

---

## [Ubuntu 查看运行的版本](https://www.isharkfly.com/t/ubuntu/14241)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [December 7, 2022, 2:18pm UTC](https://www.isharkfly.com/t/ubuntu/14241 "2022-12-07T14:18:54Z")

</div>

可以使用下面的命令来查看 Ubuntu 运行的版本。 lsb\_release -a 系统将会输出为： yhu@YuCheng-Hu:/mnt/c/Users/yhu$ lsb\_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.5 LTS Release: 20.04 Codename…

---

## [Linux 查看发行版本的命令 cat /etc/issue](https://www.isharkfly.com/t/linux-cat-etc-issue/10542)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [July 2, 2013, 5:24pm UTC](https://www.isharkfly.com/t/linux-cat-etc-issue/10542 "2013-07-02T17:24:29Z")

</div>

服务器输出如下： root@web4 ~\]# cat /etc/issue Red Hat Enterprise Linux Server release 5.6 (Tikanga) Kernel \\r on an \\m \[root@web4 ~\]#

---

## [Ubuntu 网络带宽监控工具](https://www.isharkfly.com/t/ubuntu/17029)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 2\
**Last updated:** [March 8, 2025, 2:04pm UTC](https://www.isharkfly.com/t/ubuntu/17029 "2025-03-08T14:04:11Z")

</div>

iftop：命令行网络带宽监控工具。 使用下面的命令进行安装： sudo apt install iftop 然后运行 sudo iftop 就这个带宽数据使用来看，服务器的负载还是比较低。 大概运行下试试看就了解了。

---

## [阿里与服务器安装 Docker 的命令](https://www.isharkfly.com/t/docker/17022)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [March 7, 2025, 5:22pm UTC](https://www.isharkfly.com/t/docker/17022 "2025-03-07T17:22:11Z")

</div>

要在阿里的云服务器上安装 Docker ，需要使用的命令如下： #添加Docker软件包源 sudo wget -O /etc/yum.repos.d/docker-ce.repo http://mirrors.cloud.aliyuncs.com/docker-ce/linux/centos/docker-ce.repo sudo sed -i 's|https://mirrors.aliyun.com|http://mirrors…

---

## [Linux 服务器速度测试](https://www.isharkfly.com/t/linux/17018)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [March 7, 2025, 1:50pm UTC](https://www.isharkfly.com/t/linux/17018 "2025-03-07T13:50:03Z")

</div>

可以使用速度测试工具： speedtest-cl 如果没有安装的话，安装一下。 apt install speedtest-cli 测试命令 直接运行：speedtest-cli --secure 服务器的输出为： root@ns521461:~# speedtest-cli --secure Retrieving speedtest.net configuration... Testing from OVH SAS (158…

---

## [Ubuntu 升级到版本 24.04.2 LTS](https://www.isharkfly.com/t/ubuntu-24-04-2-lts/16978)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 24, 2025, 3:30pm UTC](https://www.isharkfly.com/t/ubuntu-24-04-2-lts/16978 "2025-02-24T15:30:34Z")

</div>

发行版本升级的命令为： do-release-upgrade 升级提示 最近在检查 Ubuntu 版本的时候有提示： Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.167.4-microsoft-standard-WSL2 x86\_64) \* Documentation: https://help.ubuntu.com \* Management: https://lan…

---

## [Ubuntu 时间服务器配置](https://www.isharkfly.com/t/ubuntu/16971)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 22, 2025, 12:17am UTC](https://www.isharkfly.com/t/ubuntu/16971 "2025-02-22T00:17:50Z")

</div>

对服务器而言，服务器的时间非常重要。 通常日志，数据库的时间调用，程序的时间调用都会使用这个时间。 我们希望我们的服务器的时间会一直保持准确，并不需要人工进行干预。 这个时候就需要 NTP 时间服务。 好在 Ubuntu 现在已经默认把时间服务集成并且自动启动。 查看状态 运行命令 timedatectl 如果能看到输出显示同步的选项为 yes， 则表明时间的服务已启动，无需后续操作。 服务器会同步互联网上的时间来保…

---

## [Ubuntu 设置主机名](https://www.isharkfly.com/t/ubuntu/16970)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 21, 2025, 9:54pm UTC](https://www.isharkfly.com/t/ubuntu/16970 "2025-02-21T21:54:30Z")

</div>

Ubuntu 设置主机名可以使用图形化界面 nmtui。 安装 如果直接运行 nmtui 显示命令无法识别，则说明 图形化界面没有安装。 运行命令：sudo apt install network-manager 进行安装。 进入配置界面的命令为：sudo nmtui 确定运行后能看到上面的界面，则说明安装正确。 设置系统主机名 选择上面配置中的设置系统主机名后回车。 输入你希望配置的主机名。 随后保存…

---

## [为什么从 Fedora 换到了 Ubuntu](https://www.isharkfly.com/t/fedora-ubuntu/16956)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 18, 2025, 4:27pm UTC](https://www.isharkfly.com/t/fedora-ubuntu/16956 "2025-02-18T16:27:14Z")

</div>

自从 CentOS 不再提供技术支持，并且 RHEL 希望所有使用免费版本的 Linux 用户切换到 Fedora，并且能够为 RHEL 的商业服务提供销售。 我们也进行了多次的服务器切换。 最近的决定是将 Fedora 的部署， 逐步完全切换到 Ubuntu。 其主要原因就是支持时间长短的问题。 对于很多初创型企业是没有办法购买 REHL 的商业服务，所以他们更多依赖免费的开源社区。 支持周期 Fedora 的支持周期只有 …

---

## [Ubuntu 配置语言环境](https://www.isharkfly.com/t/ubuntu/16955)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 18, 2025, 5:36am UTC](https://www.isharkfly.com/t/ubuntu/16955 "2025-02-18T05:36:46Z")

</div>

Ubuntu 配置语言环境的文本图形化界面命令为： sudo dpkg-reconfigure locales 配置语言环境的过程：

---

## [Linux 的 locale](https://www.isharkfly.com/t/linux-locale/16952)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 18, 2025, 5:11am UTC](https://www.isharkfly.com/t/linux-locale/16952 "2025-02-18T05:11:17Z")

</div>

locale 是 Linux 系统中多语言环境的接口，每个 locale 都定义了地区、语言和字符集。locale 的语法规则是：\<语言\>\_\<地区\>.\<字符集编码\>\<@修正值\>，如 zh\_CN.UTF-8 中，zh 表示中文，CN 表示中国大陆，UTF-8 表示字符集。 查看可用的字符集 locale -a 可以列出所有可用的语言环境/字符集，加 -v 选项可以输出更详细的信息。 ubuntu@ns524146:~$ locale …

---

## [Nginx SSL: error:1410D0B 错误](https://www.isharkfly.com/t/nginx-ssl-error-1410d0b/16882)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [February 6, 2025, 4:06am UTC](https://www.isharkfly.com/t/nginx-ssl-error-1410d0b/16882 "2025-02-06T04:06:35Z")

</div>

在 Nginx 配置 SSL 的时候 nginx 提示错误： Restarting nginx: \[emerg\]: SSL\_CTX\_set\_cipher\_list("HIGH:!SSLv2:!SSLv3") failed (SSL: error:1410D0B9:SSL routines:SSL\_CTX\_set\_cipher\_list:no cipher match) nginx. 问题和解决 出现上面的问题是英文 nginx 在操…

---

## [Linux 使用 logrotate 日志归档](https://www.isharkfly.com/t/linux-logrotate/10512)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 1\
**Last updated:** [February 6, 2025, 2:18am UTC](https://www.isharkfly.com/t/linux-logrotate/10512 "2025-02-06T02:18:15Z")

</div>

系统时时刻刻都在产生日志，如果不及时清理，很快就会灌满硬盘，但如果要手工清理，又很麻烦。 这种情况下，logrotate 这个程序很好的完成这个任务。 logrotate 用来把旧的日志文件删除，并创建新的日志文件，我们把它叫做“转储”。 我们可以根据日志文件的大小，也可以根据其天数来转储，这个过程一般通过一个叫做crond的守护进程来执行，logrotate 还可以用于压缩日志文件，以及发送日志到指定的E-mail 。 log…

---

## [准备入 Ubuntu 的坑了](https://www.isharkfly.com/t/ubuntu/16717)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 5\
**Last updated:** [December 7, 2024, 1:42am UTC](https://www.isharkfly.com/t/ubuntu/16717 "2024-12-07T01:42:55Z")

</div>

一直用的 REHL 做的服务器，自从 CentOS 不再更新后就开始用 Fedora 做的服务器。 但 Fedora 的版本更新太快了，作为服务器来说，长期不更新这个是很正常的事情，再三考虑下准备入 Ubuntu 的坑。 装了一台新的服务器，发现 htop 已经是默认组件了。 少装一个组件。 对比下 Redhat 家族 最重要的就是包管理器，因为服务器上都会安装不同的包，所以包管理器的不同也会影响到很多实际的使用。 …

---

## [都 2023 了，还在用 CentOS 吗](https://www.isharkfly.com/t/2023-centos/14415)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [May 6, 2023, 11:34am UTC](https://www.isharkfly.com/t/2023-centos/14415 "2023-05-06T11:34:07Z")

</div>

自 1994 年面世以来，红帽 Linux 已经陪伴开发者们走过了将近 30 年的旅程。2014 年红帽吸纳了 CentOS 社区主要成员包括当时的项目领导者、核心项目贡献者。Red Hat 和 CentOS 项目联手，目的是开发用于企业 IT 的下一代 Linux 创新技术。这些年，我们看到开源模型继续蓬勃发展，推动了 Linux 容器、Kubernetes、微服务、无服务器等的兴起。 鉴于社区推动的创新步伐迅速，社区领导层在 20…

---

## [今天我遇到个奇葩 事，我用的1panel面板，竟然不会装FTP!](https://www.isharkfly.com/t/1panel-ftp/16713)

<div class="topic-metadata">

**Author:** [@Ava](https://www.isharkfly.com/u/Ava)\
**Replies:** 3\
**Last updated:** [December 5, 2024, 5:54pm UTC](https://www.isharkfly.com/t/1panel-ftp/16713 "2024-12-05T17:54:14Z")

</div>

遇到了一个问题，国外的开发者需要到FTP，然后访问文件，问我账号，我搞了俩个多小时，失败了，弄了SFTPGo，也失败了，搜了站内不少教程，试了不少方法，还是失败了， :rofl: FTP就是连不上，什么防火都关了。 SFTPGo，安装了，管理员也能进去，弄一个虚似文件夹，然后增加用户，指定文件，都没有搞成功，技术不行呀。 有人懂SFTPGo，咋用的不？

---

## [Discourse 安装或者编译的时候提示 github 不能被解析](https://www.isharkfly.com/t/discourse-github/47)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [May 19, 2020, 8:39pm UTC](https://www.isharkfly.com/t/discourse-github/47 "2020-05-19T20:39:06Z")

</div>

Discourse 安装或者重新编译的时候提示 github 不能被解析。 提示的是 DNS 错误。 具体的提示是： fatal: unable to access ‘GitHub - discourse/pups: Simple yaml based bootstrapper for Linux machines’: Could not resolv 这个有可能是你服务器的防火墙的问题。 有可能会出现防火墙封闭了你需要的端口 …

---

## [Linux 如何进行系统级的备份和恢复](https://www.isharkfly.com/t/linux/16367)

<div class="topic-metadata">

**Author:** [@whitewatercn](https://www.isharkfly.com/u/whitewatercn)\
**Replies:** 7\
**Last updated:** [October 4, 2024, 3:22am UTC](https://www.isharkfly.com/t/linux/16367 "2024-10-04T03:22:58Z")

</div>

macOS有Time Machine非常方便，请问linux有类似的工具吗？大家自己的Linux如何进行备份恢复的？ 搜到了timeshift，正在尝试使用 我之前在用阿里云的时候可以直接买他们的备份服务，但现在的vps厂家没有这个功能，所以得想办法备份到本地，未来需要再恢复到新的vps上

---

## [如何设置防火墙，只允许指定ip主机访问本机指定端口](https://www.isharkfly.com/t/ip/16294)

<div class="topic-metadata">

**Author:** [@whitewatercn](https://www.isharkfly.com/u/whitewatercn)\
**Replies:** 5\
**Last updated:** [September 15, 2024, 4:36pm UTC](https://www.isharkfly.com/t/ip/16294 "2024-09-15T16:36:34Z")

</div>

小白询问一下，根据网上的答案我试了 网上教程 使用 ufw 启用 ufw 防火墙： sudo ufw enable 允许特定IP访问特定端口（例如，允许IP地址 192.168.1.100 访问端口 22）： sudo ufw allow from 192.168.1.100 to any port 22 查看防火墙状态： sudo ufw status verbose 我的输入 下面的终端信息只保留了5984端口相…

---

## [服务器源IP暴露了 套cdn是不是没用了](https://www.isharkfly.com/t/ip-cdn/16235)

<div class="topic-metadata">

**Author:** [@upsolution](https://www.isharkfly.com/u/upsolution)\
**Replies:** 8\
**Last updated:** [September 6, 2024, 3:00pm UTC](https://www.isharkfly.com/t/ip-cdn/16235 "2024-09-06T15:00:10Z")

</div>

事情是这样的，网站建好后，没有套cdn直接裸奔，然后这两天网站被DDOS攻击了，我怀疑是服务器IP泄露，然后被人攻击。 然后，我想问一下，现在我如果现在套cdn的话是不是没用了，还可以被人攻击？

---

## [在 Ubuntu 10.10 中安装 MariaDB Debian 软件包](https://www.isharkfly.com/t/ubuntu-10-10-mariadb-debian/13149)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 0\
**Last updated:** [September 24, 2013, 3:24am UTC](https://www.isharkfly.com/t/ubuntu-10-10-mariadb-debian/13149 "2013-09-24T03:24:07Z")

</div>

英文名称【Installing MariaDB Debian Packages on Ubuntu 10.10】

---

## [Alpine Linux apk 包管理](https://www.isharkfly.com/t/alpine-linux-apk/15752)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [May 15, 2024, 3:27am UTC](https://www.isharkfly.com/t/alpine-linux-apk/15752 "2024-05-15T03:27:23Z")

</div>

镜像源配置 官方镜像源列表：http://dl-cdn.alpinelinux.org/alpine/MIRRORS.txt MIRRORS.txt中是当前Alpine官方提供的镜像源（Alpine安装的时候系统自动选择最佳镜像源） 国内镜像源 清华TUNA镜像源：https://mirror.tuna.tsinghua.edu.cn/alpine/ 中科大镜像源：http://mirrors.ustc.edu.cn/al…

---

## [Alpine Linux Docker 中 Nginx 配置文件](https://www.isharkfly.com/t/alpine-linux-docker-nginx/15749)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [May 14, 2024, 10:03pm UTC](https://www.isharkfly.com/t/alpine-linux-docker-nginx/15749 "2024-05-14T22:03:03Z")

</div>

与 RHEL 及其衍生 Linux 的配置不同。 Alpine Linux 中 nginx 的配置文件在：/etc/nginx/http.d 目录下。 这个与其他操作系统中的 conf.d 目录中保存配置文件是不一样的。 当我们用 Docker 容器管理器打开文件夹的文件的时候，我们可以看到文件的内容。 需要注意的是这个配置文件是以 server 为包裹的扩展配置文件。 内容大致为： # This is a de…

---

## [Ubuntu/Debian 衍生版本](https://www.isharkfly.com/t/ubuntu-debian/15735)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [May 15, 2024, 12:19am UTC](https://www.isharkfly.com/t/ubuntu-debian/15735 "2024-05-15T00:19:53Z")

</div>

Debian 和 Ubuntu 都是目前较为流行的 Debian 系列 的服务器操作系统，十分适合研发场景。 Debian 和 Ubuntu 属于同一系列的发行版。Debian 是由 Ian Murdock 在 1993 年创建的最初的发行版。Ubuntu 是 Mark Shuttleworth 在 2004 年基于 Debian 创建的发行版。 Linux 发行版虽然有数百个，但其中只有少数是从零开始的独立发行版。 Debi…

---

## [Ubuntu 操作系统](https://www.isharkfly.com/t/ubuntu/15738)

<div class="topic-metadata">

**Author:** [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Replies:** 1\
**Last updated:** [May 15, 2024, 12:18am UTC](https://www.isharkfly.com/t/ubuntu/15738 "2024-05-15T00:18:26Z")

</div>

Ubuntu（国际音标：/ʊˈbʊntuː/，uu-BUUN-too）是基于Debian，以桌面应用为主的Linux发行版。Ubuntu有三个正式版本，包括桌面版、服务器版及用于物联网设备和机器人的Core版。前述三个版本既能安装于实体电脑，也能安装于虚拟电脑。从17.10版本开始，Ubuntu以GNOME为默认桌面环境。 Ubuntu是著名的Linux发行版之一，也是目前最多用户的Linux版本。Ubuntu每六个月（即每年的…

---

## [Alpine Linux 确定 nginx 是否在运行](https://www.isharkfly.com/t/alpine-linux-nginx/15748)

<div class="topic-metadata">

**Author:** [@hex](https://www.isharkfly.com/u/hex)\
**Replies:** 0\
**Last updated:** [May 14, 2024, 9:40pm UTC](https://www.isharkfly.com/t/alpine-linux-nginx/15748 "2024-05-14T21:40:37Z")

</div>

确定进程在 Linux 中是否运行，主要看进程是否在运行和端口是否被占用。 不同的操作系统的命令也会有一些不一样。 针对 Alpine 操作系统。 查看进程 查看 nginx 进程是否在运行的命令为： ps aux | grep "\[n|N\]ginx" 服务器输出为： / # ps aux | grep "\[n|N\]ginx" 169 root 0:00 nginx: master process /usr/s…

[Next page](https://www.isharkfly.com/tag/linux/37.md?match_all_tags=true&page=1&tags%5B%5D=linux)
