Linx-6.0.60 系统常用服务启停与管理指南

引言

在 Linux 系统的日常运维中,掌握常用服务的启停、状态查看以及开机自启配置是管理员必备的技能。本文档针对 Linx-6.0.60Linx-6.0.80Linx-6.0.100 系统,整理了包括 FTP、SSH、Web服务、数据库等在内的20项常用服务的操作命令,旨在为系统管理员提供一个快速、准确的参考手册。

适用范围

  • Linx-6.0.60
  • Linx-6.0.80
  • Linx-6.0.100

常用服务启停与管理命令

1. FTP 服务 (ProFTPD)

  • 端口:21
  • 服务启停命令
    • 启动:/etc/init.d/proftpd start
    • 停止:/etc/init.d/proftpd stop
    • 重启:/etc/init.d/proftpd restart
    • 查看状态:/etc/init.d/proftpd status
  • 开机自启配置
    • 开启自启:chkconfig proftpd on
    • 关闭自启:chkconfig proftpd off

2. SSH 服务

  • 端口:22
  • 服务启停命令
    • 启动:/etc/init.d/ssh start
    • 停止:/etc/init.d/ssh stop
    • 重启:/etc/init.d/ssh restart
    • 查看状态:/etc/init.d/ssh status
  • 开机自启配置
    • 开启自启:chkconfig ssh on
    • 关闭自启:chkconfig ssh off

3. Networking 网络服务

  • 服务启停命令
    • 启动:/etc/init.d/networking start
    • 停止:/etc/init.d/networking stop
    • 重启:/etc/init.d/networking restart
    • 查看状态:/etc/init.d/networking status
  • 开机自启配置
    • 开启自启:chkconfig networking on
    • 关闭自启:chkconfig networking off

4. Telnet 服务

  • 端口:23
  • 服务启停命令
    • 停止

      bash 复制代码
      sed -i "/^telnet/s/^/#/" /etc/inetd.conf
      /etc/init.d/openbsd-inetd restart
    • 开启

      bash 复制代码
      sed -i "/^#telnet/s/#//" /etc/inetd.conf
      /etc/init.d/openbsd-inetd restart

5. DNS 服务 (Bind9)

  • 端口:53
  • 服务启停命令
    • 启动:/etc/init.d/bind9 start
    • 停止:/etc/init.d/bind9 stop
    • 重启:/etc/init.d/bind9 restart
    • 查看状态:/etc/init.d/bind9 status
  • 开机自启配置
    • 开启自启:chkconfig bind9 on
    • 关闭自启:chkconfig bind9 off

6. Apache 服务

  • 端口:80
  • 服务启停命令
    • 启动:/etc/init.d/apache2 start
    • 停止:/etc/init.d/apache2 stop
    • 重启:/etc/init.d/apache2 restart
    • 查看状态:/etc/init.d/apache2 status
  • 开机自启配置
    • 开启自启:chkconfig apache2 on
    • 关闭自启:chkconfig apache2 off

7. Tomcat 服务

  • 端口:8080
  • 服务启停命令
    • 启动:/etc/init.d/tomcat6 start
    • 停止:/etc/init.d/tomcat6 stop
    • 重启:/etc/init.d/tomcat6 restart
    • 查看状态:/etc/init.d/tomcat6 status
  • 开机自启配置
    • 开启自启:chkconfig tomcat6 on
    • 关闭自启:chkconfig tomcat6 off

8. NTP 服务

  • 端口:123
  • 服务启停命令
    • 启动:/etc/init.d/ntp start
    • 停止:/etc/init.d/ntp stop
    • 重启:/etc/init.d/ntp restart
    • 查看状态:/etc/init.d/ntp status
  • 开机自启配置
    • 开启自启:chkconfig ntp on
    • 关闭自启:chkconfig ntp off

9. Samba 服务

  • 端口:445
  • 服务启停命令
    • 启动:/etc/init.d/samba start
    • 停止:/etc/init.d/samba stop
    • 重启:/etc/init.d/samba restart
    • 查看状态:/etc/init.d/samba status
  • 开机自启配置
    • 开启自启:chkconfig samba on
    • 关闭自启:chkconfig samba off

10. SWAT 服务

  • 端口:901
  • 服务启停命令
    • 停止

      bash 复制代码
      sed -i "/^swat/s/^/#/" /etc/inetd.conf
      /etc/init.d/openbsd-inetd restart
    • 开启

      bash 复制代码
      sed -i "/^#swat/s/#//" /etc/inetd.conf
      /etc/init.d/openbsd-inetd restart

