zoukankan      html  css  js  c++  java
  • centos7系统安装完成后一些基本的优化

    安装完centos7.3后,做一些基本的操作
    基本操作一:主机名
    centos7有一个新的修改主机名的命令hostnamectl
    # hostnamectl set-hostname --static li.cluster.com
    # vim /etc/hosts	--最后加上你的IP与主机名的绑定
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    172.16.13.250  li.cluster.com  li 
    
    基本操作二:关闭iptables
    # systemctl status firewalld.service	--查看firewalld服务的状态,active是启动状态,inactive是关闭状态
    # systemctl stop firewalld.service	--关闭此服务
    # systemctl list-unit-files |grep firewalld	--查看firewalld是否开机自动启动
    firewalld.service                           enabled 
    
    # systemctl disable firewalld.service	--类似以前的chkconfig xxx off
    # systemctl list-unit-files |grep firewalld
    firewalld.service                           disabled
    
    基本操作三:关闭selinux
    # sed -i 7s/enforcing/disabled/  /etc/selinux/config	--改完后,在后面重启系统生效
    
    基本操作四:网络配置
    # 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=172.16.13.X
    NETMASK=255.255.255.0
    GATEWAY=172.16.13.254
    DNS1=114.114.114.114
    # /etc/init.d/network restart		--network服务这里默认还是可以使用原来的管理方法
    # chkconfig network on
    
    基本操作五:yum配置
    ,配置本地yum源
    # rm /etc/yum.repos.d/* -rf	--这里我删除了它所有的默认的配置(因为这些默认配置要连公网的源,速度太慢)
    # vim /etc/yum.repos.d/local.repo	--然后自建了本地yum源配置文件
    [local]
    name=local
    baseurl=file:///yum
    enabled=1
    gpgcheck=0
    
    ,配置可选163的centos源
    163centos源(其实就是centos官方的yum,使用163的国内速度更快)
    配置方法两种
    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
    
    基本操作六:输入法配置
    默认只有拼音中文输入法,需要使用极点五笔输入法,安装过程如下:
    # yum install ibus ibus-table-chinese-wubi-jidian
    安装完后,需要右上角把用户注销重登录
    左上角applications--system tools -- settions -- Region & Language -- +或-你的输入法就可以了
    加完之后,使用super+space键进行切换
    
    基本操作七:时间同步
    # yum install ntp  ntpdate	--安装ntp时间同步相关软件包
    # 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服务
    # date				--确认时间与现在时间一致
    # ntpdate 0.rhel.pool.ntp.org	--如果还没有同步成功,你可以用此命令手动同步一下
    
    另外一个时间服务器的搭建方法
    # yum install xinetd -y
    # vim /etc/xinet.d/time-dgram
    	disable         = no	(--yes改为no)
    # vim /etc/xinetd.d/time-stream
    	disable         = no	(--yes改为no)
    # systemctl restart xinetd
    # systemctl status xinetd
    # systemctl enable xinetd
    客户端同步时间的用法
    # rdate -s 时间服务器的ip
    
    基本操作八:
    有些命令的参数可以自动补全,如果不能补全,则安装下面的命令(可能需要注销一下)
    # yum install bash-completion
    
    基本操作九:vnc的配置
    # vncpasswd 		--设定vcn连接的密码
    Password:
    Verify:
    # x0vncserver --PasswordFile=/root/.vnc/passwd --AlwaysShared=on --AcceptKeyEvents=off AcceptPointerEvents=off &> /dev/null &
    
    基本操作十:桌面锁屏
    左上角applications--system tools -- settions -- Privacy  设置是否自动锁屏
    手动锁屏
    super+l 
    
    基本操作十一:图形界面快捷键修改
    左上角applications--system tools -- settions -- Keyboard -- Shortcuts   去修改自己习惯的快捷键
    
    基本操作十二:设置默认启动级别为图形模式(相当于以前的5级别)
    # systemctl get-default			--查看当前的运行模式
    # systemctl set-default graphical.target	--设置图形模式为默认模式
    
    
    ======================================================================
    
  • 相关阅读:
    小白的进阶之路7
    小白的进阶之路6
    小白的进阶之路5
    小白的进阶之路4
    小白的进阶之路3
    小白的进阶之路2
    小白的进阶之路1
    02CSS布局13
    02css定位12
    02css盒子模型11
  • 原文地址:https://www.cnblogs.com/yanjieli/p/7502266.html
Copyright © 2011-2022 走看看