共计 1149 个字符,预计需要花费 3 分钟才能阅读完成。
在 Oracle Cloud 上配置 Linux 实例时,您可能需要进行以下初始设置:
1. 启用 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
2. 安装系统相关依赖:
- 对于 CentOS 系统
yum update -y yum install curl -y
- 对于 Ubuntu 系统
apt update -y apt-get install curl -y
3. 删除、关闭、打开各自系统的无用附件、防火墙、端口及规则
- 对于 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
- 删除多余的 Oracle Cloud Agent
- 对于 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
-
注意:在进行上述操作时,请确保您了解每个命令的作用,以避免不必要的系统配置更改。
正文完
发表至: 笔记
2025-02-21