Centos7初始配置
配置 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
[root@localhost ~]# yum search ifconfig
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.shu.edu.cn
========================================= 匹配:ifconfig ==========================================
net-tools.x86_64 : Basic networking tools
yum install -y net-tools.x86_64
安装vim:
[root@localhost ~]# yum search vim
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.cn99.com
* updates: mirrors.shu.edu.cn
======================================== N/S matched: vim =========================================
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor 名称和简介匹配 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
[root@centos7- yum.repos.d]# ll
总用量
-rw-r--r--. root root 4月 : CentOS-Base.repo
-rw-r--r--. root root 4月 : CentOS-CR.repo
-rw-r--r--. root root 4月 : CentOS-Debuginfo.repo
-rw-r--r--. root root 4月 : CentOS-fasttrack.repo
-rw-r--r--. root root 4月 : CentOS-Media.repo
-rw-r--r--. root root 4月 : CentOS-Sources.repo
-rw-r--r--. root root 4月 : CentOS-Vault.repo
[root@centos7- yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@centos7- yum.repos.d]# ll
总用量
-rw-r--r--. root root 4月 : CentOS-Base.repo.bak
-rw-r--r--. root root 4月 : CentOS-CR.repo
-rw-r--r--. root root 4月 : CentOS-Debuginfo.repo
-rw-r--r--. root root 4月 : CentOS-fasttrack.repo
-rw-r--r--. root root 4月 : CentOS-Media.repo
-rw-r--r--. root root 4月 : CentOS-Sources.repo
-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
[root@centos7- yum.repos.d]# ll
总用量
-rw-r--r--. root root 6月 : CentOS-Base.repo
-rw-r--r--. root root 4月 : CentOS-Base.repo.bak
-rw-r--r--. root root 4月 : CentOS-CR.repo
-rw-r--r--. root root 4月 : CentOS-Debuginfo.repo
-rw-r--r--. root root 4月 : CentOS-fasttrack.repo
-rw-r--r--. root root 4月 : CentOS-Media.repo
-rw-r--r--. root root 4月 : CentOS-Sources.repo
-rw-r--r--. root root 4月 : CentOS-Vault.repo
[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
那么,想修改为多用户状态只需执行:
systemctl set-default multi-user.target
修改为图形界面执行:systemctl set-default graphical.target
修改时区:
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工具
# yum -y install ntp ntpdate
2. 设置系统时间与网络时间同步
# ntpdate cn.pool.ntp.org
vim /etc/crontab
*/5 * * * * root ntpdate cn.pool.ntp.org
3. 将系统时间写入硬件时间
# hwclock --systohc
4.强制系统时间写入CMOS中防止重启失效
# hwclock -w
或# clock -w
Centos7初始配置的更多相关文章
- centos7.3.1611安装及初始配置
安装前规划: 主机名称 网络配置 分区配置 分区配置 自定义分区,标准分区 /boot 200M (可选) swap 内存1.5倍到2倍(不大于8G) / 根分区(100G到200G) 其余的备用(数 ...
- virtualBox安装centos7并配置nginx php mysql运行环境
virtualBox安装centos7并配置nginx php mysql运行环境 一:virtualBox安装centos7并进行基础设置 1.下载dvd.iso安装文件,下载地址:https:// ...
- centos7基础配置
记录虚拟机安装完成后的初始配置: 1.网络: 桥接方式,设置静态ip,与物理机同一网段 Ip配置 配置完成 service network restart ,重启网络后 物理机可ssh连接虚拟机系统. ...
- Centos7网络配置,vsftpd安装及530报错解决
今天在虚拟机安装CentOS7,准备全新安装LTMP,结果又是一堆问题,不过正好因为这些出错,又给自己长了见识. 1,CentOS7网络配置 最小化安装CentOs7后,ifconfig提示comma ...
- Centos7安装配置gitlab
Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...
- VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装
VMware中安装CentOS7网络配置静态IP地址,常用配置和工具安装在阿里云开源镜像地址下载镜像Index of /centos/7.2.1511/isos/x86_64/http://mirro ...
- centos7初步配置
centos7初步配置 首先安装lrzsz zip/unzip yum -y install lrzsz yum -y install zip unzip 安装vim yum install vim* ...
- Git 笔记二-Git安装与初始配置
git 笔记二-Git安装与初始配置 Git的安装 由于我日常生活和工作基本上都是在Windows上,因此此处只说windows上的安装.Windows上的安装和其他程序一样,只需要到http://g ...
- IDEA 初始配置教程
IDEA 初始配置教程 如果你是第一次使用 IDEA,或者对 IDEA 常用配置仍然不熟悉,那么本文就特别适合你. 本文只是根据我自己的使用经验来进行配置,不一定适合所有的情况,但是对你肯定会有帮助. ...
随机推荐
- ROC曲线(receiver-operating-characteristic curve)-阈值评价标准(转)
转自:http://blog.csdn.net/abcjennifer/article/details/7359370 ROC曲线指受试者工作特征曲线 / 接收器操作特性曲线(receiver ope ...
- 20181011xlVba提取邮箱手机号码
Sub TransferData() AppSettings Dim StartTime As Variant Dim UsedTime As Variant StartTime = VBA.Time ...
- ssh登陆报错:packet_write_wait: Connection to x.x.x.x port 22: Broken pipe
ssh登陆报错:packet_write_wait: Connection to x.x.x.x port 22: Broken pipe 参考文章: https://patrickmn.com/as ...
- 简单记录下3PC
三PC分为三个阶段:CanCommit,PreCommit, DoCommit 整个分布式系统中,有一个组织者,其他属于参与者,当一个组织者挂了,会从其他可用site中选一个组织者出来,降低阻塞,避免 ...
- 『PyTorch』第四弹_通过LeNet初识pytorch神经网络_上
总结一下相关概念: torch.Tensor - 一个近似多维数组的数据结构 autograd.Variable - 改变Tensor并且记录下来操作的历史记录.和Tensor拥有相同的API,以及b ...
- python-flask-路由匹配源码分析
@app.route('/') def hello_world(): return 'Hello World!' 第1步: class Flask(_PackageBoundObject): def ...
- leetcode-algorithms-13 Roman to Integer
leetcode-algorithms-13 Roman to Integer Roman numerals are represented by seven different symbols: I ...
- Oracle11g温习-第十一章:管理undo
2013年4月27日 星期六 10:40 1.undo tablespace 功能 undo tablespace 功能:用来存放从datafiles 读出的数据块旧的镜像 [ ...
- Leetcode 98
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode ...
- ORACLE SQL 函数 INITCAP()
INITCAP() 假设c1为一字符串.函数INITCAP()是将每个单词的第一个字母大写,其它字母变为小写返回. 单词由空格,控制字符,标点符号等非字母符号限制. select initcap('h ...