less than 1 minute read

This article will cover some common setups before you can work or learn on Linux Platform.

Abstract

  • setup IP address
  • setup hostname
  • turn off firewall
  • host mapping
  • JAVA_HOME setup
  • setup ssh passwordless

Setup IP address

  • run vi /etc/sysconfig/network-scripts/ifcfg-ens33

    • template
    • TYPE="Ethernet"
      PROXY_METHOD="none"
      BROWSER_ONLY="no"
      BOOTPROTO="static"
      DEFROUTE="yes"
      IPV4_FAILURE_FATAL="no"
      IPV6INIT="yes"
      IPV6_AUTOCONF="yes"
      IPV6_DEFROUTE="yes"
      IPV6_FAILURE_FATAL="no"
      IPV6_ADDR_GEN_MODE="stable-privacy"
      NAME="ens33"
      DEVICE="ens33"
      ONBOOT="yes"
      IPV6_PRIVACY="no"
      GATEWAY=192.168.157.2
      IPADDR=192.168.157.11
      NETMASK=255.255.255.0
      DNS1=192.168.157.2
      DNS2=1.2.4.8
      
      
      
    • systemctl restart network
    • ip a to check if ip is changed correctly
    • how to know ip address of GATEWAY?
      • VM edit tab -> Virtual Network Editor -> NAT -> Subnet IP

Setup Hostname

  • vi /etc/sysconfig/network
  • file template
    • NETWORKING=yes
      HOSTNAME=node01
      

Hostname mapping

  • vi /etc/hosts
  • add two new lines
    • 192.168.157.11 node01
      192.168.157.12 node02
      

Turn off firewall

  • systemctl stop firewalld
  • systemctl disable firewalld
  • vi /etc/selinux/config
    • change SELINUX=disabled

Setup SSH Passwordless

  • ssh localhost
    • verify if you need to setup password, if you need to input the password after running this command, then the passwordless is not setup correctly
  • ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
  • cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
  • ssh localhost to verify if you don’t need password this time

JAVA_HOME setup

  • get jdk from Oracle website
  • upload jdk to linux VM
  • tar -zxvf jdk -C /opt
  • update /etc/profile
  • some software only find /usr/java/default