Linux安装(网络配置+配置hosts+免密登陆+配置环境变量)

咏月东南 2019-11-03

网络配置

# 配置ip
vi   /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.92.130  #静态ip
GATEWAY=192.168.92.2   #网关
NETMASK=255.255.255.0  
DNS1=114.114.114.114
# 关闭防火墙
systemctl stop firewalld # 临时关闭防火墙
systemctl disable firewalld # 禁止开机启动
# 重启网络
service network restart > reboot
ping baidu.com

配置hosts

vim /etc/hosts
192.168.192.128 hadoop01
192.168.192.129 hadoop02
192.168.192.130 hadoop03
vim /etc/hostname
hadoop01~03
hostnamectl set-hostname  #另一种

免密登陆

ssh-keygen  #继续按回车(三台都执行)
ssh-copy-id -i hadoop01~03 #每台机器上执行(输入ip)
ssh ip #登陆指定ip
scp -r  /home/*  192.168.192.129:/home/

配置环境变量

# JDK
vi /etc/profile 
export JAVA_HOME=/usr/jdk
export PATH=$PATH:${JAVA_HOME}/bin
# Python
vi /etc/profile
export PYTHON_HOME=/usr/Python3
export PATH=$PATH:${PYTHON_HOME}/bin
source /etc/profile
echo $PATH

相关推荐