linux自學(四)之開始centos學習,網絡配置

上一篇:linux自學(三)之開啟虛擬機

安裝好鏡像之后,重啟之后需要登錄,我這里直接是root賬號直接登錄的,注意:輸入密碼的時候不顯示。
界面
之后輸入ifconfig最常用的命令來查看網卡信息,出現command not found,如圖:
ipconfig命令沒有發現
原因分析:
在虛擬機中以最小化方式安裝centos7,之后無法上網,因為centos7默認網卡未激活。
激活網卡:
首先查詢我們現在的網卡名字

cd /etc/sysconfig/network-scripts

進入network-scripts目錄下,輸入ls 命令查看具體文件

ls

列出具體文件
上圖紅色框中的就是網卡名,可能你的跟我的不一樣。然后通過命令 vi 查看文件內容

vi ifcfg-ens33

內容如下圖:

文件內容
在鍵盤上按下 i 鍵進入編輯模式,然后把ONROOT=no改查yes即可。如上圖標記所示。最后輸入esc退出編輯模式,然后輸入 :wq保存退出。之后重啟服務:service network restart
重啟

記住:先輸入 i 進入編輯模式,之后按Esc退出編輯模式,最后 :wq退出保存

之后再試試ifconfig命令,發現還是command not found提示。如圖:
ipconfig命令沒有發現

這是怎么回事呢?網上搜了一下原因,可能是CentOS 7的最小化安裝少了一些工具,比如 ifconfig 及 netstat 等。因此解決辦法很簡單,把它們安裝上就好了。

通過如下命令進行在線安裝,之后會有一系列輸出,中間需要你輸入“y”進行確認,然后等待。。。

yum install net-tools

我這是root用戶,如果不是root用戶需要在命令前加上sudo。
之后再輸入命令 ifconfig就會有顯示了,如圖:
ifconfig
到這里網絡就已經通暢了。

下一篇:linux自學(五)之開始centos學習,Xshell遠程連接

轉載于:https://www.cnblogs.com/smfx1314/p/10205775.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/278546.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/278546.shtml
英文地址,請注明出處:http://en.pswp.cn/news/278546.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

k8s extender_Windows Home Server的Drive Extender的9種選擇

k8s extenderNow that Microsoft has officially killed off the best part about Windows Home Server what can you do? Here are some alternatives for drive extender that you can use if you want to build a WHS of your own. 既然Microsoft正式取消了Windows Home Se…

為什么element的el-backtop會不管用,來看這里

<template>Scroll down to see the bottom-right button.<el-backtop target".page-component__scroll .el-scrollbar__wrap"></el-backtop> </template>把target指向你要產生“回到頂部”按鈕的組件&#xff0c; 這個組件一定要是產生滾動條…

如何創建一份springboot的docker鏡像

2019獨角獸企業重金招聘Python工程師標準>>> FROM centos:7 ENV JAVA_HOME /usr/java/jdk1.7.0_55 ENV MAC_PUBLISH_PATH /home/app ENV LOG_PATH /var/log ENV PATH $JAVA_HOME/bin:$PATH ENV TIME_ZONE Asia/Shanghai COPY jdk-7u55-linux-x64.rpm /opt/ RUN mkd…

Xamarin.Android 開發中遇到旋轉屏幕錯誤

錯誤信息 : System.NotSupportedException: Unable to find the default constructor on type App5.MyFragment. Please provide the missing constructor. 錯誤圖片&#xff1a; 解決方法&#xff1a;干脆不讓他旋轉屏幕&#xff0c;當下QQ、微信等app都沒有旋轉等功能&#…

原生js打印指定節點元素

很簡單&#xff08;可粘貼至txt文檔后改后綴為html打開看效果&#xff09;&#xff1a; <!doctype html> <html lang"en"> <head><meta charset"utf-8"><title>打印</title><meta name"viewport" conte…

Android社會化分享詳解

前言現如今app市場競爭激烈&#xff0c;做app不會放過任何推廣自己的app的渠道&#xff0c;如果app中沒有社會化分享功能&#xff0c;那真的是OUT了&#xff0c;我們先來看下一些app中的分享界面功能吧。現在主流的分享平臺&#xff0c;一般用的都是微信、QQ、微博&#xff0c;…

windows7黑屏修復_如何在Windows 10更新后修復黑屏

