美文网首页运维相关自我总结
备份文档——CentOS7.5安装过程

备份文档——CentOS7.5安装过程

作者: 如歌丨如歌 | 来源:发表于2020-02-12 20:28 被阅读0次
1..系统安装
    1)系统安装初始网络配置
        初始安装调整网卡
        tab----输入net.ifnames=0 biosdevname=0
        回车后进入安装界面
        选择NETWORK & HOST NAME
        configure-----激活网卡功能    配置ipv4地址    主机名配置 ----enabled开启网卡
        
    2) 系统分区设置
        选择INSTALLATION DESTNATION
        选择手动分区,再点击done,进入分区界面
        分区方案: 
        如何对Linux进行分区
            1.通用分区方法
                c盘==/boot   引导分区    200m
                   ==swap       交换分区(当内存不够用的时候,将硬盘中的空间充当从内存使用)1G
                                            内存<8G时,建议交换分区大小等于内存大小的1.5倍----3G
                                            内存>8G时,建议8G
                   ==/              根分区
                                        
            2.数据信息比较重要的分区方案
                /boot       200M
                swap        同上
                /           20G-200G
                /data       剩余空间
                
            3.灵活的分区方案
                /boot       200M
                swap        同上
                /           20G-200G
                剩余空间不分,根据业务情系统内况具体调整
    3)系统安全配置(关闭)
            system---kdump                  将宕机前的系统中的内存异常信息保存在系统里
            system---security   polity      系统安全策略
            
        进入SECURITY POLICY
        关闭on

    4)时区的设置

    5)系统软件的安装
        最小化安装(1236)

2..优化配置
    1) yum下载源的优化:
        1.优化基础的yum源文件
            备份yum源:
            mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
            添加阿里源:
            curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
            运行 yum makecache 生成缓存
            yum install wget -y
        2.优化扩展的yum源  通过阿里镜像源镜像优化
            wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

    2) 系统必备小工具安装:
        0..vim
        1..tree
        2..wget
        3..net-tools
        4..nmap
        5..bash-completion
        6..lsof     加大文件描述
        7..ntpdate  时间同步
        8..psmisc软件,可执行killall命令
        9..htop,cpu资源查看软件: top的升级版
        10..字符集相关软件: kde-l10n-Chinese glibc-common
        yum install kde-l10n-Chinese glibc-common vim net-tools lsof lrzsz psmisc htop nmap tree dos2unix nc telnet lsof ntpdate bash-completion bash-completion-extras -y
    
    3) 系统安全相关优化
        将一些安全服务先进行关闭
        先安装软件服务在进行安全配置
            1.防火墙服务程序
                centOS6:
                查看防火墙服务状态:/etc/init.d/iptables status
                
                临时关闭防火墙服务:/etc/init.d/iptables stop
                
                永久关闭:chkconfig iptable off
                         chkconfig iptable on
                
                centOS7:
                查看防火墙状态:{root@oldboy ~} #systemctl status firewalld
                
                临时关闭防火墙systemctl stop firewalld
                
                永久关闭:systemctl disable firewalld
                
                补充:
                查看服务状态信息简便方法:
                {root@oldboy ~} #systemctl is-active firewalld.service 
                unknown
                {root@oldboy ~} #systemctl start firewalld.service
                {root@oldboy ~} #systemctl is-active firewalld.service 
                active
                
                检查服务是否开机运行:
                systemctl is-enabled firewalld
                
            2.系统的selinux程序
                对root用户的权限进行控制
                很多企业中默认就是关闭的
                所以关闭centiOS6,和7相同
                查看状态:
                {root@oldboy ~} #getenforce 
                Enforcing
            
                临时关闭:
                {root@oldboy ~} #setenforce 
                usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]
                {root@oldboy ~} #setenforce 0
                {root@oldboy ~} #getenforce 
                Permissive
            
            
                永久关闭:
                vim  /etc/selinux/config
                #     enforcing - SELinux security policy is enforced.
                #     permissive - SELinux prints warnings instead of enforcing.
                #     disabled - No SELinux policy is loaded.
                
                SELINUX=enforcing  ------->SELINUX=disabled
                
                重新加载selinux文件,只能重启,所以一般先临时关闭,等适时重启时,会自动关闭
                
                {root@oldboy ~} #getenforce 
                Disabled
                
                优化好后记得检查是否优化成功
                
                {root@oldboy ~} #getenforce 
                Disabled
                
                {root@oldboy ~} #systemctl status firewalld.service 
                ● firewalld.service - firewalld - dynamic firewall daemon
                   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
                   Active: inactive (dead)
                     Docs: man:firewalld(1)
        
    4) 字符编码优化
        安装字符集:
        #yum install kde-l10n-Chinese
        #yum install glibc-common
        locale -a --- 查看所有字符集中有无 zh_CN.utf8
        vim /etc/locale.conf
        #LANG="en_US.UTF-8"
        LANG="zh_CN.utf8"
        source /etc/locale.conf
        运行locale查看系统字符集
        
        永久修改:
        1)方法一:vim /etc/profile ////优先.
        2)方法二:vim /etc/locale.conf
        {root@oldboy ~} #vim /etc/locale.conf
        
        LANG="en_US.UTF-8" ------------->zh_CN.UTF-8
        
        
        补充:一条命令既可以临时设置,又可以永久设置:
        localectl set-locale --------hostnamectl set-hostname
        
    5) xshell连接缓慢的问题
        第一步:
            修改ssh服务配置文件
             #vim /etc/ssh/sshd_config
            
             79 GSSAPIAuthentication yes    ----> GSSAPIAuthentication no
             115 #UseDNS yes                ----> UseDNS  no
             
             sed -i.bak 's@#UseDNS yes@UseDNS no@g;s@^GSSAPIAuthentication yes@GSSAPIAuthentication no@g'  /etc/ssh/sshd_config
             systemctl restart sshd :
        第二步:
            重启远程服务
            systemctl restart sshd
    
    6) #时间同步
       yum install -y ntpdate
       echo '#time sync by lidao at 2017-03-08' >>/var/spool/cron/root
       echo '*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root
       crontab -l
       
       使用命令: ntpdate ntp1.aliyun.com
       
       #时间格式修改
        vi  ~/.bash_profile
        export TIME_STYLE='+%Y/%m/%d %H:%M:%S'
        source ~/.bash_profile
        
    7) 编辑hosts文件,添加主机的本地地址方便管理
        先添加三台:
        172.16.1.7 web01
        172.16.1.31 nfs
        172.16.1.61 m01
        172.16.1.5 lb01
        172.16.1.41 backup
        172.16.1.51 db01

相关文章

网友评论

    本文标题:备份文档——CentOS7.5安装过程

    本文链接:https://www.haomeiwen.com/subject/tgzcfhtx.html