查看网卡命令

[root@localhost ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:2c:7b:5f brd ff:ff:ff:ff:ff:ff
inet 192.168.182.136/24 brd 192.168.182.255 scope global dynamic ens32
valid_lft 1474sec preferred_lft 1474sec
inet6 fe80::d323:fa:581f:5e96/64 scope link
valid_lft forever preferred_lft forever
[root@localhost ~]#   

重启网卡命令:

systemctl restart network.service

修改主机名

# 临时生效
hostname centos7
# 编辑配置文件/etc/hostname
# 以下命令可以直接修改配置文件
hostnamectl set-hostname centos7

操作:

[root@localhost ~]# hostnamectl set-hostname centos7
[root@localhost ~]# hostnamectl status
Static hostname: centos7
Icon name: computer-vm
Chassis: vm
Machine ID: c981bff1414443848dc72e55d6f69e26
Boot ID: 338c4215248c40598401ca7fa697636e
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.el7.x86_64
Architecture: x86-64
[root@localhost ~]# hostname
centos7
[root@localhost ~]# cat /etc/hostname
centos7

修改字符集

# 两种方法
localectl set-locale LANG=zh_CN.UTF-8 编辑/etc/locale.conf

操作:

[root@localhost ~]# localectl set-locale LANG=zh_CN.UTF-8
[root@localhost ~]# cat /etc/locale.conf
LANG=zh_CN.UTF-8
[root@localhost ~]# localectl status
System Locale: LANG=zh_CN.UTF-8
VC Keymap: us
X11 Layout: us
[root@centos7 ~]# echo $LANG
zh_CN.UTF-8

更改系统时间

[root@centos7 ~]# date
2017年 11月 02日 星期四 12:02:26 CST
[root@centos7 ~]# timedatectl set-time "2017-11-02 12:01:01"
[root@centos7 ~]# timedatectl status
Local time: 四 2017-11-02 12:01:12 CST
Universal time: 四 2017-11-02 04:01:12 UTC
RTC time: 四 2017-11-02 04:01:12
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[root@centos7 ~]#

更改系统时区

/usr/bin/timedatectl list-timezones # 列出所有时区
/usr/bin/timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海

查看系统版本号

查看系统版本号:

cat /etc/redhat-release 

所有支持systemd系统的统一发行版名称和版本号文件:

cat /etc/os-release

操作:

[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@centos7 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

查看系统启动级别

文件查看

cat /etc/inittab

命令查看当前启动级别

systemctl get-default

设置启动级别

# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5 systemctl set-default multi-user.target

操作:

[root@centos7 ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
[root@centos7 ~]# systemctl get-default
multi-user.target
[root@centos7 ~]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

管理服务

systemctl:融合service和chkconfig的功能于一体,兼容sysV和LSB得启动脚本,而且能够在进程启动过程中更有效地引导加载服务。

获取云主机外网IP地址

echo "`curl -s myip.ipip.net | awk -F " " '{print $2}'|awk -F":" '{print $2}'`_`hostname`" > /etc/hostname

设置开机启动

针对svn,nginx每次重启后均要手工启动,好麻烦,所以考虑将其做成开机启动,做成服务好麻烦,考虑像windows 一样,放在某个启动项中完成。

打开启动文件后,发现里面文件内容如下:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

意思很简单,需要将此文件权限改为可执行的,这也是为何开机后此文件不能执行的原因

操作步骤:

a. 添加可执行权限:
# chmod +x /etc/rc.d/rc.local b. 打开文件rc.local:
# vim /etc/rc.d/rc.local c. 在文件rc.local末添加开机应启动的脚本:
svnserve -d -r /var/svn
/usr/nginx/sbin/nginx d. 重启机器,验证svn和nginx已经启动成功
# reboot

CentOS7系统基本操作的更多相关文章

  1. 使用Xshell5连接虚拟机VMware中安装的CentOS7系统

    使用Xshell5连接VMware中安装的CentOS7系统 准备材料 Xshell 下载地址 VMware Workstation 12 Pro 下载地址 CentOS 7 64位系统 下载地址 安 ...

  2. GIT-Linux(CentOS7)系统部署git服务器

    GIT-Linux(CentOS7)系统部署git服务器 root账号登录 一. 安装并配置必要的依赖关系在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget ...

  3. centos7系统下搭建docker本地镜像仓库

    ## 准备工作 用到的工具, Xshell5, Xftp5, docker.io/registry:latest镜像 关于docker的安装和设置加速, 请参考这篇博文centos7系统下 docke ...

  4. centos7系统下配置jdk环境变量

    用到的工具, Xshell5, Xftp5 现在的jdk7下载链接不好找, 打开下载界面, 全是jdk8的, 我这里提供了一份百度云的下载地址http://pan.baidu.com/s/1jHF9m ...

  5. centos7系统下 docker 环境搭建

    运行环境: VMware Workstation Pro 在虚拟机中安装centos7系统, 选择最小安装, 网络连接方式选择的桥接(与宿主机在同一IP段)centos7一定要安装64位, docke ...

  6. CentOS7系统 ansible自动化部署多台服务器部署

    CentOS7系统 ansible自动化部署多台服务器部署   Ansible工作机制  从图中可以看出ansible分为以下几个部份: 1> Control Node:控制机器2> In ...

  7. 阿里云ECS Centos7 系统安装图形化桌面

    阿里云官网默认的Linux Centos7系统镜像,都是没有安装桌面环境的,用户如果要使用桌面,需要自己在服务器上进行安装. 本教程以MATE桌面安装为例 1.登录服务器,执行命令安装桌面环境. 先安 ...

  8. centos7系统运行级别简介

    centos7系统运行级别简介我们知道,centos6及之前的版本中,系统运行级别通过/etc/inittab文件进行设置和控制,但在centos7中,对这个文件的设置将不会对系统运行级别产生影响,这 ...

  9. centos7系统下,配置学校客户端网络记录

    存在的情况 1.学校的网络客户端绑定了个人的电脑MAC地址.绑定了IP地址. 2.我有两台笔记本,一台用了4年多,想用这台(B)直接装centos7系统,然后新买的笔记本(A)做为经常用的,系统为wi ...

随机推荐

  1. weblogic线程阻塞性能调优(图解)转

    声明:出现这个问题有程序方面.网络方面.weblogic设置方面等等原因,此文章主要讲述由于weblogic设置而导致的解决办法. 因为: 1.程序问题,需要项目自己去解决,weblogic在做优化处 ...

  2. 基于HTML5自定义文字背景生成QQ签名档

    分享一款利用HTML5实现的自定义文字背景应用,首先我们可以输入需要显示的文字,并且为该文字选择一张背景图片,背景图片就像蒙版一样覆盖在文字上.点击生成QQ签名档即可将文字背景融为一体生成另外一张图片 ...

  3. Linux(centOS)手动安装删除Apache+MySQL+PHP+Memcached原创无错版

    =================== 第一步:Apache安装 =================== 下载 去 http://www.apache.org 自己找最新的 国内有很多镜像点例如人人和 ...

  4. Task Scheduling

    Introduction In the past, developers have generated a Cron entry for each task they need to schedule ...

  5. 组合数学 - BZOJ 3997 - TJOI2015

    TJOI2015 Problem's Link ---------------------------------------------------------------------------- ...

  6. 查看win10的激活信息和版本号

    在命令提示符里输入 cscript /nologo %Windir%\System32\slmgr.vbs /dli&&cscript /nologo %Windir%\System3 ...

  7. google cloud之停止任务

    1.点击侧边栏:ML Engine -> Jobs 2.选择对应的任务,点击stop

  8. linux -- Ubuntu network-manager

    [Server版本] 在UbuntuServer版本中,因为只存有命令行模式,所以要想进行网络参数设置,只能通过修改/etc/network/interfaces.具体设置方法如下: (1) Ubun ...

  9. wifi的web 认证。

    wifi的web 认证.wifidog+authpuppy+php 或者Wiwiz Auth API

  10. 清除信号量队列导致zabbix自动关闭

    前几天在海外UCloud机器上部署了一套zabbix proxy和zabbix agentd,可是第二天一大早就收到邮件说zabbix_proxy挂掉了,上去查一下发现两台机器中的一台的proxy和a ...