停止当前实例
变更操作系统
- 在平时学习和工作往往需要更换环境,以下内容共大家参考
选择自己想要安装的目标镜像
创建密钥对
![]()
保存私钥(只有一次机会)
![]()
绑定对应服务器
![]()
配置安全组
![]()
重启系统(重要)
生成Putty格式的私钥
- 阿里云的私钥格式是pem,需要使用puttygen.exe进行格式转换,输出ppk格式私钥。
- 运行puttygen.exe
![]()
配置ssh连接
![]()
配置Putty长时连接
![]()
远程登录linux服务器
![]()
Linux服务器配置
使用root用户登录,创建普通用户
# useradd ooxx
# passwd ooxx
Changing password for user ooxx.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
添加sudoers
sed -i '/^root.*ALL=(ALL).*ALL/a\going\tALL=(ALL) \tALL' /etc/sudoers
cp -rf ~/.ssh /home/ooxx/.ssh #将公钥复制到普通用户家目录,这样普通用户即可以免密码登录
chown -R ooxx:ooxx /home/ooxx/.ssh #更改权限
更换Yum源
mv /etc/yum.repos.d /etc/yum.repos.d.bak
mkdir /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
yum clean all && yum makecache
切换用户使用普通用户登录服务器