zoukankan      html  css  js  c++  java
  • CentOS 7/8 初始化相关推荐操作

    1.安装vim

    yum install epel-release
    yum
    install vim -y

    2.设置SSH永不过期

    vim /etc/ssh/sshd_config
    设置以下内容:
    ClientAliveInterval 60
    ClientAliveCountMax 3

    3.设置主机名

    hostnamectl set-hostname 主机名

    4.设置时区(如果需要)

    timedatectl set-timezone Asia/Shanghai

    5.切换iptables(如果需要)

    systemctl stop firewalld.service #停止firewall
    systemctl disable firewalld.service #禁止firewall开机启动
    yum install iptables-services -y
    #vim /etc/sysconfig/iptables
    systemctl restart iptables.service
    systemctl enable iptables.service

    6.自己安装的服务器有可能时间不对,一般云服务器不会(此项限centos7)

    date #查看时间
    hwclock --show #查看硬件时间
    yum install ntpdate #可能须要
    /usr/sbin/ntpdate time.windows.com #同步系统时间 有可能失败 换个服务器或重试
    #将硬件时钟调整为与系统时钟一致
    timedatectl set-local-rtc 1
    #或者
    hwclock --systohc --localtime

    7.关闭selinux,一般云服务器默认都关了

    vim /etc/selinux/config
    #找到 SELINUX=enfoceing 修改为:
    SELINUX=disabled

    8.history 记录时间IP等信息

    echo 'HISTTIMEFORMAT="%F %T `who am i` "' >> /etc/profile
    source /etc/profile

    9.安装GCC(如果需要,比如最小安装找不到make命令时)

    yum -y install gcc gcc-c++ libstdc++-devel

     10.解决/etc/rc.local开机不自动运行

    systemctl list-dependencies multi-user.target | grep rc-local
    #如果没有输出说明不正常
    
    chmod +x /etc/rc.d/rc.local
    systemctl daemon-reload
    
    #再次执行
    systemctl list-dependencies multi-user.target | grep rc-local
    #输出
    ● ├─rc-local.service

     11.升级系统及内核

    yum -y update

     

     

  • 相关阅读:
    机器学习手稿--NumPy篇
    机器学习手稿--PyTorch篇
    算法相关库
    如何保存用户的登录状态
    Go开发新手需知:Printf、Sprintf、Println 的区别
    二、Bean生命周期中AOP的流程
    Spring 注解驱动开发-IOC (精华版)
    我是如何编写流程图程序的?
    微前端架构设计之 WebSocket API 断连后重连的设计方案
    工具-使用distinct方法去重对象List
  • 原文地址:https://www.cnblogs.com/dotqin/p/13560054.html
Copyright © 2011-2022 走看看