Book Image

CentOS 7 Server Deployment Cookbook

By : Timothy Boronczyk, IRAKLI NADAREISHVILI
Book Image

CentOS 7 Server Deployment Cookbook

By: Timothy Boronczyk, IRAKLI NADAREISHVILI

Overview of this book

CentOS is derived from Red Hat Enterprise Linux (RHEL) sources and is widely used as a Linux server. This book will help you to better configure and manage Linux servers in varying scenarios and business requirements. Starting with installing CentOS, this book will walk you through the networking aspects of CentOS. You will then learn how to manage users and their permissions, software installs, disks, filesystems, and so on. You’ll then see how to secure connection to remotely access a desktop and work with databases. Toward the end, you will find out how to manage DNS, e-mails, web servers, and more. You will also learn to detect threats by monitoring network intrusion. Finally, the book will cover virtualization techniques that will help you make the most of CentOS.
Table of Contents (18 chapters)
CentOS 7 Server Deployment Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Backing up and restoring an OpenLDAP database


This recipe teaches you how to back up an OpenLDAP database by exporting the directory to an LDIF file, which can then be imported later to restore the database.

Getting ready

This recipe requires a CentOS system with a working network connection and administrative privileges either using the root account or sudo.

How to do it...

To back up an LDAP directory, export the directory using the slapcat utility:

slapcat -b "dc=ldap,dc=example,dc=com" -l backup.ldif

To rebuild the directory from an export, follow these steps:

  1. Stop the LDAP server:

    service stop slapd.service
    
  2. Import the file using slapadd:

    slapadd -f backup.ldif
    
  3. Ensure the data files are owned by the ldap user:

    chown -R ldap.ldap /var/lib/ldap/*
    
  4. Restart the LDAP server:

    service restart slapd.service
    

How it works...

slapcat exports the LDAP database's contents to LDIF-formatted output. The content is sent to STDOUT by default, so you should either capture it using the shell's redirect operators...