02_构建模版虚拟机(hadoop100)

1、模板虚拟机环境准备

0)如果是最小化安装,会什么都没有,yum也不能正常使用,需要先配置网络参数 ONBOOR=“yes”
之后yum可以正常使用,但是 或许会因为 yum源问题 下载东西还是失败!!
换 阿里 yum源–网络源方式

vi /etc/yum.repos.d/CentOS-Base.repo

替换下面文件

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

1)hadoop100虚拟机配置要求如下(本文Linux系统全部以CentOS-7.5-x86-1804为例)

ping www.baidu.com

yum install -y epel-release
yum install -y net-tools
yum install -y vim

注:Extra Packages for Enterprise Linux是为“红帽系”的操作系统提供额外的软件包,适用于RHEL、CentOS和Scientific Linux。相当于是一个软件仓库,大多数rpm包在官方 repository 中是找不到的)

2)关闭防火墙,关闭防火墙开机自启

systemctl stop firewalld
systemctl disable firewalld.service
  注意:在企业开发时,通常单个服务器的防火墙时关闭的。公司整体对外会设置非常安全的防火墙

3)创建ice用户,并修改ice用户的密码

useradd ice
passwd ice

4)配置ice用户具有root权限,方便后期加sudo执行root权限的命令

vim /etc/sudoers

修改/etc/sudoers文件,在%wheel这行下面添加一行,如下所示:

## Allow root to run any commands anywhere
root    ALL=(ALL)     ALL

## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL
ice   ALL=(ALL)     NOPASSWD:ALL

注意:ice这一行不要直接放到root行下面,因为所有用户都属于wheel组,你先配置了ice具有免密功能,但是程序执行到%wheel行时,该功能又被覆盖回需要密码。所以ice要放到%wheel这行下面。

5)在/opt目录下创建文件夹,并修改所属主和所属组
(1)在/opt目录下创建module、software文件夹

mkdir /opt/module
mkdir /opt/software

(2)修改module、software文件夹的所有者和所属组均为ice用户

chown ice:ice /opt/module
chown ice:ice /opt/software

6)卸载虚拟机自带的JDK

注意:如果你的虚拟机是最小化安装不需要执行这一步。

# 查看
rpm -qa | grep -i java
# 卸载
rpm -qa | grep -i java | xargs -n1 rpm -e --nodeps

:::success

  • rpm -qa:查询所安装的所有rpm软件包
  • grep -i:忽略大小写
  • xargs -n1:表示每次只传递一个参数
  • rpm -e –nodeps:强制卸载软件
    :::
    7)重启虚拟机
reboot
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值