第1章 Centos7 IP地址的配置    1

1.1 第一种配置ip方法(nmtui)    1

1.2 第二种
修改网卡配置文件    5

1.2.1 使用cat查看配置文件    5

1.2.2 使用sed命令更改IP地址    6

第2章 xshell的优化    6

2.1 xshell连接失败、排错思路    6

第3章 CentosOS7.5 修改语言支持    7

3.1 查看当前系统语言支持    7

3.2 清屏    7

3.3 虚拟机通过net网络模式上网,排错思路    7

第4章 yum    7

4.1 yum    7

4.2 Sentos7.5构建国内yum源    8

第5章
虚拟机的快照以及克隆    9

5.1 虚拟机的快照    9

5.2 虚拟机的克隆    9

 

  1. Centos7 IP地址的配置

  2. 第一种配置ip方法(nmtui)

nmtui

使用方向键、tab、空格、回车操作




  1. 第二种 修改网卡配置文件

    1. 使用cat查看配置文件

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

[root@majinhai ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33

UUID=c32bc0de-5592-4f17-89b9-51ead27064c9

DEVICE=ens33

ONBOOT=yes

IPADDR=10.0.0.200

PREFIX=24

GATEWAY=10.0.0.254

DNS1=114.114.114.114

IPV6_PRIVACY=no

[root@majinhai ~]#

BOOTPROTO=none/start/dhcp #网卡获取ip地址的方式

        none/start 手动配置ip

        dhcp        自动获取ip

    ONBOOT=yes/no

                    yes 是开机启动状态    

                    no    开启禁用状态

    IPADDR=10.0.0.100 #配置IP地址

    PREFIX=24 或者    NETMASK=255.255.255.0    #子网掩码

    GATEWAY=10.0.0.254        #网关

    DNS1=114.114.114.114        #配置DNS 可以写三个

  1. 使用sed命令更改IP地址

sed -i 's/IPADDR=10.0.0.200/IPADDR=10.0.0.100/g' /etc/sysconfig/network-scripts/ifcfg-ens33

[root@majinhai ~]# sed -i 's/IPADDR=10.0.0.200/IPADDR=10.0.0.100/g' /etc/sysconfig/network-scripts/ifcfg-ens33

[root@majinhai ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33

UUID=c32bc0de-5592-4f17-89b9-51ead27064c9

DEVICE=ens33

ONBOOT=yes

IPADDR=10.0.0.100

PREFIX=24

GATEWAY=10.0.0.254

DNS1=114.114.114.114

IPV6_PRIVACY=no

修改开机启动sed –i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/netowek-script/ifcfg-ens33

[root@majinhai ~]# sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-ens33

[root@majinhai ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33

UUID=c32bc0de-5592-4f17-89b9-51ead27064c9

DEVICE=ens33

ONBOOT=yes

IPADDR=10.0.0.100

PREFIX=24

GATEWAY=10.0.0.254

DNS1=114.114.114.114

IPV6_PRIVACY=no

 

sed –i 's/BOOTPROTO=dhcp/BOOTPROTO=none/g' /etc/sysconfig/network-scripts/ifcfg-ens33

[root@majinhai ~]# sed -i 's/BOOTPROTO=dhcp/BOOTPROTO=none/g' /etc/sysconfig/network-scripts/ifcfg-ens33

[root@majinhai ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=ens33

UUID=c32bc0de-5592-4f17-89b9-51ead27064c9

DEVICE=ens33

ONBOOT=yes

IPADDR=10.0.0.100

PREFIX=24

GATEWAY=10.0.0.254

DNS1=114.114.114.114

IPV6_PRIVACY=no

 

修改完之后,使用systemctl restart network重启网络服务,让配置生效

 

  1. Xshell连接Cenos7.5

  2. xshell连接失败、排错思路

    1. ping虚拟机,如果ping不通,检查VMware8网卡的ip地址

    B、关闭selinux

    1. 查看selinux配置文件
      cat /etc/selinux/config

[root@majinhai ~]# cat /etc/selinux/config

 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of three two values:

# targeted - Targeted processes are protected,

# minimum - Modification of targeted policy. Only selected processes are protected.

# mls - Multi Level Security protection.

SELINUXTYPE=targeted

  1. 修改配置文件关闭selinux

    sed –i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config

[root@majinhai ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

[root@majinhai ~]# cat /etc/selinux/config

 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of three two values:

# targeted - Targeted processes are protected,

# minimum - Modification of targeted policy. Only selected processes are protected.

# mls - Multi Level Security protection.

SELINUXTYPE=targeted

  1. 修改完以后重启服务器配置才能生效
  2. setenforce 0 #临时关闭selinux

[root@majinhai ~]# setenforce 0

  1. 关闭firewalld(防火墙)

    systemctl stop firewalld    #临时关闭防火墙

    systemctl disable firewalld        永久关闭防火墙

[root@majinhai ~]# systemctl stop firewalld

[root@majinhai ~]# systemctl disable firewalld

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

[root@majinhai ~]#

  1. CentosOS7.5 修改语言支持

  2. 查看当前系统语言支持

    echo $LANG

        英文:LANG=en_US.UTF-8

        中文:LANG=zh_CN.UTF-8

  1. 清屏

    clear

    ctrl+l

  2. 虚拟机通过net网络模式上网,排错思路

    1. ping www.baidu.com
    2. 检查网关
    3. 检查VMware的虚拟网络编辑器—>服务
    4. 检查windows系统服务
      1. 右键此电脑——》管理——》服务和应用程序——》服务
      2. win+r 键入services.msc
      3. 任务管理器——》服务
  3. yum

  4. yum

    yum是linux系统下的软件包管理器(仓库、库管、菜单)

        路径:/etc/yum.repos.d/*.repo

        /etc/yum.repos.d/*.repo

[base] #仓库名称

name= #仓库描述

mirrorlist= #仓库镜像路径

baseurl= #仓库url路径 http://www.baidu.com

enabled= #仓库是否启用 1表示启用,0表示关闭

gpgcheck= #密钥检测 1表示开启,0表示关闭

  1. Sentos7.5构建国内yum源

  2. 下载国内的yum源(aliyun)

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

    # 如果是最小安装,系统里没有wget命令,就使用下面的命令来实现

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

[root@majinhai ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

% Total % Received % Xferd Average Speed Time Time Time Current

Dload Upload Total Spent Left Speed

100 2523 100 2523 0 0 31511 0 --:--:-- --:--:-- --:--:-- 31537

  1. 下载成功后,使用yum makecache,生成缓存

[root@majinhai ~]# yum makecache

已加载插件:fastestmirror

Determining fastest mirrors

* base: mirrors.aliyun.com

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com

base | 3.6 kB 00:00:00

extras | 3.4 kB 00:00:00

updates | 3.4 kB 00:00:00

(1/12): base/7/x86_64/group_gz | 166 kB 00:00:00

base/7/x86_64/primary_db FAILED

http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/03d0a660eb33174331aee3e077e11d4c017412d761b7f2eaa8555e7898e701e0-primary.sqlite.bz2: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"

正在尝试其它镜像。

(2/12): extras/7/x86_64/primary_db | 172 kB 00:00:00

(3/12): extras/7/x86_64/other_db | 110 kB 00:00:00

(4/12): extras/7/x86_64/filelists_db | 588 kB 00:00:00

(5/12): base/7/x86_64/other_db | 2.5 MB 00:00:00

(6/12): updates/7/x86_64/filelists_db | 2.4 MB 00:00:00

(7/12): updates/7/x86_64/other_db | 373 kB 00:00:00

(8/12): updates/7/x86_64/primary_db | 4.3 MB 00:00:00

(9/12): base/7/x86_64/primary_db | 5.9 MB 00:00:00

base/7/x86_64/filelists_db FAILED

http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/f35d0029ad59e9fca0823be708150f5ee28ee1707cdc9bdaf420da676daafe28-filelists.sqlite.bz2: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"

正在尝试其它镜像。

extras/7/x86_64/prestodelta FAILED

http://mirrors.aliyuncs.com/centos/7/extras/x86_64/repodata/6c971648c41e83b5a7036ff70e79fee7f28c3b480d2f76001e6df8cfde507ab2-prestodelta.xml.gz: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"

正在尝试其它镜像。

(10/12): base/7/x86_64/filelists_db | 6.9 MB 00:00:00

(11/12): extras/7/x86_64/prestodelta | 68 kB 00:00:00

updates/7/x86_64/prestodelta FAILED

http://mirrors.aliyuncs.com/centos/7/updates/x86_64/repodata/78b732b6beb1c39406c440264f8bc168484b4600e3a418d0b6919dad291f7037-prestodelta.xml.gz: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"

正在尝试其它镜像。

(12/12): updates/7/x86_64/prestodelta | 400 kB 00:00:00

元数据缓存已建立

  1. 注意:

    如果有报错需要关闭yum源验证

    sed –i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-Base.repo

[root@majinhai ~]# sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/CentOS-Base.repo

[root@majinhai ~]# cat /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client. You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

 

[base]

name=CentOS-$releasever - Base - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/

http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/

gpgcheck=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

  1. yum的常用命令:安装常用的工具ifconfig

    查找哪个包包含了ifconfig

[root@majinhai ~]# yum search ifconfig

已加载插件:fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.aliyun.com

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com

===================================== 匹配:ifconfig ======================================

net-tools.x86_64 : Basic networking tools

[root@majinhai ~]#

 

安装net-tools

[root@majinhai ~]# yum install -y net-tools

已加载插件:fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.aliyun.com

* extras: mirrors.aliyun.com

* updates: mirrors.aliyun.com

正在解决依赖关系

--> 正在检查事务

---> 软件包 net-tools.x86_64.0.2.0-0.22.20131004git.el7 将被 安装

--> 解决依赖关系完成

 

依赖关系解决

 

===========================================================================================

Package 架构 版本 源 大小

===========================================================================================

正在安装:

net-tools x86_64 2.0-0.22.20131004git.el7 base 305 k

 

事务概要

===========================================================================================

安装 1 软件包

 

总下载量:305 k

安装大小:917 k

Downloading packages:

net-tools-2.0-0.22.20131004git.el7.x86_64.rpm | 305 kB 00:00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

正在安装 : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1

验证中 : net-tools-2.0-0.22.20131004git.el7.x86_64 1/1

 

已安装:

net-tools.x86_64 0:2.0-0.22.20131004git.el7

 

完毕!

 

 

输入ifconfig

[root@majinhai ~]# ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 10.0.0.100 netmask 255.255.255.0 broadcast 10.0.0.255

inet6 fe80::6d25:5198:5939:f0c1 prefixlen 64 scopeid 0x20<link>

ether 00:0c:29:89:21:4f txqueuelen 1000 (Ethernet)

RX packets 19634 bytes 26554679 (25.3 MiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 2521 bytes 253823 (247.8 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

inet 127.0.0.1 netmask 255.0.0.0

inet6 ::1 prefixlen 128 scopeid 0x10<host>

loop txqueuelen 1000 (Local Loopback)

RX packets 0 bytes 0 (0.0 B)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 0 bytes 0 (0.0 B)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 

yum list     列表

yum search     搜索

install            安装

        yum install –y net-tools

remove            卸载

        yum remove –y 软件名

  1. yum grouplist

    yum groupstall

    yum groupmove

     

    yum updata(更新linux内核)

  2. 虚拟机的快照以及克隆

  3. 虚拟机的快照             

    1. 建议在关机状态下进行
    2. 虚拟机——》快照——》拍摄快照(备注当前要做快照的虚拟机当前配置状态)
  4. 虚拟机的克隆

    1. 必须在关机状态下进行
    2. 建议使用快照克隆
    3. 建议使用链接克隆
    4. 克隆完后,需要进入虚拟机修改相应的参数
    5. 修改/etc/sysconfig/network-scripts/ifcfg-ens33,修改IP地址,并删除UUID

Xshell连接Centos7.5和yum的更多相关文章

  1. Xshell连接Centos7

    13:53:10 2019-08-05 一个月暑假开始 学习搭建一个自己的博客 我是用阿里云的服务器搭建自己的博客 先利用XShell连接我的服务器 XShell下载地址:https://www.ne ...

  2. 【liunx】使用xshell连接虚拟机上的CentOS 7,使用xhell连接本地虚拟机上的Ubuntu, 获取本地虚拟机中CentOS 7的IP地址,获取本地虚拟机中Ubuntu 的IP地址,Ubuntu开启22端口

    注意,如果想用xshell去连接本地虚拟机中的linux系统,需要本地虚拟机中的系统是启动的才能连接!!!!! ============================================ ...

  3. Xshell连接SqlPlus无法使用退格、删除键

    问题:在使用xshell连接CentOS7,进入SQLPLUS进行命令操作时,如果输错了信息,无法进行退格键删除(显示“^H”),同样按删除键,显示“^[[3~”. 解决:网上查找了相关资料,可以通过 ...

  4. xftp连接centos7

    1.下载xftp文件,并正常进行安装 2.安装好之后运行,并新建会话,此时可见如下界面: 注意: 名称,可随便输入,自己能看懂是什么就行      主机,输入当前Linux服务器的ip(如何获取服务器 ...

  5. vmware在桥接模式下配置centos7网络,并使用xshell连接虚拟主机(总结篇)

    虚拟机系统:centos7 mini版本 1.虚拟安装成功之后,首先我配置的是桥接模式,因为我使用的是网线,配置完桥接模式之后我的linux虚拟机就可以访问网络了 2.因为我安装的是centos7的迷 ...

  6. win10上VMare安装Centos7并使用Xshell连接Centos

      一.CentOS 使用VMware虚拟机如何上网 1.宿主机的虚拟网关VMnet8的IP设置为自动获取. (1)打开控制面板:“控制面板” ---> “网络和 Internet” ---&g ...

  7. centos7下载和安装 通过xshell连接,有手就行,小白教程

    下载步骤: https://mirrors.aliyun.com/centos/?spm=a2c6h.13651104.0.0.3c3712b2NaHUdY 点击下载或者复制链接到迅雷下载 下载好以后 ...

  8. Xshell 连接虚拟机出现 "The remote SSH server rejected X11 forwarding request"

    1. 描述 虚拟机:VirtualBox Linux: centOS7 解决了 centOS7在VirtualBox中装好后的网络连接问题 后,用 Xshell 连接服务器时出现下面情况: 2. ss ...

  9. ssh连接CentOS7服务器

    ssh原理: ssh是一种专为远程登陆会话和其他网络服务提供安全性的协议,主要用于远程登陆. ssh采用公钥加密,在远程连接时,远程主机接收到用户的登录请求,将自己的公钥发送给用户,用户使用这个公钥将 ...

随机推荐

  1. E20180205-hm

    insensitive adj. 不敏感的; 感觉迟钝的; (对某事物) 无感觉的; (对变化) 懵然不知的; occurence 出现,发生; capital  n. 资本; 首都; 资源; 大写字 ...

  2. css覆盖select样式并添加小箭头

    .select { border-radius: 5px; border: 1px #F4A627 solid; -webkit-appearance: none;//清除默认样式 backgroun ...

  3. 【爬坑系列】之解读kubernetes的认证原理&实践

    对于访问kube-apiserver模块的请求来说,如果是使用http协议,则会顺利进入模块内部得到自己想要的:但是如果是用的是https,则能否进入模块内部获得想要的资源,他会首先要进行https自 ...

  4. [Usaco2009 Feb]庙会捷运Fair Shuttle

    Description 公交车一共经过N(1<=N<=20000)个站点,从站点1一直驶到站点N.K(1<=K<=50000)群奶牛希望搭乘这辆公交车.第i群牛一共有Mi(1& ...

  5. magento 用程序生成优惠劵码

    参考自http://fragmentedthought.com/fragments/programatically-creating-sales-rule-coupon-code 上面的代码只能生成C ...

  6. [转]如何在 TFS 中使用 Git

    本文转自 http://www.cnblogs.com/stg609/p/3651688.html 对 Charley Blog 的代码进行版本控制的想法由来已久,在代码建立之初其实已经使用过 TFS ...

  7. jq判断上下滚动

    $(document).ready(function(){ var p=0,t=0; $(window).scroll(function(e){ p = $(this).scrollTop(); if ...

  8. JS filters-ul li简单过滤

    功能要求:在input中输入字母,显示ul li中匹配的元素,隐藏不匹配的 <!DOCTYPE html> <html> <head> <meta chars ...

  9. CSS3 按钮特效(一)

    1. 实例 2.HTML 代码 <!DOCTYPE html> <html lang="en"> <head> <meta charset ...

  10. Android IJKPlayer缓冲区设置以及播放一段时间出错解决方案

    IJKPlayer拖动播放进度会导致重新请求数据,未使用已经缓冲好的数据,所以应该尽量控制缓冲区大小,减少不必要的数据损失. mMediaPlayer.setOption(IjkMediaPlayer ...