CentOS 7 上面安装PowerShell

看了文章 爱上PowerShell , 就想在CentOS 7上面试试PowerShell , 本文记录了在CentOS 7.2上安装Powershell 的过程。

首先我们要从github上下载最新的PowerShell 的rpm 包powershell-6.0.0_alpha.14-1.el7.centos.x86_64.rpm,安装方法的文档 https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#centos-7 ,下面贴出具体的安装输出:

[geffzhang@dotnetoss2 ~]$ sudo yum install powershell-6.0.0_alpha.14-1.el7.centos.x86_64.rpm
[sudo] password for geffzhang:
Loaded plugins: fastestmirror, langpacks
Examining powershell-6.0.0_alpha.14-1.el7.centos.x86_64.rpm: powershell-6.0.0_alpha.14-1.el7.centos.x86_64
Marking powershell-6.0.0_alpha.14-1.el7.centos.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package powershell.x86_64 0:6.0.0_alpha.14-1.el7.centos will be installed
--> Processing Dependency: uuid for package: powershell-6.0.0_alpha.14-1.el7.centos.x86_64
base                                                     | 3.6 kB     00:00
extras                                                   | 3.4 kB     00:00
openlogic                                                | 1.3 kB     00:00
updates                                                  | 3.4 kB     00:00
Loading mirror speeds from cached hostfile
--> Running transaction check
---> Package uuid.x86_64 0:1.6.2-26.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package
      Arch   Version       Repository                                      Size
================================================================================
Installing:
powershell
      x86_64 6.0.0_alpha.14-1.el7.centos
                           /powershell-6.0.0_alpha.14-1.el7.centos.x86_64 124 M
Installing for dependencies:
uuid x86_64 1.6.2-26.el7  base                                            55 k

Transaction Summary
================================================================================
Install  1 Package (+1 Dependent package)

Total size: 124 M
Total download size: 55 k
Installed size: 124 M
Is this ok [y/d/N]: y
Downloading packages:
uuid-1.6.2-26.el7.x86_64.rpm                               |  55 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : uuid-1.6.2-26.el7.x86_64                                     1/2
  Installing : powershell-6.0.0_alpha.14-1.el7.centos.x86_64                2/2
  Verifying  : uuid-1.6.2-26.el7.x86_64                                     1/2
  Verifying  : powershell-6.0.0_alpha.14-1.el7.centos.x86_64                2/2

Installed:
  powershell.x86_64 0:6.0.0_alpha.14-1.el7.centos

Dependency Installed:
  uuid.x86_64 0:1.6.2-26.el7

安装结束后在Linux控制台输入PowerShell,即可启动PowerShell:

[geffzhang@dotnetoss2 ~]$ powershell
PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS /home/geffzhang>
然后我们来看一下版本信息:

PS /home/geffzhang> $PSVersionTable
PowerShell
Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.14
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

PS /home/geffzhang> Get-Variable

Name                           Value
----                           -----
?                              True
^                              $PSVersionTable
$                              $PSVersionTable
args                           {}
ConfirmPreference              High
ConsoleFileName
DebugPreference                SilentlyContinue
Error                          {}
ErrorActionPreference          Continue
ErrorView                      NormalView
ExecutionContext               System.Management.Automation.EngineIntrinsics
false                          False
FormatEnumerationLimit         4
HOME                           /home/geffzhang
Host                           System.Management.Automation.Internal.Host.InternalHost
InformationPreference          SilentlyContinue
input                          System.Collections.ArrayList+ArrayListEnumeratorSimple
IsCoreCLR                      True
IsLinux                        True
IsOSX                          False
IsWindows                      False
MaximumHistoryCount            4096
MyInvocation                   System.Management.Automation.InvocationInfo
NestedPromptLevel              0
null
OutputEncoding                 System.Text.ASCIIEncoding
PID                            1208
PROFILE                        /home/geffzhang/.config/powershell/Microsoft.PowerShell_profile.ps1
ProgressPreference             Continue
PSBoundParameters              {}
PSCommandPath
PSCulture                      en-US
PSDefaultParameterValues       {}
PSEdition                      Core
PSEmailServer
PSHOME                         /opt/microsoft/powershell/6.0.0-alpha.14
PSScriptRoot
PSSessionApplicationName       wsman
PSSessionConfigurationName     http://schemas.microsoft.com/powershell/Microsoft.PowerShell
PSSessionOption                System.Management.Automation.Remoting.PSSessionOption
PSUICulture                    en-US
PSVersionTable                 {PSVersion, PSEdition, PSCompatibleVersions, BuildVersion...}
PWD                            /home/geffzhang
ShellId                        Microsoft.PowerShell
StackTrace
true                           True
VerbosePreference              SilentlyContinue
WarningPreference              Continue
WhatIfPreference               False


