Oracle Cloud 甲骨文云基本配置知识
在 Oracle Cloud 上配置 Linux 实例时,通常需要完成 root 登录、依赖安装和防火墙规则整理等基础步骤。
在 Oracle Cloud 上配置 Linux 实例时,您可能需要进行以下初始设置:
- 启用 root 用户登录:
获取管理员权限
sudo -i设置 root 密码
sudo passwd root允许 root 用户通过 SSH 登录
sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config启用密码认证
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config重启 SSH 服务
sudo service sshd restart- 安装系统相关依赖:
对于 CentOS 系统
yum update -y
yum install curl -y对于 Ubuntu 系统
apt update -y
apt-get install curl -y- 删除、关闭、打开各自系统的无用附件、防火墙、端口及规则
对于 CentOS 系统
删除多余的 Oracle Cloud Agent
systemctl stop oracle-cloud-agent
systemctl disable oracle-cloud-agent
systemctl stop oracle-cloud-agent-updater
systemctl disable oracle-cloud-agent-updater停止防火墙
systemctl stop firewalld.service禁止防火墙开机启动
systemctl disable firewalld.service关闭 SELinux
vi /etc/selinux/config
# 将 SELINUX=ENFORCING 修改为 SELINUX=DISABLED保存配置并重启系统
reboot对于 Ubuntu 系统
开放所有端口
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F删除默认的 Iptables 规则
apt-get purge netfilter-persistent或者强制删除
rm -rf /etc/iptables保存配置并重启系统
reboot注意: 在进行上述操作时,请确保您了解每个命令的作用,以避免不必要的系统配置更改。