Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

PowerShell-DSC-for-Linux

> 编程语言
Open source

PowerShell Desired State Configuration - for Linux

339 stars0 likes2 views
WebsiteGitHub

About

PowerShell Desired State Configuration - for Linux

PowerShell Desired State Configuration for Linux

Copyright (c) Microsoft Corporation ver. 1.1.1

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Getting Started

Latest Release

The latest release packages for PowerShell DSC for Linux can be downloaded here: Releases

Current status and roadmap for Linux DSC

DSC has shifted to a cross-platform implementation that is developed in the PSDesiredStateConfiguration repo. Unless you have specific needs that require version 1, please navigate to the new location to view the current work on version 3.

For more information, please see the doumentation for Desired State Configuration.

This repo has been archived and will no longer accept new issues or pull requests.

Three solutions were originally released from this repo:

  • A stand-alone installation of version 1 for Linux distros and versions
    • UPDATE: The updated DSC resources for Linux are now maintained as the nxTools module.
  • Microsoft Azure Linux DSC extension for virtual machines
    • UPDATE: Desired state configuration VM Extension for Linux, and Azure Automation DSC support for Linux, will be retired on 30 September 2023
  • Microsoft Monitoring Agent solutions on Linux virtual machines (aka OMS Linux)
    • UPDATE: We're retiring the Log Analytics agent in Azure Monitor on 31 August 2024

The codebase in this repo has been updated with fixes based on customer incidents reported for Microsoft Monitoring Agent. Therefore, the Microsoft Monitoring Agent already utilizes the latest release. Unfortunately, it has not been possible to publish new releases for either standalone installations or DSC extension. If you encounter challenges with either scenario and would like to evaluate if the latest code will resolve your issue, the best option is to download the latest release, then distribute it using custom tools (such as Azure Custom Script Extension). This is not intended to expand upon the supported OS coverage.

Please note that per the documentation for DSC Linux Extension, the extensions for DSC Linux and Monitoring cannot be used together on the same machine.

Supported Linux operating systems

The following Linux operating system versions are supported by DSC for Linux.

  • CentOS 5, 6, and 7 (x86/x64)
  • Debian GNU/Linux 6, 7 and 8 (x86/x64)
  • Oracle Linux 5, 6 and 7 (x86/x64)
  • Red Hat Enterprise Linux Server 5, 6 and 7 (x86/x64)
  • SUSE Linux Enterprise Server 10, 11 and 12 (x86/x64)
  • Ubuntu Server 12.04 LTS, 14.04 LTS, 16.04 LTS (x86/x64)

Requirements

The following table describes the required package dependencies for DSC for Linux.

Required package | Description | Minimum version ----------------------- | ------------------------------------- | ------------------- glibc | GNU C Library | 2.4 - 31.30 python | Python | 2.4 - 3.4 omi | Open Management Infrastructure | 1.0.8-4 openssl | OpenSSL Libraries | 0.9.8e or 1.0 python-ctypes | Python CTypes library | Must match Python version libcurl | cURL http client library | 7.15.1

OMI Packages can be found at OMI.

Installing DSC Packages

OMI and DSC packages are available in RPM and Debian packages, for x86 and x64 architectures, and for systems with OpenSSL version 0.9.8 and version 1.0.x. To install DSC, select determine the packages that are correct for your operating system, and install them.

Examples Red Hat Enterprise Linux, CentOS, or Oracle Linux 7:

bash
wget https://github.com/Microsoft/omi/releases/download/v1.1.0-0/omi-1.1.0.ssl_100.x64.rpm
wget https://github.com/Microsoft/PowerShell-DSC-for-Linux/releases/download/v1.1.1-294/dsc-1.1.1-294.ssl_100.x64.rpm

sudo rpm -Uvh omi-1.1.0.ssl_100.x64.rpm dsc-1.1.1-294.ssl_100.x64.rpm

Ubuntu 14.04 LTS, 16.04 LTS, or Debian GNU/Linux 8, x64:

bash
wget https://github.com/Microsoft/omi/releases/download/v1.1.0-0/omi-1.1.0.ssl_100.x64.deb
wget https://github.com/Microsoft/PowerShell-DSC-for-Linux/releases/download/v1.1.1-294/dsc-1.1.1-294.ssl_100.x64.deb

sudo dpkg -i omi-1.1.0.ssl_100.x64.deb dsc-1.1.1-294.ssl_100.x64.deb

For more information, review the latest release notes and product documentation.

To author DSC MOF configuration for Linux on a Windows computer:


Prerequisites

  • A Windows computer with:
    • Adminstrative privileges
    • Windows PowerShell (>=4.0)

