[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

Let's manage git under /etc with etckeeper

I'm Ito, an infrastructure engineer.
When operating a Linux server, the configuration file is frequently rewritten.

When changing settings, you will often need to use a date name at the end of the file to manage the backup.

For example, something like this.

# ls -al |grep httpd.conf -rw-r--r-- 1 root root 16730 Jan 25 22:59 httpd.conf -rw-r--r-- 1 root root 16730 Jan 25 22:59 httpd. conf_20151225 -rw-r--r-- 1 root root 16730 Jan 25 22:59 httpd.conf_20160120

However, if you take a backup file every time you change the settings, the files will be scattered.
The more files you have, the more likely it is to make mistakes. This is not very good for your mental health.

In such cases, we recommend using a VCS (version control system) called etckeeper

Of course, etckeeper will commit manually,

・When the yum command was executed
・When the date was changed

It will automatically commit even at times like this.

Install first

I'll try installing etckeeper.
As I mentioned earlier, you will need VCS This time I'll install git.

#yum install git

Install etckeeper from the epel repository.

#yum install --enablerepo=epel etckeeper

It was installed successfully.

# rpm -qa |grep etckeeper etckeeper-0.64-1.el5.rf

Try using it

First, create a repository.

# etckeeper init Initialized empty Git repository in /etc/.git/

I'll try committing.

# etckeeper commit "First commit" [master (root-commit) 970f0b3] First commit Author: vagrant<vagrant@cli> 1174 files changed, 122593 insertions(+), 0 deletions(-) create mode 100755 .etckeeper create mode 100644 yum/version-groups.conf

Check the commit log.
Git commands can be used in etckeeper vcs.

# etckeeper vcs log commit 970f0b335acdf586e099d57f1bc95d442bff853f Author: vagrant<vagrant@cli> Date: Fri Jan 29 21:02:33 2016 +0900 First commit

Let's try installing Apache.
etckeeper will commit on the way.

#yum install httpd (omitted) etckeeper: pre transaction commit Updating : httpd-tools-2.2.15-47.el6.centos.1.x86_64 1/4 Updating : httpd-2.2.15-47.el6.centos.1. x86_64 2/4 Cleanup : httpd-2.2.15-47.el6.centos.x86_64 3/4 Cleanup : httpd-tools-2.2.15-47.el6.centos.x86_64 4/4 etckeeper: post transaction commit Verifying : httpd -tools-2.2.15-47.el6.centos.1.x86_64 1/4 Verifying : httpd-2.2.15-47.el6.centos.1.x86_64 2/4 Verifying : httpd-tools-2.2.15-47 .el6.centos.x86_64 3/4 Verifying : httpd-2.2.15-47.el6.centos.x86_64 4/4 (omitted)

Let's try editing httpd.conf and checking the log when committing.

# etckeeper vcs log commit a6cee87ff14bcf90587e98017d8a737777bcc5c0 Author: vagrant<vagrant@cli> Date: Fri Jan 29 22:43:53 2016 +0900 edit httpd.conf commit 970f0b335acdf586e099d57f1bc95d442bff853f Author: vagrant<vagrant@cli> Date: Fri Jan 29 21:02:33 2016 +0900 First commit

Let's check the diff to see which part was edited.

# etckeeper vcs diff 970f0b335acdf586e099d57f1bc95d442bff853f 66aefb8e71a7526988c0b3d3863fd6e7e3ec0b54 diff --git a/httpd/conf/httpd.conf b/httpd/conf/httpd.conf index 579d194..58 70596 100644 --- a/httpd/conf/httpd.conf +++ b /httpd/conf/httpd.conf @@ -1,3 +1,4 @@ +#test # # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions.

Let's go back to a certain point.

# etckeeper vcs revert a6cee87ff14bcf90587e98017d8a737777bcc5c0 Finished one revert. # On branch master nothing to commit (working directory clean)

Here's how it works.
It's nice to avoid having a large number of configuration files under /etc/!

So, that's how I use Eckeeper.
Use etckeeper to beautifully manage your /etc subordinates!

If you want to consult a cloud professional

At Beyond, we use the technical capabilities we have cultivated as a multi-cloud integrator and managed service provider (MSP) since our founding to design, build, and migrate using various cloud/server platforms such as AWS, GCP, Azure, and Oracle Cloud. I went there.

We provide custom-made cloud/server environments that are optimized for customers according to the specifications and functions of the systems and applications they require, so if you are interested in the cloud, please feel free to contact us. .

● Cloud/server design/construction
● Cloud/server migration/migration
● Cloud/server operation, maintenance, and monitoring (24 hours a day, 365 days a year)

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
3,197
X facebook Hatena Bookmark pocket
[Webinar] Introduction to Multi-Cloud: Which cloud is best for your business? Get the latest information on the 8 major clouds!

[Webinar] Introduction to Multi-Cloud: Which cloud is best for your business? Get the latest information on the 8 major clouds!

[Webinar] From the operational structure to specific steps! A complete overview of cloud server operation and maintenance

[Webinar] From the operational structure to specific steps! A complete overview of cloud server operation and maintenance

The person who wrote this article

About the author