mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
translated
This commit is contained in:
parent
3ab6b7ecae
commit
b27c0ad65c
@ -1,122 +0,0 @@
|
||||
[#]: subject: "How to Setup Internet in CentOS, RHEL, Rocky Linux Minimal Install"
|
||||
[#]: via: "https://www.debugpoint.com/setup-internet-minimal-install-server/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Setup Internet in CentOS, RHEL, Rocky Linux Minimal Install
|
||||
======
|
||||
Setting up the internet or network is super easy in a minimal server install. This guide will explain how to setup the internet or network in CentOS, RHEL, and Rocky Linux minimal install.
|
||||
|
||||
Once you install the minimal install of any server distributions, you will not have any GUI or desktop environment to setup your network or internet. Hence it is essential to know how you can setup internet when you only have access to the terminal. The NetworkManager utility provides necessary tools armed with systemd services to do the job. Here’s how.
|
||||
|
||||
### Setup Internet in CentOS, RHEL, Rocky Linux Minimal Install
|
||||
|
||||
* After you have completed the server installation, boot into the server terminal. Ideally, you should be prompted with a terminal. Login using a root or admin account.
|
||||
|
||||
* Firstly, try to check the state of the network interface and details using [nmcli][1]. The `nmcli` is a command-line tool for controlling the NetworkManager service. Use the following command to check.
|
||||
|
||||
```
|
||||
nmcli device status
|
||||
```
|
||||
|
||||
This would display the device name, status etc.
|
||||
|
||||
![nmcli device status][2]
|
||||
|
||||
* Run the tool `nmtui` to configure the network interface.
|
||||
* The nmtui is part of the NetworkManager tool, which gives you a friendly UI to configure the network.
|
||||
* This is part of the `NetworkManager-tui` package and should be installed by default when you have completed the minimal server installation.
|
||||
|
||||
```
|
||||
nmtui
|
||||
```
|
||||
|
||||
* Click on Edit a connection in the nmtui window.
|
||||
|
||||
![nmtui - Select options][3]
|
||||
|
||||
* Select the interface name
|
||||
|
||||
![Select Interface to Edit][4]
|
||||
|
||||
* In the Edit Connection window, choose Automatic for IPv4 and IPv6. And select Automatically Connect. Press ok once done.
|
||||
|
||||
![nmtui - Edit Connection][5]
|
||||
|
||||
* Restart the NetworkManager service via the [systemd systemctl][6] using the following command.
|
||||
|
||||
```
|
||||
systemctl restart NetworkManager
|
||||
```
|
||||
|
||||
* If all goes well, you should be connected to the network and internet with minimal installation of CentOS, RHEL, and Rocky Linux servers. Provided your network has internet connectivity. You can use ping to verify whether it is working.
|
||||
|
||||
![setup internet minimal server - CentOS Rocky Linux RHEL][7]
|
||||
|
||||
### Additional Tip: Setup Static IP in minimal server
|
||||
|
||||
When you set the network configuration as automatic, the interface dynamically assigns the IP when you connect to the internet. In some situations where you are setting up a local area network (LAN), you may want to assign static IP to your network interface. It’s super easy.
|
||||
|
||||
Open the network configuration script for your network. Change the highlighted part for your own device.
|
||||
|
||||
```
|
||||
vi /etc/sysconfig/network-scripts/ifcfg-ens3
|
||||
```
|
||||
|
||||
In the above file, add the IP address you desire with the property IPADDR. Save the file.
|
||||
|
||||
```
|
||||
IPADDR=192.168.0.55
|
||||
```
|
||||
|
||||
Add the gateway for your network in `/etc/sysconfig/network`.
|
||||
|
||||
```
|
||||
NETWORKING=yes
|
||||
HOSTNAME=debugpoint
|
||||
GATEWAY=10.1.1.1
|
||||
```
|
||||
|
||||
Add any public DNS server in `resolv.conf` located at `/etc/resolv.conf`.
|
||||
|
||||
nameserver 8.8.8.8nameserver 8.8.4.4
|
||||
|
||||
And restart the network service.
|
||||
|
||||
```
|
||||
systemctl restart NetworkManager
|
||||
```
|
||||
|
||||
This will complete the setup of the static IP. You can also check the IP details using `ip addr` command.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
I hope this guide helps you to setup the network, internet, and static IP in your minimal install server. Let me know in the comment section if you may have any questions.
|
||||
|
||||
[Next: XeroLinux Review: Stunning Linux Distribution with Arch and KDE Plasma][8]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/setup-internet-minimal-install-server/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://linux.die.net/man/1/nmcli
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2021/06/nmcli-device-status.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/06/nmtui-Select-options.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2021/06/Select-Interface-to-Edit.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2021/06/nmtui-Edit-Connection.jpg
|
||||
[6]: https://www.debugpoint.com/2020/12/systemd-systemctl-service/
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2021/06/setup-internet-minimal-server-CentOS-Rocky-Linux-RHEL.jpg
|
||||
[8]: https://www.debugpoint.com/xerolinux-review/
|
@ -0,0 +1,123 @@
|
||||
[#]: subject: "How to Setup Internet in CentOS, RHEL, Rocky Linux Minimal Install"
|
||||
[#]: via: "https://www.debugpoint.com/setup-internet-minimal-install-server/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 CentOS、RHEL、Rocky Linux 最小安装中设置互联网
|
||||
======
|
||||
在最小的服务器安装中设置互联网或网络非常容易。本指南将解释如何在 CentOS、RHEL 和 Rocky Linux 最小安装中设置互联网或网络。
|
||||
|
||||
|
||||
当你安装了任何服务器发行版的最小安装,你将没有任何 GUI 或桌面环境来设置你的网络或互联网。因此,当你只能访问终端时,了解如何设置互联网非常重要。 NetworkManager 工具提供了必要的工具和 systemd 服务来完成这项工作。以下是方法。
|
||||
|
||||
### 在 CentOS、RHEL、Rocky Linux 最小安装中设置互联网
|
||||
|
||||
* 在你完成了服务器的安装后,启动进入服务器终端。理想情况下,你会看到一个终端。使用 root 或管理员账户登录。
|
||||
|
||||
* 首先,尝试使用 [nmcli][1] 检查网络接口的状态和详细信息。 `nmcli` 是用于控制 NetworkManager 服务的命令行工具。使用以下命令进行检查。
|
||||
|
||||
```
|
||||
nmcli device status
|
||||
```
|
||||
|
||||
这将显示设备名称、状态等。
|
||||
|
||||
![nmcli device status][2]
|
||||
|
||||
* 运行工具 `nmtui` 来配置网络接口。
|
||||
* nmtui 是 NetworkManager 工具的一部分,它为你提供了一个友好的用户界面来配置网络。
|
||||
* 这是 `NetworkManager-tui` 包的一部分,在你完成最小服务器安装后默认安装。
|
||||
|
||||
```
|
||||
nmtui
|
||||
```
|
||||
|
||||
* 单击 nmtui 窗口中的编辑连接。
|
||||
|
||||
![nmtui - 选择选项][3]
|
||||
|
||||
* 选择接口名称
|
||||
|
||||
![选择要编辑的接口][4]
|
||||
|
||||
* 在编辑连接窗口中,为 IPv4 和 IPv6 选择自动。并选择自动连接。完成后按 OK。
|
||||
|
||||
![nmtui - 编辑连接][5]
|
||||
|
||||
* 使用以下命令通过 [systemd systemctl][6] 重启 NetworkManager 服务。
|
||||
|
||||
```
|
||||
systemctl restart NetworkManager
|
||||
```
|
||||
|
||||
* 如果一切顺利,你可以在最小安装的 CentOS、RHEL 和 Rocky Linux 服务器中连接到网络和互联网。前提是你的网络有互联网连接。你可以使用 ping 来验证它是否正常工作。
|
||||
|
||||
![设置最小化服务器互联网 - CentOS Rocky Linux RHEL][7]
|
||||
|
||||
### 附加技巧:在最小化服务器中设置静态 IP
|
||||
|
||||
当你将网络配置设置为自动时,接口会在你连接到互联网时动态分配 IP。在你设置局域网 (LAN) 的某些情况下,你可能希望将静态 IP 分配给你的网络接口。这非常容易。
|
||||
|
||||
打开你的网络配置脚本。将高亮部分设置为你自己的设备。
|
||||
|
||||
```
|
||||
vi /etc/sysconfig/network-scripts/ifcfg-ens3
|
||||
```
|
||||
|
||||
在上面的文件中,使用 IPADDR 属性添加所需的 IP 地址。保存文件。
|
||||
|
||||
```
|
||||
IPADDR=192.168.0.55
|
||||
```
|
||||
|
||||
在 `/etc/sysconfig/network` 中为你的网络添加网关。
|
||||
|
||||
```
|
||||
NETWORKING=yes
|
||||
HOSTNAME=debugpoint
|
||||
GATEWAY=10.1.1.1
|
||||
```
|
||||
|
||||
在位于 `/etc/resolv.conf` 的 `resolv.conf` 中添加任意公共 DNS 服务器。
|
||||
|
||||
```
|
||||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
```
|
||||
|
||||
然后重启网络服务。
|
||||
|
||||
```
|
||||
systemctl restart NetworkManager
|
||||
```
|
||||
|
||||
这就完成了静态 IP 的设置。你还可以使用 `ip addr` 命令检查 IP 详细信息。
|
||||
|
||||
### 总结
|
||||
|
||||
我希望本指南可以帮助你在最小化安装的服务器中设置网络、互联网和静态 IP。如果你有任何问题,请在评论区告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/setup-internet-minimal-install-server/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://linux.die.net/man/1/nmcli
|
||||
[2]: https://www.debugpoint.com/wp-content/uploads/2021/06/nmcli-device-status.jpg
|
||||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/06/nmtui-Select-options.jpg
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2021/06/Select-Interface-to-Edit.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2021/06/nmtui-Edit-Connection.jpg
|
||||
[6]: https://www.debugpoint.com/2020/12/systemd-systemctl-service/
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2021/06/setup-internet-minimal-server-CentOS-Rocky-Linux-RHEL.jpg
|
Loading…
Reference in New Issue
Block a user