当前位置: 首页 > news >正文

Linux系统服务管理

服务命令比较

操作

Linux 6

Linux7

服务开机自动启动

chkconfig --level 35 iptables on

systemctl enable firewalld.service

服务器开机不自动启动

chkconfig --level 35 iptables off

systemctl disable firewalld.service

加入自定义服务

chkconfig --add aaa

systemctl load aaa.service

删除服务

chkconfig --del aaa

停止服务,删除相应的配置文件

显示所有已经启动的服务

chkconfig -- list

systemctl list-unis --type=service

启动服务

service iptables start

systemctl start firewalld.service

停止服务

service iptables stop

systemctl stop firewalld.service

服务状态

service iptables status

systemctl status firewalld.service

重启服务

service iptables restart

systemctl restart firewalld.service

Linux 6

[root@mysql57 ~]# service iptables status
iptables: Firewall is not running.[root@mysql57 ~]# service iptables start
iptables: Applying firewall rules:                         [  OK  ]
[root@mysql57 ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         
[root@mysql57 ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@mysql57 ~]# service iptables status
iptables: Firewall is not running.[root@mysql57 ~]# chkconfig --list | more
NetworkManager     0:off    1:off    2:off    3:off    4:off    5:off    6:off
abrt-ccpp          0:off    1:off    2:off    3:on    4:off    5:on    6:off
abrtd              0:off    1:off    2:off    3:on    4:off    5:on    6:off
acpid              0:off    1:off    2:on    3:on    4:on    5:on    6:off
atd                0:off    1:off    2:off    3:on    4:on    5:on    6:off
auditd             0:off    1:off    2:on    3:on    4:on    5:on    6:off
autofs             0:off    1:off    2:off    3:on    4:on    5:on    6:off
blk-availability    0:off    1:on    2:on    3:on    4:on    5:on    6:off
bluetooth          0:off    1:off    2:off    3:on    4:on    5:on    6:off
certmonger         0:off    1:off    2:off    3:on    4:on    5:on    6:off
cpuspeed           0:off    1:on    2:on    3:on    4:on    5:on    6:off
crond              0:off    1:off    2:on    3:on    4:on    5:on    6:off
cups               0:off    1:off    2:on    3:on    4:on    5:on    6:off
dnsmasq            0:off    1:off    2:off    3:off    4:off    5:off    6:off
firstboot          0:off    1:off    2:off    3:off    4:off    5:off    6:off
haldaemon          0:off    1:off    2:off    3:on    4:on    5:on    6:off
htcacheclean       0:off    1:off    2:off    3:off    4:off    5:off    6:off
httpd              0:off    1:off    2:off    3:off    4:off    5:off    6:off
ip6tables          0:off    1:off    2:on    3:on    4:on    5:on    6:off
iptables           0:off    1:off    2:off    3:off    4:off    5:off    6:off
irqbalance         0:off    1:off    2:off    3:on    4:on    5:on    6:off
kdump              0:off    1:off    2:off    3:off    4:off    5:off    6:off
lvm2-monitor       0:off    1:on    2:on    3:on    4:on    5:on    6:off
mdmonitor          0:off    1:off    2:on    3:on    4:on    5:on    6:off
messagebus         0:off    1:off    2:on    3:on    4:on    5:on    6:off
netconsole         0:off    1:off    2:off    3:off    4:off    5:off    6:off
netfs              0:off    1:off    2:off    3:on    4:on    5:on    6:off
network            0:off    1:off    2:on    3:on    4:on    5:on    6:off
nfs                0:off    1:off    2:off    3:off    4:off    5:off    6:off
nfslock            0:off    1:off    2:off    3:on    4:on    5:on    6:off
ntpd               0:off    1:off    2:off    3:off    4:off    5:off    6:off
ntpdate            0:off    1:off    2:off    3:off    4:off    5:off    6:off
oddjobd            0:off    1:off    2:off    3:off    4:off    5:off    6:off
portreserve        0:off    1:off    2:on    3:on    4:on    5:on    6:off
postfix            0:off    1:off    2:on    3:on    4:on    5:on    6:off
psacct             0:off    1:off    2:off    3:off    4:off    5:off    6:off
quota_nld          0:off    1:off    2:off    3:off    4:off    5:off    6:off35启动级别关闭自启动
[root@mysql57 ~]# chkconfig --level 35 iptables off[root@mysql57 ~]# ls /etc/init.d/
abrt-ccpp         cups              irqbalance        nfslock           rngd              spice-vdagentd
abrtd             dnsmasq           kdump             ntpd              rpcbind           sshd
abrt-oops         firstboot         killall           ntpdate           rpcgssd           sssd
acpid             functions         lvm2-lvmetad      oddjobd           rpcidmapd         sysstat
atd               haldaemon         lvm2-monitor      ohasd             rpcsvcgssd        udev-post
auditd            halt              mdmonitor         portreserve       rsyslog           wdaemon
autofs            htcacheclean      messagebus        postfix           sandbox           winbind
blk-availability  httpd             netconsole        psacct            saslauthd         wpa_supplicant
bluetooth         init.ohasd        netfs             quota_nld         single            ypbind
certmonger        init.tfa          network           rdisc             smartd            
cpuspeed          ip6tables         NetworkManager    restorecond       snmpd             
crond             iptables          nfs               rhnsd             snmptrapd         

Linux 7


[root@mysql57 ~]# cd /etc/systemd/system/
basic.target.wants/
bluetooth.target.wants/
default.target.wants/
dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants/
getty.target.wants/
graphical.target.wants/
local-fs.target.wants/
multi-user.target.wants/
network-online.target.wants/
printer.target.wants/
remote-fs.target.wants/
sockets.target.wants/
sysinit.target.wants/
systemd-remount-fs.service.wants/
system-update.target.wants/
timers.target.wants/
vmtoolsd.service.requires/
[root@mysql57 ~]# cd /etc/systemd/system/
[root@mysql57 system]# ls
basic.target.wants
bluetooth.target.wants
dbus-org.bluez.service
dbus-org.fedoraproject.FirewallD1.service
dbus-org.freedesktop.Avahi.service
dbus-org.freedesktop.ModemManager1.service
dbus-org.freedesktop.nm-dispatcher.service
default.target
default.target.wants
dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants
display-manager.service
getty.target.wants
graphical.target.wants
local-fs.target.wants
multi-user.target.wants
network-online.target.wants
printer.target.wants
remote-fs.target.wants
sockets.target.wants
sysinit.target.wants
systemd-remount-fs.service.wants
system-update.target.wants
timers.target.wants
vmtoolsd.service.requires[root@mysql57 system]# cd multi-user.target.wants/
[root@mysql57 multi-user.target.wants]# ls
abrt-ccpp.service     initial-setup-reconfiguration.service  remote-fs.target
abrtd.service         irqbalance.service                     rhel-configure.service
abrt-oops.service     ksm.service                            rngd.service
abrt-vmcore.service   ksmtuned.service                       rpcbind.service
abrt-xorg.service     libstoragemgmt.service                 rsyslog.service
atd.service           libvirtd.service                       smartd.service
auditd.service        mcelog.service                         sshd.service
avahi-daemon.service  mdmonitor.service                      sysstat.service
brandbot.path         ModemManager.service                   tuned.service
crond.service         NetworkManager.service                 vdo.service
cups.path             nfs-client.target                      vmtoolsd.service
cups.service          oracleasm.service
firewalld.service     postfix.service[root@mysql57 multi-user.target.wants]# cd ..
[root@mysql57 system]# find ./ -name fire*
./multi-user.target.wants/firewalld.service
[root@mysql57 system]# cd multi-user.target.wants/[root@mysql57 multi-user.target.wants]# cd /usr/lib/systemd/
[root@mysql57 systemd]# ls
catalog                 systemd-coredump           systemd-shutdown
import-pubring.gpg      systemd-cryptsetup         systemd-shutdownd
ntp-units.d             systemd-fsck               systemd-sleep
ol-consolebaud          systemd-hibernate-resume   systemd-socket-proxyd
rhel-autorelabel        systemd-hostnamed          systemd-sysctl
rhel-configure          systemd-importd            systemd-sysv-install
rhel-dmesg              systemd-initctl            systemd-timedated
rhel-dmraid-activation  systemd-journald           systemd-udevd
rhel-domainname         systemd-localed            systemd-update-done
rhel-import-state       systemd-logind             systemd-update-utmp
rhel-loadmodules        systemd-machined           systemd-user-sessions
rhel-readonly           systemd-machine-id-commit  systemd-vconsole-setup
scripts                 systemd-modules-load       system-generators
system                  systemd-pstore             system-preset
systemd                 systemd-pull               system-shutdown
systemd-ac-power        systemd-quotacheck         system-sleep
systemd-activate        systemd-random-seed        user
systemd-backlight       systemd-readahead          user-generators
systemd-binfmt          systemd-remount-fs         user-preset
systemd-bootchart       systemd-reply-password
systemd-cgroups-agent   systemd-rfkill[root@mysql57 systemd]# systemctl status firewalld.service 
实际加载的/usr/lib/systemd/system/firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: active (running) since Tue 2022-08-23 13:05:37 CST; 12min agoDocs: man:firewalld(1)Main PID: 1026 (firewalld)Tasks: 2CGroup: /system.slice/firewalld.service└─1026 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopidAug 23 13:05:36 mysql57.example.com systemd[1]: Starting firewalld - dynamic firewal.....
Aug 23 13:05:37 mysql57.example.com systemd[1]: Started firewalld - dynamic firewall...n.
Aug 23 13:05:37 mysql57.example.com firewalld[1026]: WARNING: AllowZoneDrifting is en....
Hint: Some lines were ellipsized, use -l to show in full.[root@mysql57 system]# ls | grep firewalld
firewalld.service
[root@mysql57 system]# pwd
/usr/lib/systemd/system关闭防火墙
[root@mysql57 system]# systemctl stop firewalld.service disable
[root@mysql57 system]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.启动防护墙,开机不启动因为是disabled
[root@mysql57 system]# systemctl start firewalld.service 
[root@mysql57 system]# systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since Tue 2022-08-23 15:14:24 CST; 2s agoDocs: man:firewalld(1)Main PID: 4701 (firewalld)Tasks: 4CGroup: /system.slice/firewalld.service├─4701 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid├─4729 /usr/sbin/modprobe nf_conntrack├─4730 sh -c /usr/sbin/modprobe --ignore-install nf_conntrack  && /usr/sb...└─4731 /usr/sbin/modprobe --ignore-install nf_conntrackAug 23 15:14:19 mysql57.example.com systemd[1]: Starting firewalld - dynamic firewal.....
Aug 23 15:14:24 mysql57.example.com systemd[1]: Started firewalld - dynamic firewall...n.
Aug 23 15:14:25 mysql57.example.com firewalld[4701]: WARNING: AllowZoneDrifting is en....
Hint: Some lines were ellipsized, use -l to show in full.

相关文章:

Linux系统服务管理

服务命令比较 操作 Linux 6 Linux7 服务开机自动启动 chkconfig --level 35 iptables on systemctl enable firewalld.service 服务器开机不自动启动 chkconfig --level 35 iptables off systemctl disable firewalld.service 加入自定义服务 chkconfig --add aaa s…...

C#之控制台版本得贪吃蛇

贪吃蛇小时候大家都玩过,具体步骤如下: 1.给游戏制造一个有限得空间。 2.生成墙壁,小蛇碰撞到墙壁或者咬到自己的尾巴,游戏结束。 3.生成随机的食物。 4.吃掉食物,增加自身的体长,并生成新的食物。 具体代码如下&…...

ffplay数据结构分析(一)

本文为相关课程的学习记录,相关分析均来源于课程的讲解,主要学习音视频相关的操作,对字幕的处理不做分析 下面我们对ffplay的相关数据结构进行分析,本章主要是对PacketQueue的讲解 struct MyAVPacketList和PacketQueue队列 ffp…...

JavaWeb学习|JSP相关内容

1.什么是JSP Java Server Pages: Java服务器端页面,也和Servlet一样,用于动态Web技术! 最大的特点: 。写JSP就像在写HTML 。区别: 。HTML只给用户提供静态的数据 。JSP页面中可以嵌入JAVA代码,为用户提供动态数据 JSP最终也会被转换成为一…...

Springboot后端通过路径映射获取本机图片资源

项目场景: 项目中对图片的处理与查看是必不可少的,本文将讲解如何通过项目路径来获取到本机电脑的图片资源 如图所示,在我的本机D盘的图片测试文件夹(文件夹名字不要有中文)下有一些图片, 我们要在浏览器上访问到这些图片&#…...

【IDEA + Spark 3.4.1 + sbt 1.9.3 + Spark MLlib 构建鸢尾花决策树分类预测模型】

决策树进行鸢尾花分类的案例 背景说明: 通过IDEA Spark 3.4.1 sbt 1.9.3 Spark MLlib 构建鸢尾花决策树分类预测模型,这是一个分类模型案例,通过该案例,可以快速了解Spark MLlib分类预测模型的使用方法。 依赖 ThisBuild /…...

亚马逊 EC2服务器下部署java环境

1. jdk 1.8 安装 1.1 下载jdk包 官网 Java Downloads | Oracle tar.gz 包 下载下来 1.2 本地连接 服务器 我用的是亚马逊的ec2 系统是 ubuntu 的 ssh工具是 Mobaxterm , 公有dns 创建实例时的秘钥 链接 Mobaxterm 因为使用的 ubuntu 所以登录的 名称 就是 ubuntu 然后 …...

CTF流量题解http1.pcapng

使用Wireshark工具打开流量文件http1.pcapng,如下图所示。 在过滤检索栏输入http,wireshark自动进行过滤。...

若依vue前端有全局用户信息变量吗

"若依"是一个基于SpringBoot和Vue的前后端分离的开源项目。在前端Vue部分,全局用户信息通常保存在Vuex中,Vuex是Vue.js的状态管理模式。它提供了一个集中式存储来管理所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生…...

什么是Milvus

原文出处:https://www.yii666.com/blog/393941.html 什么是Milvus Milvus 是一款云原生向量数据库,它具备高可用、高性能、易拓展的特点,用于海量向量数据的实时召回。 Milvus 基于 FAISS、Annoy、HNSW 等向量搜索库构建,核心是…...

如何快速实现三菱FX3U程序的无线下载?

1.系统概述 三菱PLC FX3u可以使用专用下载线通过计算机串口下载程序,同样也可以使用自制下载线缆,连接无线模块 DTD435M进行远程无线下载程序,计算机端采用RS232或者RS485 将计算机端与无线模块连接,PLC端同样使用RS232转RS485将…...

Flink源码之RPC

Flink是一个典型的Master/Slave分布式实时处理系统,分布式系统组件之间必然涉及通信,也即RPC,以下图展示Flink组件之间的关系: RPCGateWay 一般RPC框架可根据用户业务类生成客户端和服务器端通信底层代码,此时只需定…...

【LeetCode 75】第二十四题(2390)从字符串中移除星号

目录 题目: 示例: 分析: 代码运行结果: 题目: 示例: 分析: 题目给我们一个字符串,然后字符串中包含星号*,要求每个星号消除一个从星号左边起最近的一个字符&#xf…...

通向架构师的道路之weblogic的集群与配置

一、Weblogic的集群 还记得我们在第五天教程中讲到的关于Tomcat的集群吗? 两个tomcat做node即tomcat1, tomcat2,使用Apache HttpServer做请求派发。 现在看看WebLogic的集群吧,其实也差不多。 区别在于: Tomcat的集群的实现为两个物理上…...

SpringBoot 项目创建与运行

一、Spring Boot 1、什么是Spring Boot?为什么要学 Spring Boot Spring 的诞生是为了简化 Java 程序的开发的,而 Spring Boot 的诞生是为了简化 Spring 程序开发的。 Spring Boot 翻译一下就是 Spring 脚手架 盖房子的这个架子就是脚手架,…...

FOHEART H1数据手套:连接虚拟与现实,塑造智能交互新未来

在全新交互时代背景中,数据手套无疑是一种重要的科技产物。它不仅彻底改变了我们与虚拟世界的互动方式,更为我们提供了一种全新、更为直观的交互形式。 FOHEART H1数据手套结合了虚拟现实、手势识别等高新技术,用先进的传感技术和精准的数据…...

MyBatis学习笔记3

日志 1.日志工厂 如果一个数据库的操作,出现了异常,我们需要排错。日志就是最好的工具。 日志工厂:SLF4JLOG4J(掌握)LOG4J2JDK_LOGGINGCOMMONS_LOGGINGSTDOUT_LOGGING(掌握)NO_LOGGING 2.分页 减少数据…...

ES6学习-Symbol

Symbol 数据类型Symbol,表示独一无二的值。 对象的属性名可有两种类型,一种是原来的字符串,另一种是新增的 Symbol 类型 可以保证不与其他属性名产生冲突。 let s1 Symbol() let s2 Symbol() console.log(s1, s2, s1 s2)//Symbol() Sy…...

【Redis】使用Docker镜像配置集群时的Operation timed out问题

不知道有没有小伙伴跟我一样是使用的Docker镜像进行Redis集群案例模拟的(三台虚拟机确实带不动 ),然后我遇到了一个问题:Could not connect to Redis at 172.17.0.2:6379: Operation timed out 172.17.0.2是我其中一个Redis实例的…...

Java 生产初学常用注解

目录 0. 基础语法逻辑运算符继承抛出异常获取数据方式泛型 1. 接收前端数据(controller)mybatis1. QueryWrapper获取和赋值 2. service 层注解 3. Dao 层(与数据库交互)3.1 mybatis-plus中BaseMapper 4. ELK框架es配置sql参数logs…...

Java如何权衡是使用无序的数组还是有序的数组

在 Java 中,选择有序数组还是无序数组取决于具体场景的性能需求与操作特点。以下是关键权衡因素及决策指南: ⚖️ 核心权衡维度 维度有序数组无序数组查询性能二分查找 O(log n) ✅线性扫描 O(n) ❌插入/删除需移位维护顺序 O(n) ❌直接操作尾部 O(1) ✅内存开销与无序数组相…...

linux arm系统烧录

1、打开瑞芯微程序 2、按住linux arm 的 recover按键 插入电源 3、当瑞芯微检测到有设备 4、松开recover按键 5、选择升级固件 6、点击固件选择本地刷机的linux arm 镜像 7、点击升级 (忘了有没有这步了 估计有) 刷机程序 和 镜像 就不提供了。要刷的时…...

Cinnamon修改面板小工具图标

Cinnamon开始菜单-CSDN博客 设置模块都是做好的,比GNOME简单得多! 在 applet.js 里增加 const Settings imports.ui.settings;this.settings new Settings.AppletSettings(this, HTYMenusonichy, instance_id); this.settings.bind(menu-icon, menu…...

【碎碎念】宝可梦 Mesh GO : 基于MESH网络的口袋妖怪 宝可梦GO游戏自组网系统

目录 游戏说明《宝可梦 Mesh GO》 —— 局域宝可梦探索Pokmon GO 类游戏核心理念应用场景Mesh 特性 宝可梦玩法融合设计游戏构想要素1. 地图探索(基于物理空间 广播范围)2. 野生宝可梦生成与广播3. 对战系统4. 道具与通信5. 延伸玩法 安全性设计 技术选…...

DeepSeek 技术赋能无人农场协同作业:用 AI 重构农田管理 “神经网”

目录 一、引言二、DeepSeek 技术大揭秘2.1 核心架构解析2.2 关键技术剖析 三、智能农业无人农场协同作业现状3.1 发展现状概述3.2 协同作业模式介绍 四、DeepSeek 的 “农场奇妙游”4.1 数据处理与分析4.2 作物生长监测与预测4.3 病虫害防治4.4 农机协同作业调度 五、实际案例大…...

2023赣州旅游投资集团

单选题 1.“不登高山,不知天之高也;不临深溪,不知地之厚也。”这句话说明_____。 A、人的意识具有创造性 B、人的认识是独立于实践之外的 C、实践在认识过程中具有决定作用 D、人的一切知识都是从直接经验中获得的 参考答案: C 本题解…...

蓝桥杯 冶炼金属

原题目链接 🔧 冶炼金属转换率推测题解 📜 原题描述 小蓝有一个神奇的炉子用于将普通金属 O O O 冶炼成为一种特殊金属 X X X。这个炉子有一个属性叫转换率 V V V,是一个正整数,表示每 V V V 个普通金属 O O O 可以冶炼出 …...

#Uniapp篇:chrome调试unapp适配

chrome调试设备----使用Android模拟机开发调试移动端页面 Chrome://inspect/#devices MuMu模拟器Edge浏览器:Android原生APP嵌入的H5页面元素定位 chrome://inspect/#devices uniapp单位适配 根路径下 postcss.config.js 需要装这些插件 “postcss”: “^8.5.…...

C/C++ 中附加包含目录、附加库目录与附加依赖项详解

在 C/C 编程的编译和链接过程中,附加包含目录、附加库目录和附加依赖项是三个至关重要的设置,它们相互配合,确保程序能够正确引用外部资源并顺利构建。虽然在学习过程中,这些概念容易让人混淆,但深入理解它们的作用和联…...

苹果AI眼镜:从“工具”到“社交姿态”的范式革命——重新定义AI交互入口的未来机会

在2025年的AI硬件浪潮中,苹果AI眼镜(Apple Glasses)正在引发一场关于“人机交互形态”的深度思考。它并非简单地替代AirPods或Apple Watch,而是开辟了一个全新的、日常可接受的AI入口。其核心价值不在于功能的堆叠,而在于如何通过形态设计打破社交壁垒,成为用户“全天佩戴…...