PS /home/geffzhang>
我们看到了powershell 是用.NET Core来跑的。 我们下面再来看下PowerShell 在Linux上面都支持那些命令,运行下面的命令生成一张HTML表格:

PS /home/geffzhang> Get-command |Sort-Object NounName | select Name,CommandType,Source | ConvertTo-Html

Linux上的PowerShell命令一览表

NameCommandTypeSource
Add-NodeKeysFunctionPSDesiredStateConfiguration
Install-PackageProviderCmdletPackageManagement
Install-PackageCmdletPackageManagement
Import-PSSessionCmdletMicrosoft.PowerShell.Utility
Import-PackageProviderCmdletPackageManagement
Import-ModuleCmdletMicrosoft.PowerShell.Core
Import-LocalizedDataCmdletMicrosoft.PowerShell.Utility
Import-CsvCmdletMicrosoft.PowerShell.Utility
Import-ClixmlCmdletMicrosoft.PowerShell.Utility
Import-AliasCmdletMicrosoft.PowerShell.Utility
Group-ObjectCmdletMicrosoft.PowerShell.Utility
Get-VariableCmdletMicrosoft.PowerShell.Utility
Get-UptimeCmdletMicrosoft.PowerShell.Utility
Get-UniqueCmdletMicrosoft.PowerShell.Utility
Get-UICultureCmdletMicrosoft.PowerShell.Utility
Get-TypeDataCmdletMicrosoft.PowerShell.Utility
Get-TraceSourceCmdletMicrosoft.PowerShell.Utility
Get-RunspaceDebugCmdletMicrosoft.PowerShell.Utility
Invoke-CommandCmdletMicrosoft.PowerShell.Core
Invoke-ExpressionCmdletMicrosoft.PowerShell.Utility
Invoke-HistoryCmdletMicrosoft.PowerShell.Core
Invoke-ItemCmdletMicrosoft.PowerShell.Management
New-PSSessionCmdletMicrosoft.PowerShell.Core
New-PSRoleCapabilityFileCmdletMicrosoft.PowerShell.Core
New-PSDriveCmdletMicrosoft.PowerShell.Management
New-ObjectCmdletMicrosoft.PowerShell.Utility
New-ModuleManifestCmdletMicrosoft.PowerShell.Core
New-ModuleCmdletMicrosoft.PowerShell.Core
New-ItemPropertyCmdletMicrosoft.PowerShell.Management
New-ItemCmdletMicrosoft.PowerShell.Management
Get-RunspaceCmdletMicrosoft.PowerShell.Utility
New-GuidCmdletMicrosoft.PowerShell.Utility
New-AliasCmdletMicrosoft.PowerShell.Utility
Move-ItemPropertyCmdletMicrosoft.PowerShell.Management
Move-ItemCmdletMicrosoft.PowerShell.Management
Measure-ObjectCmdletMicrosoft.PowerShell.Utility
Measure-CommandCmdletMicrosoft.PowerShell.Utility
Join-PathCmdletMicrosoft.PowerShell.Management
Invoke-WebRequestCmdletMicrosoft.PowerShell.Utility
Invoke-RestMethodCmdletMicrosoft.PowerShell.Utility
New-EventCmdletMicrosoft.PowerShell.Utility
Get-RandomCmdletMicrosoft.PowerShell.Utility
Get-PSSessionConfigurationCmdletMicrosoft.PowerShell.Core
Get-PSSessionCapabilityCmdletMicrosoft.PowerShell.Core
Get-FormatDataCmdletMicrosoft.PowerShell.Utility
Get-ExecutionPolicyCmdletMicrosoft.PowerShell.Security
Get-EventSubscriberCmdletMicrosoft.PowerShell.Utility
Get-EventCmdletMicrosoft.PowerShell.Utility
Get-DateCmdletMicrosoft.PowerShell.Utility
Get-CultureCmdletMicrosoft.PowerShell.Utility
Get-CredentialCmdletMicrosoft.PowerShell.Security
Get-ContentCmdletMicrosoft.PowerShell.Management
Get-HelpCmdletMicrosoft.PowerShell.Core
Get-CommandCmdletMicrosoft.PowerShell.Core
Get-AliasCmdletMicrosoft.PowerShell.Utility
Format-WideCmdletMicrosoft.PowerShell.Utility
Format-TableCmdletMicrosoft.PowerShell.Utility
Format-ListCmdletMicrosoft.PowerShell.Utility
Format-CustomCmdletMicrosoft.PowerShell.Utility
ForEach-ObjectCmdletMicrosoft.PowerShell.Core
Find-PackageProviderCmdletPackageManagement
Find-PackageCmdletPackageManagement
Get-ChildItemCmdletMicrosoft.PowerShell.Management
New-PSSessionConfigurationFileCmdletMicrosoft.PowerShell.Core
Get-HistoryCmdletMicrosoft.PowerShell.Core
Get-ItemCmdletMicrosoft.PowerShell.Management
Get-PSSessionCmdletMicrosoft.PowerShell.Core
Get-PSReadlineOptionCmdletPSReadLine
Get-PSReadlineKeyHandlerCmdletPSReadLine
Get-PSProviderCmdletMicrosoft.PowerShell.Management
Get-PSHostProcessInfoCmdletMicrosoft.PowerShell.Core
Get-PSDriveCmdletMicrosoft.PowerShell.Management
Get-PSCallStackCmdletMicrosoft.PowerShell.Utility
Get-PSBreakpointCmdletMicrosoft.PowerShell.Utility
Get-HostCmdletMicrosoft.PowerShell.Utility
Get-ProcessCmdletMicrosoft.PowerShell.Management
Get-PackageProviderCmdletPackageManagement
Get-PackageCmdletPackageManagement
Get-ModuleCmdletMicrosoft.PowerShell.Core
Get-MemberCmdletMicrosoft.PowerShell.Utility
Get-LocationCmdletMicrosoft.PowerShell.Management
Get-JobCmdletMicrosoft.PowerShell.Core
Get-ItemPropertyValueCmdletMicrosoft.PowerShell.Management
Get-ItemPropertyCmdletMicrosoft.PowerShell.Management
Get-PackageSourceCmdletPackageManagement
New-PSSessionOptionCmdletMicrosoft.PowerShell.Core
New-PSTransportOptionCmdletMicrosoft.PowerShell.Core
New-TemporaryFileCmdletMicrosoft.PowerShell.Utility
Tee-ObjectCmdletMicrosoft.PowerShell.Utility
Stop-TranscriptCmdletMicrosoft.PowerShell.Host
Stop-ProcessCmdletMicrosoft.PowerShell.Management
Stop-JobCmdletMicrosoft.PowerShell.Core
Start-TranscriptCmdletMicrosoft.PowerShell.Host
Start-SleepCmdletMicrosoft.PowerShell.Utility
Start-ProcessCmdletMicrosoft.PowerShell.Management
Start-JobCmdletMicrosoft.PowerShell.Core
Test-ModuleManifestCmdletMicrosoft.PowerShell.Core
Split-PathCmdletMicrosoft.PowerShell.Management
Set-VariableCmdletMicrosoft.PowerShell.Utility
Set-TraceSourceCmdletMicrosoft.PowerShell.Utility
Set-StrictModeCmdletMicrosoft.PowerShell.Core
Set-PSSessionConfigurationCmdletMicrosoft.PowerShell.Core
Set-PSReadlineOptionCmdletPSReadLine
Set-PSReadlineKeyHandlerCmdletPSReadLine
Set-PSDebugCmdletMicrosoft.PowerShell.Core
Set-PSBreakpointCmdletMicrosoft.PowerShell.Utility
Sort-ObjectCmdletMicrosoft.PowerShell.Utility
Set-PackageSourceCmdletPackageManagement
Test-PathCmdletMicrosoft.PowerShell.Management
Trace-CommandCmdletMicrosoft.PowerShell.Utility
Write-ProgressCmdletMicrosoft.PowerShell.Utility
Write-OutputCmdletMicrosoft.PowerShell.Utility
Write-InformationCmdletMicrosoft.PowerShell.Utility
Write-HostCmdletMicrosoft.PowerShell.Utility
Write-ErrorCmdletMicrosoft.PowerShell.Utility
Write-DebugCmdletMicrosoft.PowerShell.Utility
Where-ObjectCmdletMicrosoft.PowerShell.Core
Wait-ProcessCmdletMicrosoft.PowerShell.Management
Test-PSSessionConfigurationFileCmdletMicrosoft.PowerShell.Core
Wait-JobCmdletMicrosoft.PowerShell.Core
Wait-DebuggerCmdletMicrosoft.PowerShell.Utility
Update-TypeDataCmdletMicrosoft.PowerShell.Utility
Update-HelpCmdletMicrosoft.PowerShell.Core
Update-FormatDataCmdletMicrosoft.PowerShell.Utility
Unregister-PSSessionConfigurationCmdletMicrosoft.PowerShell.Core
Unregister-PackageSourceCmdletPackageManagement
Unregister-EventCmdletMicrosoft.PowerShell.Utility
Uninstall-PackageCmdletPackageManagement
Wait-EventCmdletMicrosoft.PowerShell.Utility
Export-PSSessionCmdletMicrosoft.PowerShell.Utility
Set-LocationCmdletMicrosoft.PowerShell.Management
Set-ItemCmdletMicrosoft.PowerShell.Management
Remove-EventCmdletMicrosoft.PowerShell.Utility
Register-PSSessionConfigurationCmdletMicrosoft.PowerShell.Core
Register-PackageSourceCmdletPackageManagement
Register-ObjectEventCmdletMicrosoft.PowerShell.Utility
Register-EngineEventCmdletMicrosoft.PowerShell.Utility
Register-ArgumentCompleterCmdletMicrosoft.PowerShell.Core
Receive-PSSessionCmdletMicrosoft.PowerShell.Core
Receive-JobCmdletMicrosoft.PowerShell.Core
Remove-ItemCmdletMicrosoft.PowerShell.Management
Read-HostCmdletMicrosoft.PowerShell.Utility
Pop-LocationCmdletMicrosoft.PowerShell.Management
Out-StringCmdletMicrosoft.PowerShell.Utility
Out-NullCmdletMicrosoft.PowerShell.Core
Out-HostCmdletMicrosoft.PowerShell.Core
Out-FileCmdletMicrosoft.PowerShell.Utility
Out-DefaultCmdletMicrosoft.PowerShell.Core
New-VariableCmdletMicrosoft.PowerShell.Utility
New-TimeSpanCmdletMicrosoft.PowerShell.Utility
Push-LocationCmdletMicrosoft.PowerShell.Management
Set-ItemPropertyCmdletMicrosoft.PowerShell.Management
Remove-ItemPropertyCmdletMicrosoft.PowerShell.Management
Remove-ModuleCmdletMicrosoft.PowerShell.Core
Set-ExecutionPolicyCmdletMicrosoft.PowerShell.Security
Set-DateCmdletMicrosoft.PowerShell.Utility
Set-ContentCmdletMicrosoft.PowerShell.Management
Set-AliasCmdletMicrosoft.PowerShell.Utility
Select-XmlCmdletMicrosoft.PowerShell.Utility
Select-StringCmdletMicrosoft.PowerShell.Utility
Select-ObjectCmdletMicrosoft.PowerShell.Utility
Save-PackageCmdletPackageManagement
Remove-JobCmdletMicrosoft.PowerShell.Core
Save-HelpCmdletMicrosoft.PowerShell.Core
Rename-ItemPropertyCmdletMicrosoft.PowerShell.Management
Rename-ItemCmdletMicrosoft.PowerShell.Management
Remove-VariableCmdletMicrosoft.PowerShell.Utility
Remove-TypeDataCmdletMicrosoft.PowerShell.Utility
Remove-PSSessionCmdletMicrosoft.PowerShell.Core
Remove-PSReadlineKeyHandlerCmdletPSReadLine
Remove-PSDriveCmdletMicrosoft.PowerShell.Management
Remove-PSBreakpointCmdletMicrosoft.PowerShell.Utility
Resolve-PathCmdletMicrosoft.PowerShell.Management
Write-VerboseCmdletMicrosoft.PowerShell.Utility
Export-ModuleMemberCmdletMicrosoft.PowerShell.Core
Export-CsvCmdletMicrosoft.PowerShell.Utility
InFunctionPester
ImportSystemModulesFunction 
ImportClassResourcesFromModuleFunctionPSDesiredStateConfiguration
ImportCimAndScriptKeywordsFromModuleFunctionPSDesiredStateConfiguration
Import-PowerShellDataFileFunctionMicrosoft.PowerShell.Utility
helpFunction 
GetSyntaxFunctionPSDesiredStateConfiguration
GetResourceFromKeywordFunctionPSDesiredStateConfiguration
GetPatternsFunctionPSDesiredStateConfiguration
GetModuleFunctionPSDesiredStateConfiguration
GetImplementingModulePathFunctionPSDesiredStateConfiguration
GetCompositeResourceFunctionPSDesiredStateConfiguration
Get-VerbFunction 
Get-TestDriveItemFunctionPester
Get-PublicKeyFromStoreFunctionPSDesiredStateConfiguration
Get-PublicKeyFromFileFunctionPSDesiredStateConfiguration
Get-PSTopConfigurationNameFunctionPSDesiredStateConfiguration
Initialize-ConfigurationRuntimeStateFunctionPSDesiredStateConfiguration
InModuleScopeFunctionPester
Install-ModuleFunctionPowerShellGet
Install-ScriptFunctionPowerShellGet
ReadEnvironmentFileFunctionPSDesiredStateConfiguration
Publish-ScriptFunctionPowerShellGet
Publish-ModuleFunctionPowerShellGet
PSConsoleHostReadlineFunctionPSReadLine
promptFunction 
PauseFunction 
ossFunction 
NodeFunctionPSDesiredStateConfiguration
Get-PSRepositoryFunctionPowerShellGet
New-ScriptFileInfoFunctionPowerShellGet
New-DscChecksumFunctionPSDesiredStateConfiguration
moreFunction 
MockFunctionPester
ItFunctionPester
IsPatternMatchedFunctionPSDesiredStateConfiguration
IsHiddenResourceFunctionPSDesiredStateConfiguration
Invoke-PesterFunctionPester
Invoke-MockFunctionPester
New-FixtureFunctionPester
Get-PSMetaConfigurationProcessedFunctionPSDesiredStateConfiguration
Get-PSMetaConfigDocumentInstVersionInfoFunctionPSDesiredStateConfiguration
Get-PSDefaultConfigurationDocumentFunctionPSDesiredStateConfiguration
Expand-ArchiveFunctionMicrosoft.PowerShell.Archive
DescribeFunctionPester
ConvertTo-MOFInstanceFunctionPSDesiredStateConfiguration
ContextFunctionPester
ConfigurationFunctionPSDesiredStateConfiguration
Compress-ArchiveFunctionMicrosoft.PowerShell.Archive
Clear-HostFunction 
CheckResourceFoundFunctionPSDesiredStateConfiguration
Find-CommandFunctionPowerShellGet
cd\Function 
BeforeEachFunctionPester
BeforeAllFunctionPester
Assert-VerifiableMocksFunctionPester
Assert-MockCalledFunctionPester
AfterEachFunctionPester
AfterAllFunctionPester
AddDscResourcePropertyFromMetadataFunctionPSDesiredStateConfiguration
AddDscResourcePropertyFunctionPSDesiredStateConfiguration
cd..Function 
Register-PSRepositoryFunctionPowerShellGet
Find-DscResourceFunctionPowerShellGet
Find-RoleCapabilityFunctionPowerShellGet
Get-PSCurrentConfigurationNodeFunctionPSDesiredStateConfiguration
Get-PositionInfoFunctionPSDesiredStateConfiguration
Get-MofInstanceTextFunctionPSDesiredStateConfiguration
Get-MofInstanceNameFunctionPSDesiredStateConfiguration
Get-MockDynamicParametersFunctionPester
Get-InstalledScriptFunctionPowerShellGet
Get-InstalledModuleFunctionPowerShellGet
Get-InnerMostErrorRecordFunctionPSDesiredStateConfiguration
Find-ModuleFunctionPowerShellGet
Get-FileHashFunctionMicrosoft.PowerShell.Utility
Get-DSCResourceModulesFunctionPSDesiredStateConfiguration
Get-DscResourceFunctionPSDesiredStateConfiguration
Get-ConfigurationErrorCountFunctionPSDesiredStateConfiguration
Get-ComplexResourceQualifierFunctionPSDesiredStateConfiguration
Get-CompatibleVersionAddtionaPropertiesStrFunctionPSDesiredStateConfiguration
Generate-VersionInfoFunctionPSDesiredStateConfiguration
Format-HexFunctionMicrosoft.PowerShell.Utility
Find-ScriptFunctionPowerShellGet
Get-EncryptedPasswordFunctionPSDesiredStateConfiguration
Save-ModuleFunctionPowerShellGet
Save-ScriptFunctionPowerShellGet
Set-DynamicParameterVariablesFunctionPester
ConvertTo-CsvCmdletMicrosoft.PowerShell.Utility
ConvertFrom-StringDataCmdletMicrosoft.PowerShell.Utility
ConvertFrom-SecureStringCmdletMicrosoft.PowerShell.Security
ConvertFrom-JsonCmdletMicrosoft.PowerShell.Utility
ConvertFrom-CsvCmdletMicrosoft.PowerShell.Utility
Convert-PathCmdletMicrosoft.PowerShell.Management
Connect-PSSessionCmdletMicrosoft.PowerShell.Core
Compare-ObjectCmdletMicrosoft.PowerShell.Utility
ConvertTo-HtmlCmdletMicrosoft.PowerShell.Utility
Clear-VariableCmdletMicrosoft.PowerShell.Utility
Clear-ItemCmdletMicrosoft.PowerShell.Management
Clear-HistoryCmdletMicrosoft.PowerShell.Core
Clear-ContentCmdletMicrosoft.PowerShell.Management
Add-TypeCmdletMicrosoft.PowerShell.Utility
Add-MemberCmdletMicrosoft.PowerShell.Utility
Add-HistoryCmdletMicrosoft.PowerShell.Core
Add-ContentCmdletMicrosoft.PowerShell.Management
WriteFileFunctionPSDesiredStateConfiguration
Clear-ItemPropertyCmdletMicrosoft.PowerShell.Management
Write-NodeMOFFileFunctionPSDesiredStateConfiguration
ConvertTo-JsonCmdletMicrosoft.PowerShell.Utility
ConvertTo-XmlCmdletMicrosoft.PowerShell.Utility
Export-ClixmlCmdletMicrosoft.PowerShell.Utility
Export-AliasCmdletMicrosoft.PowerShell.Utility
Exit-PSSessionCmdletMicrosoft.PowerShell.Core
Exit-PSHostProcessCmdletMicrosoft.PowerShell.Core
Enter-PSSessionCmdletMicrosoft.PowerShell.Core
Enter-PSHostProcessCmdletMicrosoft.PowerShell.Core
Enable-RunspaceDebugCmdletMicrosoft.PowerShell.Utility
Enable-PSSessionConfigurationCmdletMicrosoft.PowerShell.Core
ConvertTo-SecureStringCmdletMicrosoft.PowerShell.Security
Enable-PSBreakpointCmdletMicrosoft.PowerShell.Utility
Disable-RunspaceDebugCmdletMicrosoft.PowerShell.Utility
Disable-PSSessionConfigurationCmdletMicrosoft.PowerShell.Core
Disable-PSBreakpointCmdletMicrosoft.PowerShell.Utility
Debug-RunspaceCmdletMicrosoft.PowerShell.Utility
Debug-ProcessCmdletMicrosoft.PowerShell.Management
Debug-JobCmdletMicrosoft.PowerShell.Core
Copy-ItemPropertyCmdletMicrosoft.PowerShell.Management
Copy-ItemCmdletMicrosoft.PowerShell.Management
Disconnect-PSSessionCmdletMicrosoft.PowerShell.Core
Export-FormatDataCmdletMicrosoft.PowerShell.Utility
Write-MetaConfigFileFunctionPSDesiredStateConfiguration
ValidateUpdate-ConfigurationDataFunctionPSDesiredStateConfiguration
Test-NodeManagerFunctionPSDesiredStateConfiguration
Test-MofInstanceTextFunctionPSDesiredStateConfiguration
Test-ModuleReloadRequiredFunctionPSDesiredStateConfiguration
Test-ConflictingResourcesFunctionPSDesiredStateConfiguration
TabExpansion2Function 
StrongConnectFunctionPSDesiredStateConfiguration
ShouldFunctionPester
SetupFunctionPester
Test-NodeResourcesFunctionPSDesiredStateConfiguration
Set-PSTopConfigurationNameFunctionPSDesiredStateConfiguration
Set-PSMetaConfigVersionInfoV2FunctionPSDesiredStateConfiguration
Set-PSMetaConfigDocInsProcessedBeforeMetaFunctionPSDesiredStateConfiguration
Set-PSDefaultConfigurationDocumentFunctionPSDesiredStateConfiguration
Set-PSCurrentConfigurationNodeFunctionPSDesiredStateConfiguration
Set-NodeResourceSourceFunctionPSDesiredStateConfiguration
Set-NodeResourcesFunctionPSDesiredStateConfiguration
Set-NodeManagerFunctionPSDesiredStateConfiguration
Set-NodeExclusiveResourcesFunctionPSDesiredStateConfiguration
Set-PSRepositoryFunctionPowerShellGet
Write-LogFunctionPSDesiredStateConfiguration
Test-NodeResourceSourceFunctionPSDesiredStateConfiguration
ThrowErrorFunctionPSDesiredStateConfiguration
ValidateNoNameNodeResourcesFunctionPSDesiredStateConfiguration
ValidateNodeResourceSourceFunctionPSDesiredStateConfiguration
ValidateNodeResourcesFunctionPSDesiredStateConfiguration
ValidateNodeManagerFunctionPSDesiredStateConfiguration
ValidateNodeExclusiveResourcesFunctionPSDesiredStateConfiguration
ValidateNoCircleInNodeResourcesFunctionPSDesiredStateConfiguration
Update-ScriptFileInfoFunctionPowerShellGet
Update-ScriptFunctionPowerShellGet
Test-ScriptFileInfoFunctionPowerShellGet
Update-ModuleVersionFunctionPSDesiredStateConfiguration
Update-ModuleFunctionPowerShellGet
Update-LocalConfigManagerFunctionPSDesiredStateConfiguration
Update-DependsOnFunctionPSDesiredStateConfiguration
Update-ConfigurationErrorCountFunctionPSDesiredStateConfiguration
Update-ConfigurationDocumentRefFunctionPSDesiredStateConfiguration
Unregister-PSRepositoryFunctionPowerShellGet
Uninstall-ScriptFunctionPowerShellGet
Uninstall-ModuleFunctionPowerShellGet
Update-ModuleManifestFunctionPowerShellGet
Write-WarningCmdletMicrosoft.PowerShell.Utility
Windows Subsystem for Linux (WSL) 是 Windows 10 中内置的一种功能,让你可以在 Windows 上直接运行 Linux 发行版,无需安装虚拟机。安装 CentOS 7 在 WSL 中大致分为以下几个步骤: 1. **启用 WSL**: - 首先确保你的 Windows 版本支持 WSL(Win10 Build 16299 及以上)。 - 打开“设置”,然后选择“更新和安全”,点击左侧的“Windows Subsystem for Linux”。 2. **下载安装包**: - 访问 CentOS 官方网站下载适用于 WSL 的 ISO 文件。 - 建议使用最小化安装或通用版本,因为 WSL 已预装了必要的组件。 3. **创建 WSL 分区**: - 使用 `DISM` 命令添加 Linux 子系统,例如: ``` dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /All /norestart ``` 4. **安装 CentOS**: - 启动 PowerShell 或命令提示符以管理员身份运行,并导航到保存 ISO 文件的位置。 ``` wsl --install -d centos7 <path_to_centos7.iso> ``` 其中 `<path_to_centos7.iso>` 应替换为你的 CentOS 7 ISO 文件的实际路径。 5. **启动并登录 CentOS**: - 安装完成后,可以通过 `wsl` 命令启动新安装CentOS,首次启动可能需要配置分区和网络设置。 ``` wsl ``` 登录时使用你在 CentOS 官网下载的 ISO 文件中的用户和密码。 6. **安装桌面环境** (可选): 如果你想在 WSL 中获得类似桌面的操作体验,可以安装像 Xfce 或 KDE 这样的桌面环境。这一步取决于个人需求,但不是必需的。 安装过程可能会有一些性能限制,比如图形界面可能不如完整虚拟机流畅,但对于日常开发任务来说,WSL 已经足够用了。安装完毕后,记得检查网络连接、权限和其他基础配置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值