Python for Linux System Administration and Automated Operations cover

Python for Linux System Administration and Automated Operations

Rating 4.2
Chapters
1
Series
Linux/Unix Technology Series
ISBN
9787111578659

Tags

Summary

This book distills the author's experience using Python in NetEase cloud platform development, database kernel development, and large-scale system operations. Taking Linux system administration as its thread and the Python language as its vehicle, it is a hands-on guide to solving the real-world problems encountered in system administration and automated operations with Python. The book is logically organized into five parts and 11 chapters, each of which can be read independently: the introduction (Chapter 1) discusses Python's strengths and weaknesses and why it suits Linux system administration, and offers guidance on choosing between Python 2 and Python 3; the tools part (Chapter 2) systematically covers advanced pip usage, vim and PyCharm, IPython and Jupyter, pdb and ipdb debugging, PEP 8 and pycodestyle, autopep8 code style checking, and environment management with pyenv and virtualenv; the scripting part (Chapters 3 to 7) successively introduces building command-line tools with argparse, click, logging, and ConfigParser; text processing with strings, regular expressions, and character-set encoding, plus Jinja2 templates; reading, writing, searching, comparing, and archive management for files with os.path, glob, shutil, tarfile, zipfile, and more; monitoring Linux systems with dstat, glances, and the /proc directory; and generating documentation and reports; the automation part (Chapters 8 to 10) covers Scapy network sniffing, Fabric automated operations, and Ansible automated deployment; and the integrated case study part (Chapter 11) uses "Building a MySQL Database Expert System with Python" to tie together advanced language features and system architecture design. The book includes numerous reproducible hands-on cases such as Apache access log analysis, duplicate file detection, archive backup, and MongoDB deployment, emphasizing "learn it, then use it," and can serve as an advanced practical textbook for Python.

Editor's review

市面上的 Python 书大多停在语法与算法题上,而这本《Python Linux系统管理与自动化运维》解决的是另一类痛点:会写 Python,却不知道拿它去管理服务器、写工具、搭自动化流程。作者赖明星有网易 MySQL/MongoDB 云平台与大规范系统运维的一线背景,书里的案例不是教科书式玩具,而是真实工作场景的抽象——Apache 日志分析、重复文件与 MD5 校验、压缩包备份、subprocess 调度外部命令、用 /proc 自建监控、Scapy 抓包、Fabric 与 Ansible 批量部署,读起来能明显感觉到“这是干过活的人写的”。结构上采用模块化设计,五个部分共 11 章各自独立,读者完全可以按需要跳读:今天要写命令行工具就翻第 3 章,明天要批量发版就看 Fabric 与 Ansible 两章。第 11 章以“MySQL 数据库专家系统”收官,把前面的文本处理、模板、命令行与架构设计串成一个完整项目,是从“会写脚本”迈向“会做系统”的过渡带。需要提醒的是,本书成书于 2017 年,示例以 Python 2 与 Python 3 并存时代的写法为主,部分工具(如 pycodestyle、Fabric 版本、Ansible 用法)已有更新,照着敲代码时要按当前版本文档做适配;但书中关于文件系统、/proc、subprocess、正则与文本处理的思路并未过时,方法论价值大于代码逐行复现。对于把“运维”当作职业方向的读者,这是一本性价比很高的实战过渡书。

Who it's for

A good fit for

  • 已有 Python 语法基础、想把它用到服务器管理上的运维工程师
  • 需要通过写脚本替代重复手工操作的 Linux 系统管理员
  • 做后端开发、想补齐部署与自动化运维能力的程序员
  • 正在寻找 Python 实战案例的计算机专业高年级学生

Not a good fit for

  • 零基础、尚未学过 Python 语法的初学者,建议先补语言基础
  • 完全没有 Linux 使用经验、也不打算学习命令行的读者
  • 只关心算法、数据分析或 Web 框架开发的读者

Reading tips

  1. 不必从第 1 页读起,先按当前痛点挑章节:写工具看第 3 章,管文件看第 5 章,做部署看第 9、10 章。
  2. 每个案例都在真实机器或虚拟机上跑一遍,把书中的脚本改造成自己环境的版本,比只读代码收获更大。
  3. 书中部分工具与写法基于 2017 年前后的版本,动手前先查官方文档确认当前 API,遇到差异以新版为准。
  4. 读完前 10 章后,用第 11 章的思路把工作中的某个重复流程重写成一个小系统,作为自查练习。

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. Linux/Unix Technical Series

FAQ

这本书适合零基础学 Python 的人吗?
不太适合。作者在前言中明确说明,本书不是 Python 语言教程,读者需具备 Python 基础、Linux 使用经验和 SSH 基本操作;它讲的是如何把 Python 用在系统管理与运维上,因此建议先学完语言基础再读。
书里的代码是 Python 2 还是 Python 3?
书中第 1 章专门讨论了 Python 2 与 Python 3 的取舍,正文示例两者都有涉及。由于成书于 2017 年,部分写法带有过渡期特征,现在实践时应统一迁移到 Python 3 并核对新版本文档。
和网上讲 Ansible、Fabric 的教程相比有什么不同?
书中不只是罗列工具命令,而是把这些工具放回“Linux 系统管理与自动化”的完整脉络中:先讲命令行工具与文本处理等基础能力,再讲 Scapy、Fabric、Ansible,最后用 MySQL 专家系统串联,更强调自建工具与架构思路。
本书的评分和篇幅如何?
该书由机械工业出版社于 2017 年 9 月出版,ISBN 为 9787111578659,平装 412 页,豆瓣评分约 8.3 分(五十余人评价),属于 Linux/Unix 技术丛书。

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.

More by the same author

Top rated in the same category