【Linux系列】【基礎版】第一章 認識Linux,以及安裝登錄CentOS

1. 認識Linux,以及安裝登錄CentOS 1.1 學習方法及工具介紹     1.1.1 定位         1.1.1.1 工作的地點選擇,優先選擇一線城市,機會多,學習的空間大;         1.1.1.2 目標選擇,第一份工作拿多少?兩年後呢?         1.1.1.3 合理安排時間         1.1.1.4 學習方法:                 1.1.1.4.1 預習 preview                 1.1.1.4.2 今日事,今日畢 things of today, done today                 1.1.1.4.3 記筆記 notes                 1.1.1.4.4 及時複習 revise in time                 1.1.1.4.5 合理利用身邊的資源 ultilize resource around                 1.1.1.4.6 問題排查 troubleshooting                 1.1.1.4.7 註釋 annotation         1.1.1.5 安裝包                 1.1.1.5.1 操作系統:CentOS 7.3                 1.1.1.5.2 虛擬機軟件:VMware workstation 10                 1.1.1.5.3 遠程登錄終端軟件:putty 和 Xshell         1.1.1.6 一些小工具                 1.1.1.6.1 印象筆記:app.yinxiang.com                 1.1.1.6.2 博客:blog.51cto.com                 1.1.1.6.3 密碼容器:keepass, keepass.info                 1.1.1.6.4 網盤:pan.baidu.com                 1.1.1.6.5 軟件版本修改地址:update in r.aminglinux.com  coding.net                 1.1.1.6.6 代碼和命令:centos7.aminglinux.com 1.2 Linux的發行版      1.2.1 Linux的歷史概要          1.2.1.1 Unix          1.2.1.2 Minix(Unix-like)          1.2.1.3 linux kernel develped by linux torvalds           1.2.1.4 GNU(GNU is not unix), gpl protocol      1.2.2 Linux的發行版本          1.2.2.1 Debian(1993) -> Ubuntu(2004)          1.2.2.2 Slackware(1993) -> SUSE(1994)          1.2.2.3 RedHat(1994) -> CentOS(2003)          1.2.2.4 RedHat -> RedFlag(1999)          1.2.2.5 RedHat -> Fedora -> RHCL(2002)              1.3 創建虛擬機     1.3.1 虛擬機的安裝以及配置         1.3.1 安裝虛擬機             1.3.1.1 typical -> linux CentOS 64 -> 20G single file -> Memory 1G, CPU 1 pcs -> NAT mode;         1.3.2 安裝CentOS7             1.3.1.2 Partition -> 標準分區 -> /boot 200M, swap 2048M, / otherM -> CD/DVD(IDE) ISO file roll in -> open VMware -> install resource of local, select mini0install -> install location -> I need setting partition -> root password settings;  1.4 配置ip     1.4.1 dhclient //自動獲取網卡的動態ip地址     1.4.2 ip addr/ ip add / ifconfig //獲取網卡名以及ip地址     1.4.3 Edit -> 虛擬網絡編輯器         1.4.3.1 lo 迴環地址         1.4.3.2 ens* 網卡地址         1.4.3.3 子網 <-> 網段         1.4.3.4 網關 <-> 路由     1.4.4 ls /etc/sysconfig/network-scripts/ifcfg-ens*     1.4.5 vi /etc/sysconfig/network-scripts/ifcfg-ens*     1.4.6 修改動態ip爲靜態         1.4.6.1 BootProto=static         1.4.6.2 OnBoot=yes         1.4.6.3 IP ADDR=192.168.180.130         1.4.6.4 NETMASK=255.255.255.0         1.4.6.5 GATEWAY=192.168.180.2         1.4.6.6 DNS1=119.29.29.29     1.4.7 CTRL+l  //clear the screen;     1.4.8 systemctl restart network.service //重啓網絡服務,用於CentOS7中,CentOS6中不需要寫restart;         1.4.9 ping  //ping網絡     1.4.10 dhclient -r //kill dhclient     1.4.11 route -n //read gateway     1.4.12 修改虛擬機的網址:         1.4.12.1 將NAT模式 -> 橋接模式 -> 刪除橋接,restore NAT模式;     1.4.13 yum install -y net-tools //安裝net-tools;     1.4.14 yum provides "/*/vim" //查詢安裝vim的命令; 1.5 用putty和XShell遠程連接並訪問主機     1.5.1 遠程連接         1.5.1.1 快照 (右鍵 -> 拍攝快照);         1.5.1.2 Session:             1.5.1.2.1 hostname: 192.168.133.130             1.5.1.2.2 port: 22         1.5.1.3 用戶身份驗證:             1.5.1.3.1 方法: password/public key/keyboard Interactive/GSSAPI             1.5.1.3.2 用戶名:root             1.5.1.3.3 密碼:*** 1.6 用putty和Xshell實現祕鑰登錄     1.6.1 用putty實現祕鑰登錄         1.6.1.1 putty Generator -> moving mouse -> 1) public key; 2) private key; 3) password;         1.6.1.2 mkdir /root/.ssh  //在/root/.ssh 建一個文件夾;         1.6.1.3 chmod 700 /root/.ssh //給當前文件添加-w-r-x的權限;         1.6.1.4 vi /root/.ssh/authorized-keys //新建並進入authorized-keys文件,一般複製時開頭有‘s’會被vi編譯器識別;         1.6.1.5 setenforce 0 //關閉selinux;         1.6.1.6 ssh -> Auth -> Browse private key -> save             1.6.1.6.1 key passphrase: gdlcoal             1.6.1.6.2 confirm passphrase: gdlocal             1.6.1.6.3 key comment: rsa-key-20170914      1.6.1 用putty實現祕鑰登錄             1.6.1.1 tools -> new user rsa tutorials(RSA, 2048 bit) -> name , password          1.6.1.2 文件路徑,文件名要寫對;          1.6.1.3 文件權限要設置對;          1.6.1.4 文件內容(公鑰內容)要寫對;          1.6.1.5 ESC+O //實現直接跳到最下面一行空格前輸入; 1.7 單用戶模式     1.7.1 首先退出系統並重啓虛擬機         1.7.1.1 exit 或 ctrl+d   //退出用戶         1.7.1.2 reboot/init 6/shutdown -r now  //重啓         1.7.1.3 shutdown/init 0  //關機     1.7.2 進入grub界面,按E鍵進入編輯模式         1.7.2.1 修改ro爲rw init=/sysroot/bin/sh_  ,然後Ctrl+X         1.7.2.2 cat /sysroot/root/.ssh/authorized_keys         1.7.2.3 chroot /sysroot  //切換至原來的OS中         1.7.2.4 cat /root/.ssh/authorized_keys     1.7.3 修改密碼         1.7.3.1 passwd root //修改密碼         1.7.3.2 Ctrl+c  //結束當前命令         1.7.3.3 LANG=en  //設置語言爲英語         1.7.3.4 passwd root //設置新密碼,並確認         1.7.3.5 touch /.autorelabel   //改完密碼後設置selinux          1.8 救援模式     1.8.1 一些級別表示         1.8.1.0 ls -l /usr/lib/systemctl/system/runlevel*target  //查看級別註釋         1.8.1.1 init 0 -> 關機          1.8.1.2 init 1 -> 單用戶         1.8.1.3 init 2/3/4 -> 多用戶模式,默認爲級別3         1.8.1.4 init 5 -> 圖形         1.8.1.5 init 6 -> 重啓     1.8.2 救援模式設置         1.8.2.1 編輯虛擬機設置 -> CD/DVD(IDE) -> 啓動時連接(enabled)ISO(selected)         1.8.2.2 電源 -> 啓動時進入BIOS -> Boot -> +/- 號移動 -> F10 save and quit -> Troubleshooting -> rescue a CentOS linus system -> 1)continue -> chroot /mnt/sysimage         1.8.2.3 ls /mnt/sysimage/root/.ssh/authorized_keys         1.8.2.4 cat /mnt/sysimage/root/.ssh/authorized_keys         1.8.2.5 passwd root         1.8.2.6 改回BIOS啓動時順序         1.8.2.7 重啓 1.9 虛擬機克隆     1.9.1 管理  -> 克隆  -> 創建鏈接克隆     1.9.2 修改ip, 刪除uuid     1.9.3 systemctl restart network.service     1.9.4 hostnamectl set-hostname amings //修改主機名爲amings     1.9.5 exit 或 ctrl+d     1.9.6 cat /etc/hostname  //查看主機名 1.10 Linux機器相互登錄     1.10.1 ssh username@ip address         1.10.1.1 ssh [email protected]          1.10.1.2 ssh -p 22 [email protected]  //指定22號端口         1.10.1.3 whoami  //查看用戶名         1.10.1.4 ssh 192.168.133.132  -> 輸入password     1.10.2 w命令         1.10.2.1 查看系統負載,也可以查看終端連接情況     1.10.3 logout 退出     1.10.4 ssh-keygen //生成密鑰對     1.10.5 ls /root/.ssh  //查看是否有authorized_keys     1.10.6 getenforce //selinux opened     1.10.7 setenforce 0 //selinux closed
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章