赞
踩
下载wget,用以更换yum源使用:
sudo yum -y install wget
创建备份源文件夹
sudo mkdir /etc/yum.repos.d/bak
备份原有yum源
sudo mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
配置centos源:
sudo wget http://mirrors.aliyun.com/repo/Centos-altarch-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
配置epel源:
sudo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
清除缓存:
sudo yum clean all
生成缓存:
sudo yum makecache
配置centos源:
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
配置epel源:
sudo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
清除缓存:
sudo yum clean all
生成缓存:
yum makecache
sudo yum install -y gcc autoconf automake libtool pam-devel libpng-devel mercurial epel-release openssh
sudo yum -y install google-authenticator
sudo google-authenticator
是否开启基于时间的认证:输入 y 确认
打开手机端Authenticator,选择添加账户–>个人账户–>扫描QR码,扫描该二维码
扫描完成后,回到xshell界面,连续输入四次y:
当更换手机或安装APP需要使用此密钥做验证!!!
61313680
57780866
22806904
19694937
61548077
紧急验证码,用于紧急使用,每个验证码使用一次后作废!!!
注:因系统不同,部分sshd配置可能会有所不同!!!如有报错,可手动修改!!!
ChallengeResponseAuthentication选项,取消注释并改成yes
sudo sed -i '$a\ChallengeResponseAuthentication yes' /etc/ssh/sshd_config
UsePAM选项,取消注释并改成yes
sudo sed -i '$a\UsePAM yes' /etc/ssh/sshd_config
sudo sed -i '1a\auth required pam_google_authenticator.so' /etc/pam.d/sshd
sudo systemctl restart sshd
等待一分钟左右,再次打开一个终端,登录该服务器
当输入密码直接登录时,提示登录失败。
打开手机端app获得一次性代码,选择下方的Keyboard Interactive(I),输入验证码
输入密码:
sudo rm -rf /etc/yum.repos.d/*.repo && mv /etc/yum.repos.d/bak/* /etc/yum.repos.d/
生成缓存:
sudo yum makecache
1、打开手机APP主页面----->右上角 + 号-----> 其他(Google、facebook等)
2、选择手动输入代码
3、输入账户名和密钥:
账户名:就是服务器的名称!!!
密钥:即上述第5步生成的new secret key!!!
4、点击完成,成功添加账户
tips:依次点击账户----->右上角小齿轮------>账户名称,即可重命名账户
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。