1.yum(類似Windows軟件管家)
1.1yum源:linux下載軟件 軟件倉庫
默認(rèn)yum源:隨機(jī)地方 修改yum源為指定的網(wǎng)站
# ls -l /etc/yum.repos.d yum源文件路徑
yum repolist 查看當(dāng)前yum源
-
yum源配置文件 ==#yum repolist==:
[root@wangjc ~]# ls -l /etc/yum.repos.d total 32 -rw-r--r--. 1 root root 1664 Nov 23 2018 CentOS-Base.repo -rw-r--r--. 1 root root 1309 Nov 23 2018 CentOS-CR.repo -rw-r--r--. 1 root root 649 Nov 23 2018 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 Nov 23 2018 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 Nov 23 2018 CentOS-Media.repo -rw-r--r--. 1 root root 1331 Nov 23 2018 CentOS-Sources.repo -rw-r--r--. 1 root root 5701 Nov 23 2018 CentOS-Vault.repo [root@wangjc ~]# cat /etc/yum. yum.conf yum.repos.d/ [root@wangjc ~]# 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 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
1.2把系統(tǒng)當(dāng)前的yum源修改為從清華/阿里云下載
查看linnux當(dāng)前使用的yum源是什么?
yum repolist
[root@wangjc ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: ftp.sjtu.edu.cn
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 153 kB 00:00:00
(2/4): base/7/x86_64/group_gz | 165 kB 00:00:00
(3/4): base/7/x86_64/primary_db | 6.0 MB 00:00:03
(4/4): updates/7/x86_64/primary_db | 5.9 MB 00:00:03
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,097
extras/7/x86_64 CentOS-7 - Extras 307
updates/7/x86_64 CentOS-7 - Updates 1,010
repolist: 11,414
1.3修改為 從阿里云下載
==mirrors==.aliyun.com
[root@wangjc ~]# 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 46645 0 --:--:-- --:--:-- --:--:-- 47603
[root@wangjc ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,097
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 307
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,010
repolist: 11,414
1.4增加新的yum源:epel源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@wangjc ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 6017 0 --:--:-- --:--:-- --:--:-- 6036
[root@wangjc ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
epel | 5.3 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/3): epel/x86_64/group_gz | 90 kB 00:00:00
(2/3): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/3): epel/x86_64/primary_db | 6.9 MB 00:00:02
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,097
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,510
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 307
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,010
repolist: 24,924
2、linux必備工具詳解
yum install
yuminstall -y tree vim wget bash-completion bash-completion-extras lrzsz net-tools sysstat iotop iftop htop unzip nc nmap telnet bc psmisc httpd-tools bind-utils nethogs cowsay sl
-y 參數(shù) 所有詢問 選擇yes
yum clean all 清除yum緩存
2.1tree命令
==參數(shù) -L x 顯示目錄x級==
#tree -L 1 / 查看/下1級樹狀目錄
[root@wangjc wjc]# tree -L 1 /wjc
/wjc
└── 1
1 directory, 0 files
#tree -L 2 / 查看/下2級樹狀目錄
[root@wangjc wjc]# tree -L 2 /wjc
/wjc
└── 1
└── CentOS-Base.repo.bak
1 directory, 1 file
2.2vim vi升級版
等同于vi命令
vim /路徑
2.3wget 下載指定文件
wget命令默認(rèn)下載到當(dāng)前目錄 ==指定路徑需要加參數(shù) -P== 路徑不存在自動創(chuàng)建目錄
#wget www.baidu.com 默認(rèn)下載到當(dāng)前目錄
#wget -P /123/123/123/123 www.baidu.com 會自動創(chuàng)建目錄-P參數(shù)
[root@wangjc wjc]# wget -P 2 www.baidu.com
--2020-01-08 08:58:46-- http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 182.61.200.6, 182.61.200.7
Connecting to www.baidu.com (www.baidu.com)|182.61.200.6|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2381 (2.3K) [text/html]
Saving to: ‘2/index.html’
100%[===================================================================================================>] 2,381 --.-K/s in 0s
2020-01-08 08:58:46 (73.0 MB/s) - ‘2/index.html’ saved [2381/2381]
[root@wangjc wjc]# ll
total 4
drwxr-xr-x. 2 root root 34 Jan 8 08:54 1
drwxr-xr-x. 2 root root 24 Jan 8 08:58 2
-rw-r--r--. 1 root root 2381 Jan 23 2017 index.html.1
2.4 自動補(bǔ)全增強(qiáng)版
安裝完成之后需要斷開后重新連接
2.5bc 計算器
==參數(shù) -l 顯示小數(shù)點(diǎn)后數(shù)字==
bc basic calc 計算器
-l 顯示小數(shù) bc -l
[root@wangjc wjc]# bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
123/321
.38317757009345794392
2.6 lrzsz 軟件
#rz (上傳)
1、windows 下文件傳輸至linux
2、Windows中文件直接拖至xshell窗口
#sz (下載) 從 linux 中文件下載到Windows
#scp (互傳) scp 文件路徑 目標(biāo)ip:路徑
? scp /etc/hosts 10.0.0.201:/tmp
2.7 top 升級版 htop epel源必須設(shè)定好
linux:swap 交換分區(qū): 當(dāng)linux系統(tǒng)內(nèi)存不足的時候 swap充當(dāng)內(nèi)存
windows: 虛擬內(nèi)存
==負(fù)載:衡量系統(tǒng)繁忙程度指標(biāo) 主要mem內(nèi)存 swap 交換分區(qū)==
2.8 nmap 網(wǎng)絡(luò)掃描工具
==檢查指定端口 是否開啟 參數(shù) -p 指定端口==
#nmap -p22 域名 是否開啟
port 端口
是用來區(qū)分不同服務(wù) 遠(yuǎn)程連接服務(wù)的端口 sshd 默認(rèn)端口 22 端口范圍 1-65535
#nmap 掃描端口
[root@wangjc ~]# nmap www.baidu.com
#nmap 端口 域名
Starting Nmap 6.40 ( http://nmap.org ) at 2020-01-08 15:15 CST
Nmap scan report for www.baidu.com (182.61.200.6)
Host is up (0.00079s latency). #這個主機(jī)是開啟狀態(tài)
Other addresses for www.baidu.com (not scanned): 182.61.200.7
Not shown: 998 filtered ports
PORT STATE SERVICE #port 端口 22端口為遠(yuǎn)程維護(hù)端口
80/tcp open http
443/tcp open https
Nmap done: 1 IP address (1 host up) scanned in 48.00 seconds
#80/tcp open 80端口 http
#443/tcp open 443端口 https 加密的
3.遠(yuǎn)程連接排錯流程
ping www.baidu.com 看本機(jī)是否能上網(wǎng)
nmtui linux 下網(wǎng)卡配置
VMware 查看網(wǎng)絡(luò)連接配置
Windows nat8 重置網(wǎng)絡(luò)設(shè)置
3.1流程
遠(yuǎn)程連接排錯流程 | |
---|---|
1.道路是否通暢 | ping 服務(wù)器ip地址 |
2.是否有劫持 | 防火墻 selinux |
3.服務(wù)是否開啟 | Windows+r services.msc |
3.2==詳細(xì)操作過程==
telnet ip 地址
#1.道路是否通暢
#命令 ping 服務(wù)器ip地址 本地shell 相當(dāng)于Windows cmd
[c:\~]$ ping 10.0.0.201
#通的示例
正在 Ping 10.0.0.201 具有 32 字節(jié)的數(shù)據(jù):
來自 10.0.0.201 的回復(fù): 字節(jié)=32 時間<1ms TTL=64c:\~]$ ping 10.0.0.11
正在 Ping 10.0.0.11 具有 32 字節(jié)的數(shù)據(jù):
來自 10.0.0.1 的回復(fù): 無法訪問目標(biāo)主機(jī)。
請求超時。
來自 10.0.0.201 的回復(fù): 字節(jié)=32 時間<1ms TTL=64
來自 10.0.0.201 的回復(fù): 字節(jié)=32 時間<1ms TTL=64
來自 10.0.0.201 的回復(fù): 字節(jié)=32 時間<1ms TTL=64
10.0.0.201 的 Ping 統(tǒng)計信息:
數(shù)據(jù)包: 已發(fā)送 = 4,已接收 = 4,丟失 = 0 (0% 丟失),
[c:\~]$ 剖奔?以毫秒為單位):
最短 = 0ms,最長 = 0ms,平均 = 0ms
#不通示例
c:\~]$ ping 10.0.0.11
正在 Ping 10.0.0.11 具有 32 字節(jié)的數(shù)據(jù):
來自 10.0.0.1 的回復(fù): 無法訪問目標(biāo)主機(jī)。
請求超時。
#2.是否有劫持
# 防火墻 selinux(NSA)通常關(guān)閉這個軟件
#3.服務(wù)是否開啟 檢查端口是否開啟
telnet 檢查端口是否開啟
telnet ip 端口
[c:\~]$ telnet 10.0.0.201 22
Connecting to 10.0.0.201:22...
#Connection established. #連接已經(jīng)建立
To escape to local shell, press 'Ctrl+Alt+]'.
SSH-2.0-OpenSSH_7.4
Protocol mismatch.
Connection closed by foreign host.
Disconnected from remote host(10.0.0.201:22) at 16:18:39.
[c:\~]$ telnet 10.0.0.201 23
Connecting to 10.0.0.201:23...
Could not connect to '10.0.0.201' (port 23):# Connection failed.#連接失敗
3.3 常見導(dǎo)致道路不通的原因
1.==網(wǎng)卡配置 /etc/sysconfig/network-scripts/ifcfg-ens33==
nmtui 命令查詢
# cat /etc/sysconfig/network-scripts/ifcfg-ens33
/etc/ linux系統(tǒng)配置文件目錄
/etc/sysconfig/ system configure 系統(tǒng)配置
/etc/sysconfig/network-scripts/ script 腳本(命令)
/etc/sysconfig/network-scripts/ifcfg-ens33 if interface 接口 cfg configure
ens33 CentOS 7
eth0 CentOS 6
2.VMware虛擬網(wǎng)絡(luò)編輯器
3.VMware相關(guān)服務(wù)(windows中)
windows 鍵+r
輸入==services .msc==進(jìn)入Windows服務(wù)管理器
-
找到VMware開頭的的服務(wù)項(xiàng) 確保服務(wù)處于已啟動/正在運(yùn)行 自動
1.8Image 1.png
4.VMware 網(wǎng)卡問題
Windows鍵 +e 快速訪問 網(wǎng)絡(luò)連接
-
vmnet8
QQ圖片20200108173627.png