2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

サーバー引き継ぎの時に便利なツールと方法 (主に CentOS, Amazon Linux, RHEL)

Posted at

おっきな企業さんに、サーバーだけ構築して、あと保守はウチのチームで管理しますということを言われるので、サーバー引き継ぎの時にローカルの EC2 などのサーバーの config 変更などを超簡単に手抜きでゲットする方法をまとめました。

yum.log:ミドルウエア一覧

CentOS や Amazon Linux で、yum を使っているのであれば、

/var/log/yum.log をゲット。
インストールしたミドルウエア一覧と日付をゲット

インストールした、ミドルウエア一覧が出来上がり。

ETCKeeper

/etc の中身を git として保存し、毎日自動コミットして修正を追ってくれる便利なツール。
サーバーを立てたらまっさきに epel レポジトリ (or 対応レポジトリ) をインストールして ETCKeeper による config の監視を行いましょう。

etckeeper をインストール。そして最初のコミットを行います。

差分抽出作業

ローカルに落とす

サーバーにログインして、/etc 配下の領域をサーバーに落とす。
( /etc 配下に集約していることを想定 )

cd
sudo tar -cvzpf etc_$(date +%Y%m%d%H%M%S).tar.gz -C /etc/ ./

tar ファイルをダウンロードしてローカルの適当なところを抽出。

抽出用ブランチを

yum update などの余分なコミットを取り除いて、本当に必要な config の差分だけ取り出すために、サーバーからローカルに移す。

git ブランチをパッチを作成したい初期の箇所で分離。

差分パッチに残したいコミットを cherry pick していく。

最初のコミット ID と最後の commit ID をメモ

git diff 引き継ぎの config 差分抽出

git diff [最初のコミットID]..[最後のコミットID] > ../XXXXX.patch

git diff --name-only 変更したファイルだけリストで出す

git diff --name-only [最初のコミットID]..[最後のコミットID] > ../filelist.txt

まとめ

  • yum.log
  • config 変更ファイル
  • config のパッチ
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?