配置 centos7 ip地址:

  vi /etc/sysconfig/network-scripts/ifcfg-ens33

    BOOTPROTO=static

    ONBOOT=yes

    NM_CONTROLLED=no

    IPADDR=

    NATMASK=

    GATEWAY=

    DNS1=

    DNS2=

安装ifconfig:

  ifconfig 不可使用,检查 cd /sbin 目录 ls | grep ifconfig,如果没有则

    yum search ifconfig

  1. [root@localhost ~]# yum search ifconfig
  2. 已加载插件:fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.aliyun.com
  6. * updates: mirrors.shu.edu.cn
  7. ========================================= 匹配:ifconfig ==========================================
  8. net-tools.x86_64 : Basic networking tools

    yum install -y net-tools.x86_64

安装vim:

  1. [root@localhost ~]# yum search vim
  2. 已加载插件:fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base: mirrors.aliyun.com
  5. * extras: mirrors.cn99.com
  6. * updates: mirrors.shu.edu.cn
  7. ======================================== N/S matched: vim =========================================
  8. protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
  9. vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
  10. vim-common.x86_64 : The common files needed by any version of the VIM editor
  11. vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
  12. vim-filesystem.x86_64 : VIM filesystem layout
  13. vim-minimal.x86_64 : A minimal version of the VIM editor
  14.  
  15. 名称和简介匹配 only,使用“search all”试试。
    [root@localhost ~]# yum install -y vim-enhanced.x86_64

  yum install -y vim-enhanced.x86_64

配置centos7 hostname:

  同时修改三个状态主机名:静态、瞬态和灵活主机名:

    hostnamectl set-hostname 主机名

    hostnamectl --static
    hostnamectl --transient
    hostnamectl --pretty

就像上面展示的那样,在修改静态/瞬态主机名时,任何特殊字符或空白字符会被移除,而提供的参数中的任何大写字母会自动转化为小写。一旦修改了静态主机名,/etc/hostname 将被自动更新。然而,/etc/hosts 不会更新以保存所做的修改,所以你每次在修改主机名后一定要手动更新/etc/hosts,之后再重启CentOS 7。否则系统再启动时会很慢。

  手动更新/etc/hosts

    vim /etc/hosts

    127.0.0.1    主机名
    #127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain
    ::1        localhost localhost.localdomain localhost6 localhost6.localdomai

 安装wget:

  yum install -y wget

