Debian服务器安装PowerShell教程(debian服务器安装)

在Debian服务器上安装PowerShell,首先更新软件包列表,然后添加Microsoft的公钥,最后使用apt-get命令安装。

安装前准备

1、确保服务器已经安装了Debian操作系统。

创新互联专注于企业全网营销推广、网站重做改版、庄浪网站定制设计、自适应品牌网站建设、H5响应式网站商城开发、集团公司官网建设、成都外贸网站建设公司、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为庄浪等各大城市提供网站开发制作服务。

2、连接到服务器,使用SSH工具(如PuTTY)登录到服务器。

3、确保服务器具有足够的磁盘空间和内存资源。

更新系统软件包

在安装PowerShell之前,需要先更新系统软件包,执行以下命令:

sudo aptget update
sudo aptget upgrade

安装PowerShell

1、添加Microsoft PowerShell的官方仓库:

wget https://packages.microsoft.com/config/debian/9/packagesmicrosoftprod.deb O packagesmicrosoftprod.deb
sudo dpkg i packagesmicrosoftprod.deb

2、再次更新系统软件包:

sudo aptget update

3、安装PowerShell:

sudo aptget install powershell

配置PowerShell

1、运行PowerShell:

pwsh

2、按照提示设置PowerShell的配置文件路径:

$Home\Documents\WindowsPowerShellprofile.ps1

3、编辑配置文件,添加以下内容:

导入模块和别名设置等自定义内容
ImportModule /usr/share/powershell/Modules/PoshGit/PoshGit.psm1
ImportModule /usr/share/powershell/Modules/PSReadLine/PSReadLine.psm1
SetPSReadLineOption PredictionSource History
SetPSReadLineKeyHandler Key "Tab" Function MenuComplete
SetPSReadLineKeyHandler Key "Ctrl+d" Function ReadLineDeleteCharOrExit
SetPSReadLineKeyHandler Key "Ctrl+z" Function Undo
SetPSReadLineKeyHandler Key "Ctrl+a" Function StartOfLine
SetPSReadLineKeyHandler Key "Ctrl+e" Function EndOfLine
SetPSReadLineKeyHandler Key "Ctrl+b" Function BackwardChar
SetPSReadLineKeyHandler Key "Ctrl+f" Function ForwardChar
SetPSReadLineKeyHandler Key "Alt+f7" Function MenuComplete
SetPSReadLineOption HistoryNoDuplicates true
SetPSReadLineOption BellStyle None
SetPSReadLineOption PredictionSource UserInput, History, CommandKeywords, CommandAliases, FunctionKeywords, ScriptKeywords, Acronyms, HistoryLookupOrder, MatchingCommand, CompleteWord, AutoSuggestionSourceHistory, AutoSuggestionIgnoreCase, AutoSuggestionListView, AutoSuggestionTrimFilter, PotentialCompletionsToDismiss, VimMode, VimEscapeCharacter, VimInsertModeNormal, VimInsertModeVisualBlock, VimInsertModeReplace, VimMapLocalToRemote, VimMapRemoteToLocal, VimMovementCommands, VimNavigationCommands, VimSelectMode, VimSurround, VimVisualMode, VimEnterModeDefault, VimLeaveModeDefault, VimCloseCurrentTab, VimCloseOtherTabs, VimNextTab, VimPreviousTab, VimGoToLastEditLocation, VimRestoreCursorPositionAfterSearch, VimSaveCursorPositionBeforeSearch, VimSwitchToLastEditedFile, VimFindFileUnderCursor, VimFindNextFileUnderCursor, VimFindPrevFileUnderCursor, VimFindFileInProjectUnderCursor, VimFindNextFileInProjectUnderCursor, VimFindPrevFileInProjectUnderCursor, VimFindFileInDirectoryUnderCursor, VimFindNextFileInDirectoryUnderCursor, VimFindPrevFileInDirectoryUnderCursor, VimFindFileInVimPathUnderCursor, VimFindNextFileInVimPathUnderCursor, VimFindPrevFileInVimPathUnderCursor, VimFindFileInGrepPathUnderCursor, VimFindNextFileInGrepPathUnderCursor, VimFindPrevFileInGrepPathUnderCursor, VimFindFileInTagUnderCursor, VimFindNextFileInTagUnderCursor, VimFindPrevFileInTagUnderCursor, VimFindFileInBookmarkUnderCursor, VimFindNextFileInBookmarkUnderCursor, VimFindPrevFileInBookmarkUnderCursor, VimFindFileInRegisterUnderCursor, VimFindNextFileInRegisterUnderCursor, VimFindPrevFileInRegisterUnderCursor, VimUseSystemClipboardForCopyAndPasteEnabled, VimUseSystemClipboardForCutEnabled, VimUseSystemClipboardForPasteEnabled, VimUseSystemClipboardForUndoCutEnabled, VimUseSystemClipboardForUndoCopyEnabled, VimUseSystemClipboardForUndoPasteEnabled, VimUseSystemClipboardForDeleteEnabled, VimUseSystemClipboardForYankEnabled, VimUseSystemClipboardForUndoDeleteEnabled, VimUseSystemClipboardForUndoYankEnabled, VimUseSystemClipboardForChangeEnabled, VimUseSystemClipboardForReplaceEnabled, VimUseSystemClipboardForSubstituteEnabled, VimUseSystemClipboardForTransposeEnabled, VimUseSystemClipboardForUndoSubstituteEnabled, VimUseSystemClipboardForUndoTransposeEnabled, VimUseSystemClipboardForUndoChangeEnabled, VimUseSystemClipboardForUndoReplaceEnabled
source $Profile # 加载配置文件中的自定义设置和模块等

新闻标题:Debian服务器安装PowerShell教程(debian服务器安装)
网页地址:http://www.hantingmc.com/qtweb/news1/35651.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联