之前搬主题介绍了甲骨文免费VPS云主机的注册,创建VM实例等教程,但是不少小伙伴认为甲骨文的默认免费实例只能是1G内存,在使用时捉襟见肘,经常会比较卡。这里搬主题再介绍一下甲骨文免费VPS云主机简单优化教程之修改root/卸载内置脚本/重装系统。https://www.banzhuti.com/oracle-cloud-signup.htmlhttps://www.banzhuti.com/2021-oracle-cloudvps-create-vm.html1、首先我们要设置root的密码。输入如下每行命令并回车,其中密码banzhuti可以自己修改。echo root:banzhuti |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修改后如下2、我们需要卸载甲骨文云主机的一些内置脚本,因为这些脚本会一直进行监控系统运行,本来是好事,但是占用了不少内存,导致比较卡,这里我们需要将其进行卸载。首先输入命令切换为root用户权限sudo -i然后分别输入下列命令回车systemctl stop oracle-cloud-agent
systemctl disable oracle-cloud-agent
systemctl stop oracle-cloud-agent-updater
systemctl disable oracle-cloud-agent-updater使用netstat -ntlp命令发现rpcbind监听了111端口,如担心安全可执行以下命令卸载禁用:systemctl stop rpcbind
systemctl stop rpcbind.socket
systemctl disable rpcbind
systemctl disable rpcbind.socket 3:重装系统 PS通常卸载脚本就可以了,不建议重装。这里以centos举例,先把BOOT文件夹下的一堆镜像文件删除,一次性复制粘贴如下命令,回车后再运行bash /boot/Reinstall.sh这个命令就OK了。系统重启后等个5分钟用VNC连接(ip:1)就可以正常装系统了,分区直接点下释放占用最大空间那个硬盘就可以了。VNC连接密码是banzhuti。也可以自己改下。yum -y install wget vim lsof net-toolscat /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 /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
THE END