Oracle Centos7初始配置操作 作者: Hogwarts 发布于: 2022-10-12 更新于: 2022-10-23 分类: 默认分类 Oracle Centos7初始配置操作笔记。 #一、修改初始配置 sudo -i yum update -y 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 **参考:**`https://winamp.top/184.html` #二、修改默认ssh端口 ##2.1 添加新端口 vim /etc/ssh/sshd_config 在Port 22下面新增一行 Port Newsshport Newsshport:新的ssh端口号 ##2.2 打开SELinux 端口 semanage port -a -t ssh_port_t -p tcp Newsshport Newsshport:为新设的端口号,与2.1相同。 ###2.2.1 可能存在的问题 对于有些厂商的Centos7系统,执行以上命令后可能报错:`semanage command not found`,执行安装命令 yum provides semanage ###2.2.2 或许还需安装 yum -y install policycoreutils-python ##2.3 查看当前 SELinux 允许的端口 semanage port -l | grep ssh 显示:ssh_port_t tcp 新ssh端口号, 22 ##2.4 重启 ssh 服务 systemctl restart sshd ##2.5 防火墙添加端口 firewall-cmd --permanent --zone=public --add-port=Newsshport/tcp Newsshport:为新设的端口号,与2.1相同。 firewall-cmd --reload firewall-cmd --permanent --list-port #2.6 用新端口登录VPS vim /etc/ssh/sshd_config 删除 Port 22 systemctl restart sshd #三、安装内核 建议安装5.10版本。5.10和5.15都是长期更新版本,5.15稍新些担心和一些软件的兼容性不好。 无理论依据,纯属个人臆测。 参考安装:`https://teddysun.com/612.html` ##3.1 查看内核版本 uname -r 显示:3.10.0-1160.76.1.el7.x86_64 ##3.2 下载 wget https://dl.lamp.sh/kernel/el7/kernel-ml-5.10.147-1.el7.x86_64.rpm https://dl.lamp.sh/kernel/el7/kernel-ml-devel-5.10.147-1.el7.x86_64.rpm https://dl.lamp.sh/kernel/el7/kernel-ml-headers-5.10.147-1.el7.x86_64.rpm 一般下载前三个即可。 下载地址:`https://teddysun.com/612.html` ##3.3 安装 yum localinstall kernel-ml-* ##3.4 查看内核列表并设置启动内核 查看命令 awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/efi/EFI/centos/grub.cfg #Oracle的grub.cfg路径与原文稍有不同 设置启动最新内核命令 grub2-set-default 0 ##3.5 删除下载文件并重启 rm -fv kernel-ml-* reboot ##3.6 重新登录查看 uname -r #四、开启bbr 在安装5.10内核的基础上进行如下操作 ##4.1 查看命令 lsmod | grep bbr 返回值有 tcp_bbr 模块即说明 bbr 已启动 ##4.2 依次运行下列命令 echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf sysctl -p 或 vim /etc/sysctl.conf 将这两行填入最下面 net.core.default_qdisc=fq net.ipv4.tcp_congestion_control=bbr 再运行 sysctl -p lsmod | grep bbr 标签: oracle, 内核, bbr, centos, centos7, 端口