11. GDM3 图形服务

  • 服务启停命令
    • 启动:/etc/init.d/gdm3 start
    • 停止:/etc/init.d/gdm3 stop
    • 重启:/etc/init.d/gdm3 restart
    • 查看状态:/etc/init.d/gdm3 status

12. Cron 计划任务服务

  • 服务启停命令
    • 启动:/etc/init.d/cron start
    • 停止:/etc/init.d/cron stop
    • 重启:/etc/init.d/cron restart
    • 查看状态:/etc/init.d/cron status

13. MySQL 服务

  • 端口:3306
  • 服务启停命令
    • 启动:/etc/init.d/mysql start
    • 停止:/etc/init.d/mysql stop
    • 重启:/etc/init.d/mysql restart
    • 查看状态:/etc/init.d/mysql status
  • 开机自启配置
    • 开启自启:chkconfig mysql on
    • 关闭自启:chkconfig mysql off

14. Rsyslog 日志服务

  • 服务启停命令
    • 启动:/etc/init.d/rsyslog start
    • 停止:/etc/init.d/rsyslog stop
    • 重启:/etc/init.d/rsyslog restart
    • 查看状态:/etc/init.d/rsyslog status

15. MCElog 日志服务

  • 服务启停命令
    • 启动:/etc/init.d/mcelog start
    • 停止:/etc/init.d/mcelog stop
    • 重启:/etc/init.d/mcelog restart
    • 查看状态:/etc/init.d/mcelog status

16. CUPS 打印机服务

  • 端口:631
  • 服务启停命令
    • 启动:/etc/init.d/cups start
    • 停止:/etc/init.d/cups stop
    • 重启:/etc/init.d/cups restart
    • 查看状态:/etc/init.d/cups status
  • 开机自启配置
    • 开启自启:chkconfig cups on
    • 关闭自启:chkconfig cups off

17. NFS 服务

  • 端口:2049

  • 服务启停命令

    • 启动

      bash 复制代码
      /etc/init.d/nfs-common start
      /etc/init.d/nfs-kernel-server start
      /etc/init.d/portmap start
    • 停止

      bash 复制代码
      /etc/init.d/nfs-common stop
      /etc/init.d/nfs-kernel-server stop
      /etc/init.d/portmap stop
    • 重启

      bash 复制代码
      /etc/init.d/nfs-common restart
      /etc/init.d/nfs-kernel-server restart
      /etc/init.d/portmap restart
    • 查看状态

      bash 复制代码
      /etc/init.d/nfs-common status
      /etc/init.d/nfs-kernel-server status
      /etc/init.d/portmap status
  • 开机自启配置

    • 开启自启:

      bash 复制代码
      chkconfig nfs-common on
      chkconfig nfs-kernel-server on
      chkconfig portmap on

18. SNMPd 服务

  • 端口:161
  • 服务启停命令
    • 启动:/etc/init.d/snmpd start
    • 停止:/etc/init.d/snmpd stop
    • 重启:/etc/init.d/snmpd restart
    • 查看状态:/etc/init.d/snmpd status
  • 开机自启配置
    • 开启自启:chkconfig snmpd on
    • 关闭自启:chkconfig snmpd off

19. Postfix 邮件服务

  • 服务启停命令
    • 启动:/etc/init.d/postfix start
    • 停止:/etc/init.d/postfix stop
    • 重启:/etc/init.d/postfix restart
    • 查看状态:/etc/init.d/postfix status
  • 开机自启配置
    • 开启自启:chkconfig postfix on
    • 关闭自启:chkconfig postfix off

20. Avahi-daemon 服务

  • 服务启停命令
    • 启动:/etc/init.d/avahi-daemon start
    • 停止:/etc/init.d/avahi-daemon stop
    • 重启:/etc/init.d/avahi-daemon restart
    • 查看状态:/etc/init.d/avahi-daemon status
  • 开机自启配置
    • 开启自启:chkconfig avahi-daemon on
    • 关闭自启:chkconfig avahi-daemon off

总结与注意事项

  1. 权限要求 :执行上述服务管理命令通常需要 root 权限或使用 sudo
  2. 服务名称:不同 Linux 发行版或版本,服务名称和脚本路径可能略有差异,请以实际系统为准。
  3. 配置生效 :修改 /etc/inetd.conf 等配置文件后,必须重启对应服务(如 openbsd-inetd)才能使更改生效。
  4. 开机自启 :使用 chkconfig 管理开机自启是 SysV init 系统的典型方式。若系统使用 systemd,则应使用 systemctl enable/disable 命令。
  5. 安全建议:对于不必要或存在安全风险的服务(如 Telnet),建议保持关闭状态。

建议将本文档保存为本地参考,在需要进行服务运维时快速查阅。