windows7黑屏修復RealVector/Shutterstock.comRealVector / Shutterstock.comSome Windows 10 PCs have been rebooting to a black screen after installing the June 2019 cumulative update from Windows Update. This seems scary at first, but luckily there’s a quick …

[sol]250OJ 1~10

下載 轉載于:https://www.cnblogs.com/yztblog/p/10208314.html

vue/cli4 創建vue項目選項詳解

多版本創建項目一、vue-cli2.x二、vue-cli3.x三、vue-cli4.x1.查看 vue 版本&#xff1a; 項目中,找到package.json文件夾 找"dependencies"中的vue &#xff1b; 若無項目&#xff0c;在cmd中輸入 where vue&#xff0c;cd到vue目錄下輸入 npm list vue &#xff0c…

java 商品評價計算算法

import java.io.Serializable; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.math.BigDecimal; import java.math.RoundingMode;/*** 商品評價算法* * project icomment* fileName ProductScore.java* Description* author light-z…

rainmeter使用教程_如何使用Rainmeter在桌面上顯示報價

rainmeter使用教程I’ve never really been a desktop gadgets and widgets type of person, but I often put an inspirational quote on my desktop wallpaper. Today we’ll show you how to do this using Rainmeter, no matter what wallpaper you switch to. 我從來沒有真…

Some code changes cannot be hot swapped into a running virtual machine

java運行中修改代碼不能改變立刻應用到本次運行中轉載于:https://www.cnblogs.com/Pusteblume/p/10211110.html

自定義v-drag指令(橫向拖拽滾動)

指令 Vue.directive(drag, {// 鉤子函數&#xff0c;被綁定元素插入父節點時調用 (父節點存在即可調用&#xff0c;不必存在于 document 中)。inserted: (el, binding, vnode, oldVnode) > {console.log(el, binding, vnode, oldVnode)let drag el; // 要拖拽的元素// let …

javascript獲取時間差

function GetDateDiff(startTime, endTime, diffType) {//將xxxx-xx-xx的時間格式&#xff0c;轉換為 xxxx/xx/xx的格式 startTime startTime.replace(/\-/g, "/");endTime endTime.replace(/\-/g, "/");//將計算間隔類性字符轉換為小寫diffType diffTy…

JMeter擴展JMeter插件獲取更多監聽器

為了獲取更多監聽器&#xff0c;方便的監控系統及應用&#xff0c;有必要安裝第三方插件 插件下載地址&#xff1a; https://jmeter-plugins.org/downloads/old/ http://pan.baidu.com/s/1gfC11yN 注&#xff1a;如果插件和軟件版本不兼容&#xff0c;可能在開啟Jmeter時會報錯…

如何阻止Chrome(或Edge)接管媒體密鑰

Google Chrome now has built-in support for media keys. Unfortunately, Chrome will take over your media keys and prevent them from controlling apps like Spotify when you’re watching YouTube, for example. Here’s how to make Chrome ignore your media keys. G…

js滾動條滾動到指定元素

let item document.getElementById("item"); // 指定的元素 let wrapper document.getElementById("wrapper"); // 其父元素 - 必須是產生滾動條的元素// 元素聚焦法定位 // item.focus(); // 可用 outline:none; 除去聚焦產生的框; 對于默認沒有聚焦的…

開源性能測試工具JMeter快速入門(一)

目錄一、JMeter簡介二、JMeter功能介紹三、JMeter腳本四、關于JMeter小提示一、JMeter簡介1.定義JMeter是Apache組織開發的基于Java的壓力測試工具。用于對軟件做壓力測試&#xff0c;它最初被設計用于Web應用測試&#xff0c;但后來擴展到其他測試領域。 1&#xff09;它可以用…

八重州8900如何解鎖_八重貴族怪胎之路

八重州8900如何解鎖Dealing with computers day in and day out can be a harrowing experience. In difficult times, or even when things are idle, finding some spirituality can help cope with the experience—Techies: I give you the Eightfold Noble Geek Path. 日…

mysql 5.7.18 winx64安裝配置方法

在mysql-5.7.18-winx64文件夾下新建my.ini文件[mysql] # 設置mysql客戶端默認字符集 default-character-setutf8 [mysqld] #設置3306端口 port 3306 # 設置mysql的安裝目錄 basedirD:\Program Files\mysql-5.7.18-winx64 # 設置mysql數據庫的數據的存放目錄 datadirD:\Prog…