配置yum源:

  cd /etc/yum.repos.d/

  mv CentOS-Base.repo CentOS-Base.repo.bak

  1. [root@centos7- yum.repos.d]# ll
  2. 总用量
  3. -rw-r--r--. root root 4 : CentOS-Base.repo
  4. -rw-r--r--. root root 4 : CentOS-CR.repo
  5. -rw-r--r--. root root 4 : CentOS-Debuginfo.repo
  6. -rw-r--r--. root root 4 : CentOS-fasttrack.repo
  7. -rw-r--r--. root root 4 : CentOS-Media.repo
  8. -rw-r--r--. root root 4 : CentOS-Sources.repo
  9. -rw-r--r--. root root 4 : CentOS-Vault.repo
  10. [root@centos7- yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
  11. [root@centos7- yum.repos.d]# ll
  12. 总用量
  13. -rw-r--r--. root root 4 : CentOS-Base.repo.bak
  14. -rw-r--r--. root root 4 : CentOS-CR.repo
  15. -rw-r--r--. root root 4 : CentOS-Debuginfo.repo
  16. -rw-r--r--. root root 4 : CentOS-fasttrack.repo
  17. -rw-r--r--. root root 4 : CentOS-Media.repo
  18. -rw-r--r--. root root 4 : CentOS-Sources.repo
  19. -rw-r--r--. root root 4 : CentOS-Vault.repo

  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  1. [root@centos7- yum.repos.d]# ll
  2. 总用量
  3. -rw-r--r--. root root 6 : CentOS-Base.repo
  4. -rw-r--r--. root root 4 : CentOS-Base.repo.bak
  5. -rw-r--r--. root root 4 : CentOS-CR.repo
  6. -rw-r--r--. root root 4 : CentOS-Debuginfo.repo
  7. -rw-r--r--. root root 4 : CentOS-fasttrack.repo
  8. -rw-r--r--. root root 4 : CentOS-Media.repo
  9. -rw-r--r--. root root 4 : CentOS-Sources.repo
  10. -rw-r--r--. root root 4 : CentOS-Vault.repo
  11. [root@centos7- yum.repos.d]#

  yum clean all

   yum makecache

按照该文件所说的,runlevels被targets所取代,即CentOS7采用加载target的方式来替代之前的启动级别。其中有两个重要的target:multi-user.target与graphical.target。它们分别表示运行级别中的3与5级别。

  通过systemctl get-default可获得默认启动的target

  通过systemctl set-default设置默认启动的target

  那么,想修改为多用户状态只需执行:

  1. systemctl set-default multi-user.target

  修改为图形界面执行:systemctl set-default graphical.target

修改时区:

  1. timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
    timedatectl list-timezones # 列出所有时区
    timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致,
    0 为设置为 UTC 时间
    timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
    其实不考虑各个发行版的差异化, 从更底层出发的话, 修改时间时区比想象中要简单:
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

1.  安装ntpdate工具

  1.  

# yum -y install ntp ntpdate

  1.  

2.  设置系统时间与网络时间同步

  1.  

# ntpdate cn.pool.ntp.org

vim /etc/crontab

*/5 *  *  *  * root    ntpdate cn.pool.ntp.org

3.  将系统时间写入硬件时间

  1.  

# hwclock --systohc

  1.  

4.强制系统时间写入CMOS中防止重启失效

  1.  

# hwclock -w

  1.  

或# clock -w

Centos7初始配置的更多相关文章

  1. centos7.3.1611安装及初始配置

    安装前规划: 主机名称 网络配置 分区配置 分区配置 自定义分区,标准分区 /boot 200M (可选) swap 内存1.5倍到2倍(不大于8G) / 根分区(100G到200G) 其余的备用(数 ...

  2. virtualBox安装centos7并配置nginx php mysql运行环境

    virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...

  3. centos7基础配置

    记录虚拟机安装完成后的初始配置: 1.网络: 桥接方式,设置静态ip,与物理机同一网段 Ip配置 配置完成 service network restart ,重启网络后 物理机可ssh连接虚拟机系统. ...

  4. Centos7网络配置,vsftpd安装及530报错解决

    今天在虚拟机安装CentOS7,准备全新安装LTMP,结果又是一堆问题,不过正好因为这些出错,又给自己长了见识. 1,CentOS7网络配置 最小化安装CentOs7后,ifconfig提示comma ...

  5. Centos7安装配置gitlab

    Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...

  6. VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装

    VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...

  7. centos7初步配置

    centos7初步配置 首先安装lrzsz zip/unzip yum -y install lrzsz yum -y install zip unzip 安装vim yum install vim* ...

  8. Git 笔记二-Git安装与初始配置

    git 笔记二-Git安装与初始配置 Git的安装 由于我日常生活和工作基本上都是在Windows上,因此此处只说windows上的安装.Windows上的安装和其他程序一样,只需要到http://g ...

  9. IDEA 初始配置教程

    IDEA 初始配置教程 如果你是第一次使用 IDEA,或者对 IDEA 常用配置仍然不熟悉,那么本文就特别适合你. 本文只是根据我自己的使用经验来进行配置,不一定适合所有的情况,但是对你肯定会有帮助. ...

随机推荐

  1. openstack中数据库连接数太多--pymysql.err.OperationalError,1040, u'Too many connections'

    1.出现问题: openstack运行过程中出现如下问题: OperationalError: (pymysql.err.OperationalError) (1040, u'Too many con ...

  2. every day a practice —— morning(3)

    "WeChat does not store any chat histories. They are stored only on users' phones, computers or ...

  3. WCF利用Stream上传大文件

    WCF利用Stream上传大文件 转自别人的文章,学习这个例子,基本上wcf也算入门了,接口用法.系统配置都有了 本文展示了在asp.net中利用wcf的stream方式传输大文件,解决了大文件上传问 ...

  4. 【洛谷p1106】删数问题

    (洛谷t2755暂时过不去了) 删数问题[传送门] 洛谷算法标签: emmmm……删数问题又牵扯到了字符串.因为毕竟高精度的数240位呢!要是输入一个整型,要码240行来求出每一位……怕是还没求出来就 ...

  5. git:not a git repository (or any of the parent directories)

    我用git add file添加文件时出现了这样错误: fatal: Not a git repository (or any of the parent directories): .git 提示说 ...

  6. Sublime Text 3 + phpfmt 插件

    Sublime Text 3 + phpfmt 插件 phpfmt 插件参数 ```json{ "autocomplete": true, "enable_auto_al ...

  7. ActiveMQ的spring配置文件

    从官网copy出来,做了部分修改: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=& ...

  8. python3爆力破解rtsp脚本

    一.说明 hydra是说已实现了rtsp的爆力破解,但是使用时发现字典中明明已包含正确的用户名密码hydra却还没检测出来: 拦截数据包查看,感觉hydra只是尝试去匿名访问,并没有发送用户名密码去验 ...

  9. burpsuite拦截https数据包(Firefox)

    1.配置浏览器对http/https都使用burpsuite代理 http和https是分开的,对http使用了代理并不代表对https也使用了代理,要配置浏览器让其对https也使用同样的代理. 当 ...

  10. python格式化日期

    #!/usr/bin/python # -*- coding: UTF-8 -*- import time import calendar """ 时间元组(年.月.日. ...