Linux 静态IP设置,Nginx安装,cockpit(Linuxweb监控工具)

  Ret Hat8 网络管理默认使用的是NetworkManager,而不是之前版本的network.

 

Ret Hat8 静态IP设置

手动添加静态IP地址:

  

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens160
UUID=69efd393-9c4a-4a66-9c72-e3c684d831ce
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.1.10
PREFIX=24

  通过配置文件修改IP并没有生效。(修改我文件前一定要对文件进行备份,养成良好的习惯)。

  
Linux 配置静态IP_nginx

 

  这是因为Red Hat8版本已经不推荐原来的文件配置方式,而是用推荐的命令形式修改

Linux 配置静态IP_nginx_02

 

  这是因为Red Hat8版本已经不推荐通过配置文件来修改,而是推荐使用命令方式修改。

   nmcli is command-line too for controlling NetWorkManager and reporting network status.

  nmcli is used to create, display, edit, active, and deactive network connections, as well as control and display network device status.

  COMMAND

  nmcli connection modify ens160 ipv4.addresses 192.168.1.10/24 ipv4.method manual ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1 --修改网络配置

  nmcli connection down ens160 --停用ens160网卡

  nmcli connection up ens160--启用ens160网卡

  (Red Hat8之前的版本使用的命令是 service network restart--重启网络;在8上使用需要安装:network-scripts 包)

 

  

Red Hat Web界面管理

  Red Hat8 默认支持cockpit,cockpit是开源的基于web的轻量级管理工具,系统管理员可以执行注入诸如存储管理,网络配置,检查日志,管理容器等任务

  安装:yum -y install cockpit cockpit-dashboard cockpit-storaged cockpit-packagekit

  Linux 配置静态IP_Linux_03

 

 

   这里已经安装过了就不在重新安装了

  systemctl enable --now cockpit.socket   --启用cockpit服务

  启用成功后访问,web网页

  Linux 配置静态IP_Linux_04

 

 

  登录界面输入用户名和密码

  Linux 配置静态IP_html_05

 

 

 

  多机监控

  如下图添加需要监控的主机,输入需要添加的IP用户

Linux 配置静态IP_网络配置_06

 

 

 Linux 配置静态IP_html_07

 

 

 

 

安装Nginx

  yum install nginx -y

  systemctl enable --now nginx  (这个是Red Hat8新增的立即启动命令,相当于:systemctl nginx 和systemctl enable nginx 两条命令)

  启动之后查看服务进程;

  Linux 配置静态IP_Linux_08

 

 

   访问测试页面:

Linux 配置静态IP_网络配置_09

 

 

 

 

参考:

  https://developer-old.gnome.org/NetworkManager/unstable/nmcli.html

  https://www.cnblogs.com/mind-water/p/12079647.html

  https://www.cnblogs.com/l-hh/p/12301143.html