1.修改使用root登陆。逐一运行如下命令,

1
2
3
4
echo root:zxsdw |sudo chpasswd root
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
sudo service sshd restart

默认密码是: zxsdw

1
2
3
4
5
sudo -i
echo root:V2rayssr |chpasswd root
sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
service sshd restart

默认密码是: V2rayssr

登录后一定要修改密码!密码修改命令:passwd

2.卸载甲骨文内置脚本,这玩意特别卡,所以卸载之。逐一运行如下命令

1
2
3
4
systemctl stop oracle-cloud-agent
systemctl disable oracle-cloud-agent
systemctl stop oracle-cloud-agent-updater
systemctl disable oracle-cloud-agent-updater

3.重装系统

PS通常卸载脚本就可以了,不建议重装。这里以centos举例,先把BOOT文件夹下的一堆镜像文件删除,一次性复制粘贴如下命令,回车后再运行bash /boot/Reinstall.sh这个命令就OK了。系统重启后等个5分钟用VNC连接(ip:1)就可以正常装系统了,分区直接点下释放占用最大空间那个硬盘就可以了。VNC连接密码是zxsdw。也可以自己改下。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
yum -y install wget vim lsof net-tools

cat << EOF >/boot/Reinstall.sh
#!/bin/bash
rm -rf /boot/initrd77.img /boot/vmlinuz77
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/initrd.img -O /boot/initrd77.img
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/vmlinuz -O /boot/vmlinuz77
cat << EOFEOF>/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 \\\$0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "VNCInstallCentos7" {
set root='(hd0,gpt3)'
linuxefi /boot/vmlinuz77 inst.vnc inst.vncpassword=zxsdw inst.headless ip=dhcp nameserver=8.8.8.8 inst.repo=http://vault.centos.org/7.2.1511/os/x86_64/ inst.lang=zh_CN.UTF-8 inst.keymap=us
initrdefi /boot/initrd77.img
}
EOFEOF
#sed -i 's/GRUB_DEFAULT=saved/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
grub2-reboot VNCInstallCentos7
reboot
EOF

文章内容和代码来源于 甲骨文免费VPS 使用教程 ,如有侵权请联系站长立即删除。