首页 / LINUX / 1.linux环境配置
1.linux环境配置
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了1.linux环境配置,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3417字,纯文字阅读大概需要5分钟。
内容图文
首先说一下,这里是虚拟机环境.
1.用vbox安装centos6.8-mini
注意不要使用复制的方式安装,复制的虚拟机网络不通
安装如下:
主机 | ip | 角色 | 内存 |
---|---|---|---|
hadoop1 | 192.168.0.10 | namenode,HMASTER | 2G |
hadoop2 | 192.168.0.11 | namenode,HiverServer2,HiveMetaStore | 1G |
hadoop3 | 192.168.0.12 | ZooKeeper,DateNode,HRegionServer,JournalNode | 2G |
hadoop4 | 192.168.0.13 | ZooKeeper,DateNode,HRegionServer,JournalNode | 2G |
hadoop5 | 192.168.0.14 | ZooKeeper,DateNode,HRegionServer,JournalNode | 2G |
2.修改/etc/hosts
所有机器上执行
echo "127.0.0.1 localhost localhost">/etc/hosts
echo "192.168.0.10 hadoop1">>/etc/hosts
echo "192.168.0.11 hadoop2">>/etc/hosts
echo "192.168.0.12 hadoop3">>/etc/hosts
echo "192.168.0.13 hadoop4">>/etc/hosts
echo "192.168.0.14 hadoop5">>/etc/hosts
3.配置SSH互信
最好把root hdfs yarn都配上ssh互信
1.生成公钥
所有节点执行
ssh-keygen -t rsa -P ‘‘
2.所有节点执行
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.10
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.11
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.12
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.13
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.14
这样所有节点之间都有了互信
3.创建用户和组
在所有节点创建hdfs yarn hive zookeeper hbase用户,后续添加其它用户
groupadd hadoop
useradd -g hadoop hdfs
passwd hdfs <<EOF
hdfs
hdfs
EOF
useradd -g hadoop yarn
passwd yarn <<EOF
yarn
yarn
EOF
groupadd zookeeper
useradd -g zookeeper zookeeper
passwd zookeeper <<EOF
zookeeper
zookeeper
EOF
groupadd hive8
useradd -g hive hive
passwd hive <<EOF
hive
hive
EOF
groupadd hbase
useradd -g hbase hbase
passwd hbase <<EOF
hbase
hbase
EOF
4.修改系统参数
echo "session required /lib64/security/pam_limits.so ">> /etc/pam.d/login
echo "@hdfs - nofile 4096 ">>/etc/security/limits.conf
echo "@hive - nofile 4096 ">>/etc/security/limits.conf
echo "@yarn - nofile 4096 ">>/etc/security/limits.conf
echo "@zookeeper - nofile 4096 ">>/etc/security/limits.conf
echo "@hbase - nofile 4096 ">>/etc/security/limits.conf
echo "@hdfs - nproc 1024 ">>/etc/security/limits.conf
echo "@hive - nproc 1024 ">>/etc/security/limits.conf
echo "@yarn - nproc 1024 ">>/etc/security/limits.conf
echo "@zookeeper - nproc 1024 ">>/etc/security/limits.conf
echo "@hbase - nproc 1024 ">>/etc/security/limits.conf
echo "@hdfs - memlock 32768" >>/etc/security/limits.conf
设置完后,应用程序需要重启生效.
5.关闭防火墙及SELINUX
#关闭防火墙
service iptables stop
chkconfig iptables off
setenforce 0 #关闭selinux
永久关闭SELINUX:
vi /etc/selinux/config
SELINUX=disabled
6.安装ntp
yum -y install ntp
在ntp服务器节点:
vi /etc/ntp.conf
#本子网内主机都可以同步
restrict 192.168.0.0 mask 255.255.0.0 nomodify
#优先时间服务器
server 192.168.0.10 prefer
#当ntp server不可用,把本地时间做为ntp时间给端用
fudge 127.127.1.0 stratum 8
#日志文件位置
logfile /var/log/ntp.log
启动ntpd服务
service ntpd start
这里将使用192.168.0.10作为时间服务器,建议使用网上的时间服务器比较准确.
客户端节点:
vi /etc/ntp.conf
#优先时间服务器
server 192.168.0.10 prefer
#日志文件位置
logfile /var/log/ntp.log
客户端先手动同步一次时间:
nptdate hadoop1
然后启动nptd服务:
service ntpd start
查看npt状态:
watch ntpq -p
7.禁用IPV6
IPV6会引起某些问题,有些程序默认搜索IPV6.
参考:https://linux.cn/article-5417-1.html
vi /etc/sysctl.conf
# 禁用整个系统所有接口的IPv6
net.ipv6.conf.all.disable_ipv6 = 1
# 禁用某一个指定接口的IPv6(例如:eth0, lo)
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
#使用修改生效:
$ sudo sysctl -p /etc/sysctl.conf
8.配置环境变量
下载java1.8,解压到/opt/下. vi /etc/profile
export JAVA_HOME=/opt/jdk1.8.0_131
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME
export PATH
测试java:
java -version
原文:http://www.cnblogs.com/skyrim/p/7455446.html
内容总结
以上是互联网集市为您收集整理的1.linux环境配置全部内容,希望文章能够帮你解决1.linux环境配置所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。