• Centos7安装完成后一些基本操作


    1.基本操作一:主机名

    # centos7有一个新的修改主机名的命令hostnamectl
    hostnamectl set-hostname --static www.node1.com
    # 有些命令的参数可以自动补全,如果不能补全,则安装下面的命令
    yum -y install bash-completion
    

    2.基本操作二:关闭iptables

    # 查看firewalld服务的状态,active是启动状态,inactive是关闭状态
    systemctl status firewalld.service
    systemctl stop firewalld.service
    systemctl list-unit-files |grep firewalld   # 查看firewalld是否开机自动启动
    systemctl disable firewalld.service  # 类似以前的chkconfig xxx off
    

    3.基本操作三:关闭selinux

    # 改完后,在后面重启系统生效
    sed -i 7s/enforcing/disabled/  /etc/selinux/config
    

    4.基本操作四:网络配置

    systemctl stop NetworkManager
    systemctl status NetworkManager
    systemctl disable NetworkManager
    vim /etc/sysconfig/network-scripts/ifcfg-enp2s0  # 网卡名如果不一样,找到对应的文件就行
    BOOTPROTO="static"
    NAME="enp2s0"
    DEVICE="enp2s0"
    ONBOOT="yes"
    IPADDR=192.168.254.10
    NETMASK=255.255.255.0
    GATEWAY=192.168.254.2
    DNS1=192.168.254.2
    DNS1=223.5.5.5
    # network服务这里默认还是可以使用原来的管理方法
    /etc/init.d/network restart
    chkconfig network on
    

    5.基本操作五:yum配置

    配置本地yum源
    # 删除了它所有的默认的配置(因为这些默认配置要连公网的源,速度太慢)
    rm -rf /etc/yum.repos.d/*
    mkdir /media/cdrom
    mount /dev/cdrom /media/cdrom
    # 自建本地yum源配置文件
    vim /etc/yum.repos.d/local.repo
    [local]
    name=local
    baseurl=file:///media/cdrom
    enabled=1
    gpgcheck=0
    
    yum-config-manager --enable local  # 也可以直接把上面的enabled改为1
    yum repolist
    
    配置可选163的centos源
    配置方法两种
    a)直接公网连接网易163,优点:速度快,软件包会定期更新
    cd /etc/yum.repos.d/
    wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
    b)自己编写
    # vim /etc/yum.repos.d/cento163.repo
    [centos163]
    name=centos163
    baseurl=http://mirrors.163.com/centos/7.3.1611/os/x86_64
    enabled=1
    gpgcheck=0
    
    配置可选epel源
    配置方法两种
    a)直接公网连接epel,优点:速度快,软件包会定期更新
    # 此版本信息会随时间推移而变化
    wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
    rpm -ivh epel-release-7-10.noarch.rpm
    b)自己编写
    vim /etc/yum.repos.d/epel.repo
    [epel]
    name=epel
    baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64
    enabled=1
    gpgcheck=0
    配置完上面三个yum后
    yum clean all
    yum makecache fast
    

    6.基本操作六:输入法配置(有需要再研究)

    7.基本操作七:时间同步

    yum -y install ntp  ntpdate
    vim /etc/ntp.conf
    # 确认配置文件里有下列的时间同步源
    server 0.rhel.pool.ntp.org iburst
    server 1.rhel.pool.ntp.org iburst
    server 2.rhel.pool.ntp.org iburst
    server 3.rhel.pool.ntp.org iburst
    systemctl enable ntpd  # 设置开机自动启动ntpd
    systemctl start ntpd   # 立即启动ntpd服务
    ntpdate 0.rhel.pool.ntp.org  # 如果还没有同步成功,可以用此命令手动同步一下
    # 设置默认启动级别为图形模式(相当于以前的5级别)
    systemctl get-default  # 查看当前的运行模式
    systemctl set-default graphical.target  # 设置图形模式为默认模式
    
  • 相关阅读:
    [转]一键安装藏隐患,phpStudy批量入侵的分析与溯源
    Vue Cli安装以及使用
    全局安装 Vue cli3 和 继续使用 Vue-cli2.x
    [转]局域网共享一键修复 18.5.8 https://zhuanlan.zhihu.com/p/24178142
    DELPHI中千万别直接使用CreateThread ,建议使用BeginThread(在C++中无大问题,可是到了DELPHI中情况就不一样了)
    [转]【Delphi】 Thread.Queue与Synchronize的区别
    如何使用Windows Library文件进行持久化
    chromium中的性能优化工具syzyProf
    [转]室友靠打游戏拿30万offer,秘密竟然是……
    .NET中的三种Timer的区别和用法
  • 原文地址:https://www.cnblogs.com/fawaikuangtu123/p/9656652.html
Copyright © 2020-2023  润新知