Python for UNIX and Linux System Administration cover

Python for UNIX and Linux System Administration

Rating 3.8
Chapters
16
Series
O'Reilly Best Books Series
ISBN
9787111266631

Tags

Summary

This is the Chinese translation of the O'Reilly classic Python for UNIX and Linux System Administration, published by China Machine Press in 2009 as part of the "O'Reilly Best Books Series." Aimed at operations and development staff with some system administration experience who want to use Python to replace or supplement shell scripts, the book organizes its chapters around tasks that recur in real administration: each chapter first poses a concrete management problem—such as concurrency control, log parsing, data backup, network probing, or process monitoring—then gives runnable Python examples and approaches. The coverage is broad: the first two chapters review Python basics and code reuse, with emphasis on the IPython interactive environment; subsequent chapters discuss text processing and log parsing, document and report generation, network clients and remote calls (socket, XML-RPC, SSH, Twisted, Scapy), file and data operations and archiving/compression, SNMP cluster monitoring, cross-platform system administration, package management and application packaging and deployment, processes and concurrency (subprocess, threads, supervisor, screen), GUI and web interface construction, data persistence and database interaction, and command-line tool design, ending with an integrated example that ties the techniques together. The authors also provide an Ubuntu virtual machine containing the book's source code and running examples so readers can verify things hands-on. Because of its publication era, the Python 2 syntax, older IPython versions, and tools such as easy_install and Zenoss have largely been superseded; when reading, it is better to grasp the approach and structure of "organizing automated operations with Python" than to copy the code verbatim.

Editor's review

如果你已经会用 Shell 应付日常运维,却总在脚本越写越长、越写越难维护时感到吃力,这本书正好提供了另一条路径:把系统管理任务交给 Python。它的组织方式很“运维友好”:先摆出真实场景中的管理难题,再演示如何用标准库和第三方模块拆解,从日志解析、文件归档、SNMP 监控到进程守护与命令行工具封装,几乎覆盖了一名系统管理员日常会碰到的全部环节。 两位作者都是长期与 UNIX/Linux 打交道的实践者,行文不追求语言特性的穷尽,而是强调“能跑起来、能解决问题”。书中关于 IPython 交互式探索、把 Shell 命令整合进 Python 命令行工具、跨平台脚本编写等章节,思路至今仍然适用。 需要坦诚提醒的是,本书中文版出版于 2009 年,代码基于 Python 2,涉及的 easy_install、IPython 旧版、Zenoss 等工具早已被新生态取代。因此它更适合当作一本“运维自动化思路手册”来读:学习作者如何界定问题、选择模块、组织代码结构,再把这些方法论迁移到 Python 3 与当下的工具链上。对于想理解“运维脚本为什么要工程化”的读者,它依然值得一读。

Who it's for

A good fit for

  • 已具备 Linux 命令行基础、想用 Python 提升运维效率的系统管理员
  • 习惯写 Shell 脚本,希望学习如何把脚本工程化、模块化的运维工程师
  • 需要编写监控、备份、日志分析等自动化工具的开发者
  • 想通过真实案例理解 Python 标准库与网络编程的技术人员

Not a good fit for

  • 完全没有 Linux/UNIX 使用经验的编程初学者
  • 只想学习 Python 3 现代语法与最新框架的读者
  • 期待开箱即用、可直接照抄到生产环境的代码手册的读者

Reading tips

  1. 先通读第 1、2 章打好基础并熟悉 IPython,再按工作场景跳读到对应章节,不必逐章顺序阅读。
  2. 把书中代码在 Python 3 环境中重写一遍,遇到模块替换处查当前官方文档,这本身就是很好的练习。
  3. 每读完一章,就为手头一个真实运维任务写个小工具,例如日志统计或配置比对,让知识落地。
  4. 对书中提到的旧工具(easy_install、Zenoss 等)只理解其设计意图,实际选型请参考当下主流方案。

About the publisher

China Machine Press China · Founded in 1950

In addition to science and technology and professional publishing, the books in our catalog from China Machine Press also reflect a sustained focus on psychology, computing, management, finance and economics, and social sciences. In psychology, the catalog includes works by C. G. Jung and introductions to analytical psychology, as well as applied topics such as stress and health, and addiction and healing. In computing, it features Structure and Interpretation of Computer Programs (JavaScript Edition). Management and finance titles include Administrative Behavior (4th Edition), The Price of Inequality (Collector's Edition), and This Time Is Different: Eight Centuries of Financial Folly (Commemorative Edition). In the philosophy and history of science, there is The Worldview: The Third Edition. Relevant authors include C. G. Jung, William McGuire, Sonu Shamdasani, and Gabor Maté. Public information is limited; the above summarizes the publisher's profile based solely on the books in our catalog.

Contents

  1. Preface
  2. Chapter 1 Introduction to Python
  3. Chapter 2 IPython
  4. Chapter 3 Text
  5. Chapter 4 Documentation and Reporting
  6. Chapter 5 Networking
  7. Chapter 6 Data
  8. Chapter 7 SNMP
  9. Chapter 8 OS Potpourri
  10. Chapter 9 Package Management
  11. Chapter 10 Processes and Concurrency
  12. Chapter 11 Creating GUIs
  13. Chapter 12 Data Persistence
  14. Chapter 13 Command Line
  15. Chapter 14 An Example
  16. Appendix Callbacks

FAQ

这本书的代码是 Python 2 还是 Python 3?
中文版出版于 2009 年,书中示例基于 Python 2 编写。直接在现代环境运行会遇到语法与库差异,建议边读边改写成 Python 3,把重点放在解题思路和模块选择上。
没有系统管理经验能读懂吗?
比较吃力。全书默认读者熟悉 Shell、进程、网络和文件权限等概念,每章都是从一个具体管理问题切入,缺少 Linux 基础会难以理解问题背景。
这本书和《Python自动化运维》类新书如何取舍?
本书胜在体系完整、案例贴近真实运维场景,能帮你建立“用 Python 组织自动化”的整体框架;但工具链已显陈旧。建议以本书打思路底子,再用新书补齐现代工具与 Python 3 实践。
书中提到的 Ubuntu 虚拟机还能用吗?
作者当年提供的虚拟机与配套源码链接多已失效或版本过旧。可以按书中目录结构自行搭建实验环境,把示例改写到当前系统与 Python 版本上。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category