Introduction to LCFG : Part 6

The following examples assume you are using the virtual appliance described in IntroductoryTutorial.

This tutorial follows on from IntroductoryTutorialPart5. In the following examples we will work on the task of managing the nginx web server. Although in this tutorial we're only configuring this for a single machine keep in mind that this could be something you need to do for a large collection of machines. Once you go beyond a small number of machines doing this manually will be inefficient, tedious and there's the potential to miss out some of them.

Getting Started

As with the previous tutorial start by opening several terminal windows. To see the entire process of a change to an LCFG source profile being applied tail the server and client log files - /var/log/lcfg/server and /var/log/lcfg/client. You will also need root access in one terminal so you can modify the source profile, that can be acquired using sudo bash with the password being the same as the username.

All the files for this tutorial are provided in the lcfg-tutorial package, for Focal they are stored in the /usr/share/lcfg/tutorial/examples/focal/. To ensure you have the latest version run apt update and apt upgrade before starting.

Example 10 - Generating a new component

The first step is to create a skeleton project directory for the new component. The LCFG build tools provide an lcfg-skeleton tool which can be used to generate a reasonable starting point. As the non-root user run the lcfg-skeleton command in a terminal and respond to the questions as below:

Name of the component/project: nginx
Is this an LCFG component? (yes/no) [yes]: 
Short description of the project [The LCFG nginx component]: 
Name of the author [Guest User,,,]: Example User
Email address for the author:
Type of component (perl/shell/file/virtual) [perl]: 
Version Control System (SVN/CVS/None) [SVN]: None
Supported platforms: UbuntuFocal
Distribution license [GPLv2]: 
Restart component on RPM update (yes/no) [yes]: 
Use the CMake build system (yes/no) [yes]: 
Check all changes are committed before a release? (yes/no) [yes]: 
Generate the ChangeLog from the Revision-Control log? (yes/no) [no]: yes


  • Mostly the defaults will be sensible and you can just accept them.
  • You must specify None for the version control system, that will create an lcfg-nginx project in the current directory.
  • You must provide a valid email address.

This should result in output which looks like this:

Stored LCFG build metadata
Generating /tmp/RMylXJNeeb/CMakeLists.txt
Generating /tmp/RMylXJNeeb/nginx.def.cin
Generating /tmp/RMylXJNeeb/ChangeLog
Generating /tmp/RMylXJNeeb/templates/README
Generating /tmp/RMylXJNeeb/nagios/README
Generating /tmp/RMylXJNeeb/lib/LCFG/Component/
Generating /tmp/RMylXJNeeb/README
Generating /tmp/RMylXJNeeb/README.BUILD
Generating /tmp/RMylXJNeeb/nginx.pod.cin
Generating /tmp/RMylXJNeeb/nginx.cin
Generating /tmp/RMylXJNeeb/specfile
Successfully imported your project into your version-control system.

You will now have an lcfg-nginx directory which contains various files:

  • ChangeLog - A list of changes for each release. When using svn or git this may be auto-generated.
  • CMakeLists.txt - The CMake build script
  • lcfg.yml - LCFG build tools metadata, controls parts of the package building process
  • lib/LCFG/Component/ - The LCFG component Perl module
  • nagios/README - Explanatory notes about the optional LCFG nagios translator module
  • nginx.cin - The LCFG component script
  • nginx.def.cin - The LCFG component schema
  • nginx.pod.cin - The LCFG component documentation (used to generate the man page)
  • README - Explanatory notes about the project
  • README.BUILD - Explanatory notes on how to build the project
  • specfile - RPM build script
  • templates/README - Explanatory notes about the optional templates for the LCFG component

-- squinney - 2021-04-22

This topic: LCFG > DocsForLCFGUsers > IntroductoryTutorial > IntroductoryTutorialPart6a
Topic revision: r1 - 2021-04-22 - squinney
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback