第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. Luogu P1134 阶乘问题 【数学/乱搞】 By cellur925

    输入输出格式 输入格式: 仅一行包含一个正整数 NN . 输出格式: 一个整数,表示最右边的非零位的值. 输入输出样例 输入样例#1: 12 输出样例#1: 6 说明 USACO Training S ...

  2. 【SpringCloud构建微服务系列】微服务网关Zuul

    一.为什么要用微服务网关 在微服务架构中,一般不同的微服务有不同的网络地址,而外部客户端(如手机APP)可能需要调用多个接口才能完成一次业务需求.例如一个电影购票的手机APP,可能会调用多个微服务的接 ...

  3. SqlParameter 的使用

    SqlParameter[] sqlParams = new SqlParameter[2];sqlParams[0] = new SqlParameter("@RoleId", ...

  4. hdu 1025 Constructing Roads In JGShining's Kingdom

    本题明白题意以后,就可以看出是让求最长上升子序列,但是不知道最长上升子序列的算法,用了很多YY的方法去做,最后还是超时, 因为普通算法时间复杂度为O(n*2),去搜了题解,学习了一下,感觉不错,拿出来 ...

  5. Bryce1010的linux课程设计

    1.设计目的 2.软件环境 3.要求 4.需求分析 5.总体设计 6.详细设计 7.调试与测试 8.总结 思路整理: 1.如果要开始编译着手的准备 SQLite数据库的安装 gtk+的安装 (.... ...

  6. Windows查杀端口

    Windows环境下当某个端口被占用时,通过netstat命令进行查询pid,然后通过taskkill命令杀进程. 一.查询占用端口号的进程信息 netstat -an|findstr 二.杀掉占用端 ...

  7. openssh安装、设置指定端口号、免密码登录、变量传递、防暴力破解

    首先确保机器挂在好光盘镜像,然后查看软件包信息 [root@xuegod63 ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev ...

  8. js拿到焦点所在的标签对象

    通过 document.activeElement 此时是js对象,如果要调用jQuery的API那么就转换成jquery对象 $(document.activeElement)

  9. (六)Mybatis总结之延迟加载

    应用场景: i.假如一个用户他有N个订单(N>=1000),那么如果一次性加载的话,一个用户对象的订单集合OrderList里面就会有1000多个Order的对象.计算:一个订单对象里面数据有多 ...

  10. Spring Mvc相关随笔

    web.xml部分 1.欢迎界面 <welcome-file-list> <welcome-file>/views/login.jsp</welcome-file> ...