文章目录
1. 机器规划2. 修改hostname3. 关闭防火墙4. 安装 ELRepo、 EPEL 仓库5. 更新并安装常用依赖6. 修改虚拟内存交换页大小7. 设置固定IP8. 设置免密登录9. 设置hosts10. kernel优化11. 关闭 selinux12.同步时间13. 安装Python 2.7 、jdk1.8
1. 机器规划
系统为Centos7.6,本教程机器规划如下(酌情修改):
hostnameIPCDH角色
c7-1.com10.0.0.101Cloudera Managec7-2.com10.0.0.102Cloudera Agentc7-3.com10.0.0.103Cloudera Agent
2. 修改hostname
hostnamectl set-hostname c7-1.com
echo "HOSTNAME=c7-1.com" > /etc/sysconfig/network
hostnamectl set-hostname c7-2.com
echo "HOSTNAME=c7-2.com" > /etc/sysconfig/network
hostnamectl set-hostname c7-3.com
echo "HOSTNAME=c7-3.com" > /etc/sysconfig/network
3. 关闭防火墙
systemctl disable firewalld
systemctl stop firewalld
4. 安装 ELRepo、 EPEL 仓库
yum
install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
yum
install https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm -y
5. 更新并安装常用依赖
yum update -y
yum
install vim
wget net-tools
git unzip
zip gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y
6. 修改虚拟内存交换页大小
sysctl -w vm.swappiness
=0
echo "vm.swappiness=0" > /etc/sysctl.conf
7. 设置固定IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO
=static
DEVICE
=eth0
ONBOOT
=yes
IPADDR
=10.0.0.101
GATEWAY
=10.0.0.1
NETMASK
=255.0.0.0
systemctl restart network
vim /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO
=static
DEVICE
=eth0
ONBOOT
=yes
IPADDR
=10.0.0.102
GATEWAY
=10.0.0.1
NETMASK
=255.0.0.0
systemctl restart network
vim /etc/resolv.conf
nameserver 114.114.114.114
vim /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO
=static
DEVICE
=eth0
ONBOOT
=yes
IPADDR
=10.0.0.103
GATEWAY
=10.0.0.1
DNS1
=223.5.5.5
NETMASK
=255.0.0.0
systemctl restart network
8. 设置免密登录
ssh-keygen -t rsa -f ~/.ssh/id_rsa
ssh-copy-id c7-2.com
ssh-copy-id c7-3.com
9. 设置hosts
vim /etc/hosts
10.0.0.101 c7-1.com
10.0.0.102 c7-2.com
10.0.0.103 c7-3.com
scp /etc/hosts c7-2.com:/etc/hosts
scp /etc/hosts c7-3.com:/etc/hosts
10. kernel优化
echo never
> /sys/kernel/mm/transparent_hugepage/defrag
echo never
> /sys/kernel/mm/transparent_hugepage/enabled
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local
chmod u+x /etc/rc.local
11. 关闭 selinux
sed -i
's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
setenforce 0
12.同步时间
yum
install ntp -y
ntpdate ntp1.aliyun.com
sed -i
's/server 0.centos.pool.ntp.org iburst/server ntp1.aliyun.com/g' /etc/ntp.conf
sed -i
's/server 1.centos.pool.ntp.org iburst/server ntp2.aliyun.com/g' /etc/ntp.conf
sed -i
's/server 2.centos.pool.ntp.org iburst/server ntp3.aliyun.com/g' /etc/ntp.conf
sed -i
's/server 3.centos.pool.ntp.org iburst/server ntp4.aliyun.com/g' /etc/ntp.conf
systemctl
enable ntpd
systemctl start ntpd
13. 安装Python 2.7 、jdk1.8
yum
install python27 java-1.8.0-openjdk-devel -y