Различия
Здесь показаны различия между двумя версиями данной страницы.
Следующая версия | Предыдущая версия | ||
wiki:руководство_по_ubuntu_server:другие_полезные_приложения:etckeeper [2012/11/06 20:23] создано |
wiki:руководство_по_ubuntu_server:другие_полезные_приложения:etckeeper [2020/11/23 00:28] (текущий) [etckeeper] |
||
---|---|---|---|
Строка 8: | Строка 8: | ||
=====etckeeper===== | =====etckeeper===== | ||
- | etckeeper allows the contents of /etc be easily stored in Version Control System (VCS) repository. It hooks into apt to automatically commit changes to /etc when packages are installed or upgraded. Placing /etc under version control is considered an industry best practice, and the goal of etckeeper is to make this process as painless as possible. | + | **etckeeper** позволяет легко сохранять содержимое каталога **/etc** в хранилище системы контроля версий (VCS). Он отслеживает когда **apt** автоматически сохраняет изменения в /etc при установке или обновлении пакетов. Помещение **/etc** под контроль версий сейчас рассматривается как лучшая практика в индустрии, и преимуществом **etckeeper** является то, что он делает этот процесс безболезненным насколько это возможно. |
- | Install etckeeper by entering the following in a terminal: | + | Установите **etckeeper**, ведя следующее в терминале: |
+ | <code>sudo apt-get install etckeeper</code> | ||
- | sudo apt-get install etckeeper | + | Основной файл конфигурации, **/etc/etckeeper/etckeeper.conf**, достаточно простой. Основной опцией является выбор какую VSC использовать. По умолчанию **etckeeper** настроен на использование в качестве системы контроля версий **bzr**. Хранилище автоматически инициализируется (и сохраняет начальное состояние) в процессе установки. Есть возможность отменить это, выполнив следующую команду: |
+ | <code>sudo etckeeper uninit</code> | ||
- | The main configuration file, /etc/etckeeper/etckeeper.conf, is fairly simple. The main option is which VCS to use. By default etckeeper is configured to use bzr for version control. The repository is automatically initialized (and committed for the first time) during package installation. It is possible to undo this by entering the following command: | + | По умолчанию **etckeeper** будет сохранять незафиксированные изменения в **/etc** ежедневно. Это может быть отменено использованием опции настройки **AVOID_DAILY_AUTOCOMMITS**. Он также будет автоматически сохранять изменения до и после установки пакетов. Для более точного отслеживания изменений рекомендуется фиксировать изменения вручную, добавляя описание фиксации следующим образом: |
+ | <code>sudo etckeeper commit "..Reason for configuration change.."</code> | ||
- | sudo etckeeper uninit | + | Используя команды **VCS**, вы можете просматривать информацию в журнале по поводу файлов в **/etc**: |
+ | <code>sudo bzr log /etc/passwd</code> | ||
- | By default, etckeeper will commit uncommitted changes made to /etc daily. This can be disabled using the AVOID_DAILY_AUTOCOMMITS configuration option. It will also automatically commit changes before and after package installation. For a more precise tracking of changes, it is recommended to commit your changes manually, together with a commit message, using: | + | Для демонстрации интеграции с системой управления пакетами, установим **postfix**: |
- | + | <code>sudo apt-get install postfix</code> | |
- | sudo etckeeper commit "..Reason for configuration change.." | + | |
- | + | ||
- | Using the VCS commands you can view log information about files in /etc: | + | |
- | + | ||
- | sudo bzr log /etc/passwd | + | |
- | + | ||
- | To demonstrate the integration with the package management system, install postfix: | + | |
- | + | ||
- | sudo apt-get install postfix | + | |
- | + | ||
- | When the installation is finished, all the postfix configuration files should be committed to the repository: | + | |
+ | Когда установка завершится, все конфигурационные файлы **postfix** будут переданы в хранилище: | ||
+ | <code> | ||
Committing to: /etc/ | Committing to: /etc/ | ||
added aliases.db | added aliases.db | ||
Строка 70: | Строка 65: | ||
added ufw/applications.d/postfix | added ufw/applications.d/postfix | ||
Committed revision 2. | Committed revision 2. | ||
+ | </code> | ||
- | For an example of how etckeeper tracks manual changes, add new a host to /etc/hosts. Using bzr you can see which files have been modified: | + | В качестве примера, как **etckeeper** отслеживает изменения вручную, добавьте новую систему в **/etc/hosts**. Используя **bzr** вы сможете увидеть какие файлы были изменены: |
+ | <code> | ||
sudo bzr status /etc/ | sudo bzr status /etc/ | ||
modified: | modified: | ||
hosts | hosts | ||
+ | </code> | ||
+ | |||
+ | Теперь зафиксируем изменения: | ||
+ | <code>sudo etckeeper commit "new host"</code> | ||
+ | |||
+ | Дополнительную информацию по **bzr** смотрите в разделе [[wiki:руководство_по_ubuntu_server:система_управления_версиями:bazaar|Bazaar]]. | ||
- | Now commit the changes: | + | ==== Исключения ==== |
+ | Чтобы пароли и сертификаты не копировались, если используется VSC git то надо в файл /etc/.gitignore добавить строки: | ||
+ | <code> | ||
+ | shadow* | ||
+ | gshadow* | ||
+ | ssh/ssh_host_* | ||
+ | ssl/private/* | ||
- | sudo etckeeper commit "new host" | + | letsencrypt/accounts |
+ | letsencrypt/archive | ||
+ | letsencrypt/csr | ||
+ | letsencrypt/keys | ||
+ | letsencrypt/live | ||
- | For more information on bzr see Bazaar. | + | opendkim/keys |
+ | </code> | ||
---- | ---- |