2 Star 9 Fork 5

chuanjiao10 / kasini3000_agent_linux

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
amazon_linux2_install_powershell.bash 1.53 KB
Copy Edit Raw Blame History
chuanjiao10 authored 2020-11-21 14:00 . 添加 amazon linux 2 安装脚本
#
if rpm -q centos-release | grep -Eq 'el6'
then
echo 'not support centos6'
exit 1
fi
if grep -Eq 'Karoo' /etc/issue || grep -Eq 'Karoo' /etc/*-release
then
echo 'linux is Amazon Linux release 2 (Karoo)'
if [ -h /usr/bin/pwsh ]
then
echo 'powershell installed on Amazon Linux 2'
if grep -Eq 'powershell' /etc/ssh/sshd_config
then
echo 'powershell_sshd_good'
exit 0
else
echo '' >> /etc/ssh/sshd_config
echo 'Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
systemctl restart sshd.service
echo 'powershell_sshd_fixed'
exit 0
fi
else
echo 'installing powershell now'
curl -o /etc/yum.repos.d/microsoft.repo https://packages.microsoft.com/config/rhel/7/prod.repo
yum remove -y powershel
yum install -y powershell
if [ $? -ne 0 ]
then
echo 'install fall'
exit 3
else
echo 'install powershell sucess'
if grep -Eq 'powershell' /etc/ssh/sshd_config
then
echo 'powershell_sshd_good'
exit 0
else
echo '' >> /etc/ssh/sshd_config
echo 'Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
systemctl restart sshd.service
echo 'powershell_sshd_fixed'
exit 0
fi
fi
fi
else
echo 'linux not Amazon Linux release 2 (Karoo)'
exit 2
fi
Shell
1
https://gitee.com/chuanjiao10/kasini3000_agent_linux.git
git@gitee.com:chuanjiao10/kasini3000_agent_linux.git
chuanjiao10
kasini3000_agent_linux
kasini3000_agent_linux
master

Search