or

  • A Linux computer with:

    • PowerShell v6.0.0-alpha.9 or later
    • DSC v1.1.1 or later
  • Install the Linux Resource Provider MOF module:

    • The "nx" module can be installed from the PowerShell Gallery with: install-module nx
    • In order to compile a Configuration MOF that uses the DSC for Linux resources, use Import-DscResource -Module nx inside a DSC Configuration block.
  • Remotely managing a Linux system with DSC

    • You need a compiled configuration MOF to apply a new configuration to a system.
      Start-DscConfiguration -CimSession:$myCimSession -Path:"C:\path_to_compiled_mof_directory\" -Wait -Verbose
    • You can get the current configuration of the system by running: Get-DscConfiguration -CimSession:$myCimSession
    • You can test the current configuration of the system by running: Test-DscConfiguration -CimSession:$myCimSession
    • For more information on creating a CimSession for use with the -CimSession parameter, see: http://technet.microsoft.com/en-us/library/jj590760.aspx
  • Locally managing a Linux system with DSC

    • See Performing DSC Operations from the Linux Computer below for a reference of DSC operations that can be performed on the managed computer

Building the Desired State Configuration (DSC) Local Configuration Manager and Linux Resource Providers

Prerequisites


  • At least one modern Linux system with:
    • root login capability
    • These build tools:
      • GNU Make
      • g++
      • Python version 2.5 or later, the package python-devel
    • Open Management Infrastructure (OMI) 1.0.8. http://theopengroup.org/software/omi
      • pam-devel
      • openssl-devel

Building and installing the Local Configuration Manager and Linux Resource Providers


  1. Extract PSDSC.tar into a directory that you will build it from.
  2. Download and extract OMI 1.0.8 into a directory named omi-1.0.8 in a directory parallel to the LCM and Providers directory. The directory tree should look something like:
   ./configure
   ./LCM
   ./license.txt
   ./omi-1.0.8
   ./omi-1.0.8/agent
   ./omi-1.0.8/base
   ...
  1. Building

    • Configuring OMI and building
      • Configure OMI with desired options (refer to OMI documentation for this step).
        • The default configuration installs to /opt/omi-1.0.8
        • To use the default configuration, run: cd omi-1.0.8 && ./configure
        • Run: make
    • Installing OMI:
      • Run: cd omi-1.0.8 && sudo ./output/install
    • Registering the LCM + nxProviders with OMI:
      • Run: sudo make reg
  2. Running OMI

    • On the Linux system, run omiserver with environment variable OMI_HOME set to OMI's installed directory
      • Run as root: OMI_HOME= $OMI_HOME/bin/omiserver
        • The default installation for OMI 1.0.8 is /opt/omi-1.0.8. Thus, for default installations, part 4Ai above becomes: OMI_HOME=/opt/omi-1.0.8 $OMI_HOME/bin/omiserver

      Note: In order to run following reboots, it is recommended to configure OMI as a System-V, Upstart, or SystemD daemon

Building and using DSC and OMI from source

DSC and OMI can also be built together entirely from source in a self-contained directory. This is useful primarily for developers.

bash
# Clone DSC source
git clone https://github.com/Microsoft/PowerShell-DSC-for-Linux.git
cd PowerShell-DSC-for-Linux

# Place the OMI source where DSC expects it
# Alternatively clone from Git and symlink to omi/Unix
wget https://collaboration.opengroup.org/omi/documents/33715/omi-1.0.8.tar.gz
tar xf omi-1.0.8.tar.gz

# Build OMI in developer mode
cd omi-1.0.8
./configure --dev
make -j
cd ..

# Build DSC in developer mode
./configure --no-rpm --no-dpkg --local
make -j
make reg

# Start the OMI server
./omi-1.0.8/output/bin/omiserver

Use Azure Automation as a DSC Pull Server

Note: For more information on Azure Automation’s DSC features, reference the documentation.
Linux computers can be onboarded to Azure Automation DSC, as long as they have outbound access to the internet, via a few simple steps:

Make sure version 1.1 or later of the DSC Linux agent is installed on the machines you want to onboard to Azure Automation DSC.

To configure Azure Automation as a DSC Pull Server from the Linux computer:

  • On each Linux machine to onboard to Azure Automation DSC, use Register.py to onboard using the PowerShell DSC Local Configuration Manager defaults:

For python2

sudo /opt/microsoft/dsc/Scripts/Register.py

For python3

sudo /opt/microsoft/dsc/Scripts/python3/Register.py

  • To find the registration key and registration URL for your Automation account, see the Secure Registration section below.
  • Using the Azure portal or cmdlets, check that the machines to onboard now show up as DSC nodes registered in your Azure Automation account.

Additional configuration options:

  • --ConfigurationName: the name of the configuration to apply
  • --RefreshFrequencyMins: Specifies how often (in minutes) LCM attempts to obtain the configuration from the pull server. If configuration on the pull server differs from the current one on the target node, it is copied to the pending store and applied.
  • --ConfigurationModeFrequencyMins: Specifies how often (in minutes) LCM ensures that the configuration is in the desired state.
  • --ConfigurationMode: Specifies how LCM should apply the configuration. Valid values are: ApplyOnly, ApplyAndMonitor, ApplyAndAutoCorrect, MonitorOnly

To configure Azure Automation as a DSC Pull Server with a metaconfiguration MOF:

  • Open the PowerShell console or PowerShell ISE a

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言