第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. bzoj 3196 Tyvj 1730 二逼平衡树【线段树 套 splay】

    四舍五入就是个暴力. 对于线段树的每个区间都开一棵按权值排序的splay 对于第二个操作,二分一下,每次查询mid的排名,复杂度 $ O(nlog(n)^{3}) $ 其余的操作都是$ O(nlog( ...

  2. bzoj 1612: [Usaco2008 Jan]Cow Contest奶牛的比赛【Floyd】

    floyd传递关系,一个牛能确定排名的条件是能和所有牛确定关系 #include<iostream> #include<cstdio> using namespace std; ...

  3. 【笔记】对自定义异常的理解(Java)

    原本,原有的异常是非手动地.自动地抛出的. 了解自定义异常时,发现其信息只是: 继承了谁,即它自己算哪种异常: 它的信息,比如一个ID,这个貌似还是可选的: 它是可被传入信息的 没有遗漏的话,就这仨了 ...

  4. [浏览器美化]去除 Firefox 当前选中标签页顶端的线条

    Firefox 当前选中的标签页的最上方会显示有一条线,我觉得很丑,如图: 在地址栏输入 about:support ,然后点击打开目录. 在此目录中创建一个 chrome 文件夹(若没有),然后进入 ...

  5. vue 相关技术文章集锦

    不断更新,如果看到好的文章~~~ 总结篇 vue组件间通信六种方式(完整版) - 原作者:简书-浪里行舟 原理/源码篇 Vue.js 技术揭秘 Vue技术内幕 实战/经验篇 Vue相关开源项目库汇总 ...

  6. bootmanager is missing

    问题描述: 在计算机管理->存储->磁盘管理中,因误操作,将D盘设置了"将分区标记为活动分区(M)",导致重启时无法无法进入系统,提示"bootmanager ...

  7. 转 11g RAC R2 体系结构---Grid

    基于agent的管理方式 从oracle 11.2开始出现了多用户的概念,oracle开始使用一组多线程的daemon来同时支持多个用户的使用.管理资源,这些daemon叫做Agent.这些Agent ...

  8. 移动web开发基础(二)——viewport

    本文主要研究为什么移动web开发需要设置viewport,且一般设置为<meta name="viewport" content="width=device-wid ...

  9. Thinkphp删除缓存

    控制器代码   public function delcache(){ //当找到有Runtime的文件夹时,进入if if(is_dir(RUNTIME_PATH)){ delDir(RUNTIME ...

  10. UI动画效果

    UI界面的动画效果总结 方式1:头尾式 //开始动画 [UIView beginAnimations:nil context:nil]; //设置动画时间 [UIView setAnimationDu ...