今天开始同时更新Linux入门课程。之前自己一直都是带着研究过一阵子Linux,但是研究的不是很透彻,这里正好在微信的公众号中下载到了慕课网的快速上手Linux的视频,正好开始学习一下。
整个视频是基于CentOS 7 进行讲解的。这里的话为了和视频课程一致,我采用的是VirtualBox进行安装,虽然我的ParallelDesktop在macOS下也有,但是为了和课程一致。
这里的话Linux采用Minimum进行安装,仅仅采用命令行的形式。
除此以外,由于我使用的是macOS系统,XShell命令行软件没有支援,这里的话经过我的尝试,找到了一款优秀的国产软件FinalShell可以实现和XShell几乎一样的功能,可以在macOS系统下替代XShell进行操作。强力安利一下。
下面课程主要的SSH操作过程我直接写在下面:
连接成功
Last login: Mon Apr 16 06:56:30 2018
[root@localhost ~]# ifconfig
enp0s3: flags=4163 mtu 1500
inet 192.168.0.114 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a7cc:ad45:300c:bbfe prefixlen 64 scopeid 0x20
ether 08:00:27:9d:62:ed txqueuelen 1000 (Ethernet)
RX packets 887 bytes 77760 (75.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 783 bytes 103340 (100.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 4 bytes 340 (340.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 340 (340.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# ifconfig
enp0s3: flags=4163 mtu 1500
inet 192.168.0.114 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a7cc:ad45:300c:bbfe prefixlen 64 scopeid 0x20
ether 08:00:27:9d:62:ed txqueuelen 1000 (Ethernet)
RX packets 2077 bytes 167670 (163.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1837 bytes 229744 (224.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 4 bytes 340 (340.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 340 (340.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhost ~]# wget
-bash: wget: 未找到命令
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# yum install wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable
To enable custom repositories:
yum-config-manager --enable
[root@localhost ~]# yum install wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable
To enable custom repositories:
yum-config-manager --enable
[root@localhost ~]# wget
-bash: wget: 未找到命令
[root@localhost ~]# wget
-bash: wget: 未找到命令
[root@localhost ~]# yum install wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable
To enable custom repositories:
yum-config-manager --enable
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
mv: 无法获取"/etc/yum.repos.d/CentOS-Base.repo" 的文件状态(stat): 没有那个文件或目录
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo.backup /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# yum install wget
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-15.el7_4.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
========================================================================================
Package 架构 版本 源 大小
========================================================================================
正在安装:
wget x86_64 1.14-15.el7_4.1 updates 547 k
事务概要
========================================================================================
安装 1 软件包
总下载量:547 k
安装大小:2.0 M
Is this ok [y/d/N]: y
Downloading packages:
wget-1.14-15.el7_4.1.x86_64.rpm | 547 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : wget-1.14-15.el7_4.1.x86_64 1/1
验证中 : wget-1.14-15.el7_4.1.x86_64 1/1
已安装:
wget.x86_64 0:1.14-15.el7_4.1
完毕!
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
--2018-04-16 07:10:33-- http://mirrors.163.com/.help/CentOS7-Base-163.repo
正在解析主机 mirrors.163.com (mirrors.163.com)... 59.111.0.251
正在连接 mirrors.163.com (mirrors.163.com)|59.111.0.251|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1572 (1.5K) [application/octet-stream]
正在保存至: “CentOS7-Base-163.repo”
100%[==============================================>] 1,572 --.-K/s 用时 0s
2018-04-16 07:10:33 (208 MB/s) - 已保存 “CentOS7-Base-163.repo” [1572/1572])
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror
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 | 156 kB 00:00:00
(2/12): base/7/x86_64/primary_db | 5.7 MB 00:00:00
(3/12): base/7/x86_64/filelists_db | 6.7 MB 00:00:00
(4/12): base/7/x86_64/other_db | 2.5 MB 00:00:00
(5/12): extras/7/x86_64/filelists_db | 709 kB 00:00:00
(6/12): extras/7/x86_64/primary_db | 185 kB 00:00:00
(7/12): extras/7/x86_64/other_db | 121 kB 00:00:00
(8/12): updates/7/x86_64/prestodelta | 960 kB 00:00:00
(9/12): updates/7/x86_64/primary_db | 6.9 MB 00:00:00
(10/12): updates/7/x86_64/filelists_db | 4.2 MB 00:00:00
(11/12): updates/7/x86_64/other_db | 734 kB 00:00:00
(12/12): extras/7/x86_64/prestodelta | 129 kB 00:00:01
Determining fastest mirrors
元数据缓存已建立
[root@localhost yum.repos.d]# yum install vim
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
软件包 2:vim-enhanced-7.4.160-2.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost yum.repos.d]# yum install vim
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
软件包 2:vim-enhanced-7.4.160-2.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost yum.repos.d]# ls
CentOS7-Base-163.repo CentOS-Debuginfo.repo CentOS-Sources.repo
CentOS-Base.repo.backup CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo
[root@localhost yum.repos.d]# vim /etc/sysconfig/network-scripts/ifcfg-enp0s3
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#