最小化CentOS7安裝後要作的事情

1、添加用戶並授予root權限

  • 新增用戶 useradd myusername
  • 修改密碼 passwd myusername
  • 刪除用戶 userdel myusername
  • 授予root權限 修改/etc/sudoers,在root ALL=(ALL) ALL下面一行添 加myusername ALL=(ALL) ALL,將用戶添加進root用戶 組 usermod -g root myusername,這樣就能夠使用sudo -i 進入root權限

2、安裝vim

yum -y install vim*git

3、配置鏈接外網

  • 修改網絡配置
    • 修改配置文件/etc/sysconfig/network-scripts/ifcfg-enp0s3, 將文件中的ONBOOT=no修改成ONBOOT=yes
    • 從新啓動網絡服務 systemctl restart network

4、使用ifconfig查看IP命令

  • 安裝ifconfig命令 yum -y install net-tools

5、配置ssh,使遠程鏈接只能使用私鑰登錄服務器

  • 對外開放端口22 firewall-cmd --add-port=22/tcp --permanent,從新加載防火 牆配置 firewall-cmd --reload
  • 使用xshell鏈接(密碼方式) 輸入主機、端口號、用戶名、密碼,正常登錄
  • 使用密鑰登錄
    • 打開git-bash.exe,本地機器生成密鑰對 ssh-keygen -t rsa
    • 上傳公鑰,打開git-bash.exe scp id_rsa.pub xxxx@192.168.56.101:~ cat id_rsa.pub > .ssh/authorized_keys chmod 700 .ssh chmod 600 .ssh/authorized_keys
      • 查看~目錄下是否有.ssh/authorized_keys,如沒有,則新建
      • 配置/etc/ssh/sshd_config文件。 開啓 PubkeyAuthentication yes
      • 重啓ssh服務 systemctl restart sshd.service
      • 配置xshell使用密鑰鏈接服務器
      • 查看ssh日誌,/var/log/secure,鏈接正常
      • 關閉ssh密碼登陸配置,設置PasswordAuthentication no, 並重啓ssh服務 打開git-bash.exe ssh xxx@192.168.56.101無需輸入密碼,直接登陸成功

6、安裝上傳下載文件工具lrzsz

  • yum -y install lrzsz

7、安裝wget

  • yum -y install wget
相關文章
相關標籤/搜索