TechTalk

Centos6.5 Ambari样板机

字数统计: 419阅读时长: 2 min
2017/09/19

安装wget和openssh-server

1
2
yum -y install wget
yum -y install openssh-server

安装阿里云的源

1
2
3
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
yum makecache

禁用iptables

1
2
chkconfig iptables off
/etc/init.d/iptables stop

禁用SELinux

1
setenforce 0

永久禁用SELinux

1
2
3
4
5
6
7
8
9
10
11
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

添加FQDN

1
2
3
vim /etc/hosts
10.211.55.13 Hadoop-1
10.211.55.14 Hadoop-2

修改/etc/sysconfig/network下将HOSTNAME修改问本机的名称
通过hostname命令检查

配置无密码登陆

1
2
3
4
ssh-keygen -t rsa
ssh-copy-id localhost
ssh-copy-id Hadoop-1
ssh-copy-id Haddop-2

禁用THP

检查THP是否开启:

1
2
cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag

禁用THP:
1
2
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag

永久禁用THP

编辑改服务:vim /etc/rc.d/rc.local

1
2
3
4
5
6
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

添加可执行权限:chmod +x /etc/rc.d/rc.local

安装NTP

执行命令:yum -y install ntp
配置 vim /etc/ntp.conf
使用如下位置来同步时钟

1
2
3
1.cn.pool.ntp.org
2.cn.pool.ntp.org prefer
ch.pool.ntp.org

重启服务 service ntpd restart
查看同步情况ntpd -q
加入到开机启动 chkconfig ntpd on

在主节点上设置和安装Ambari

1
2
3
4
5
6
7
8
cd /etc/yum.repo.d/
wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.0.1/ambari.public-repo-1
yum make clean
yum list | grep ambari
yum install -y ambari-server
ambari-server setup
ambari-server start

通过web访问ambari的配置界面

http://10.211.55.13:8080/

CATALOG
  1. 1. 安装wget和openssh-server
  2. 2. 安装阿里云的源
  3. 3. 禁用iptables
  4. 4. 禁用SELinux
    1. 4.1. 永久禁用SELinux
  5. 5. 添加FQDN
  6. 6. 配置无密码登陆
  7. 7. 禁用THP
    1. 7.1. 永久禁用THP
  8. 8. 安装NTP
  9. 9. 在主节点上设置和安装Ambari
  10. 10. 通过web访问ambari的配置界面