這篇文章主要介紹了大數(shù)據(jù)平臺如何使用搭建腳本一鍵安裝OS,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

搭建腳本篇
腳本命名隨便,只要能看懂就行
鏡像包說明
os1.1.iso 用于安裝服務(wù)端和客戶端操作系統(tǒng)
hdp.iso 用于安裝hdp服務(wù)
1.架構(gòu)圖:
服務(wù)端

客戶端

2.原理分析
安裝系統(tǒng)-安裝本地yum源-安裝http源-安裝并配置ntp服務(wù)-配置秘鑰-安裝jdk-安裝mysql-編譯安裝ambari平臺
3.服務(wù)端腳本分析
(1)create_local_yum.sh #安裝本地yum 源
#!/bin/bash
iso_path=/dev/sr0
echo "Iso file path is :" /dev/sr0
yum_path=/mnt/vrv/
echo 'Creating mount directory :' /mnt/vrv/
mkdir -p /mnt/vrv/
mount /dev/sr0 /mnt/vrv
echo 'Updating /etc/yum.repos.d/ files...'
rm -rf /etc/yum.repos.d/*
touch /etc/yum.repos.d/vrv.repo
echo "
[vrv-local]
name=vrv-local
baseurl=file:///mnt/vrv/
gpgcheck=0
enabled=1
" >> /etc/yum.repos.d/vrv.repo
yum clean all && echo 'yum repository has been updated!'
host_ip=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
echo "$host_ip os-manager" >>/usr/bin/os/hosts
#echo "$host_ip os-manager" >>/etc/hosts(2)update_master.sh #安裝http源,配置主節(jié)點(diǎn),配置ntp
#!/bin/bash
#往本機(jī)/etc/hosts添加hosts文件內(nèi)容#############
#cat hosts >> /etc/hosts;
#echo "添加hosts到/etc/hosts文件完成";
host_ip=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
suffix_ip=${host_ip%.*}
suffix_ip=${suffix_ip%.*}
cd /mnt/vrv/Packages/
#rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
yum -y install mkisofs vim httpd createrepo perl python bind-utils openssh-clients ntp vim wget unzip bind && chkconfig httpd on && mkdir -p /var/www/html/centos && mkdir -p /var/www/html/centos/Packages/Packages && mkdir -p /var/www/html/ambari/ && mkdir -p /var/www/html/vmp-extend/ && echo "拷貝文件中..." && cp -rf /mnt/vrv/Packages/* /var/www/html/centos/Packages/Packages/ && echo "拷貝文件完成,生成源中..." && createrepo /var/www/html/centos/Packages/Packages/ && rm -rf /etc/yum.repos.d/* && echo "http源拷貝完成,更新yum..."
cp -rf /mnt/vrv/system/* /var/www/html/
touch /etc/yum.repos.d/vrv-http.repo
echo "
[vrv-http]
name=vrv-http
baseurl=http://$host_ip/centos/Packages/Packages
gpgcheck=0
enabled=1
" >> /etc/yum.repos.d/vrv-http.repo
service httpd restart && chkconfig httpd on && yum clean all
echo "http 源已經(jīng)配置完成"
echo "開始配置dns..."
echo "開始配置ntp..."
chkconfig ntpd on
#cp ntp.conf /etc/ntp.conf
# 寫入ntp.conf文件
echo "
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict $suffix_ip.0.0 mask 255.255.0.0 nomodify notrap
restrict 0.vrv.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.vrv.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.vrv.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
#server 210.72.145.44
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
" > /etc/ntp.conf
service ntpd restart && echo "ntp 配置完成!"
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc --localtime
## 配置 hdp yum####################
echo "開始配置ambari..."
mkdir -p /var/www/html/ambari/
mkdir -p /var/www/html/vmp-extend/
cp -rf /mnt/vrv/vrv/AMBARI-2.2.1.0/centos6/2.2.1.0-161/* /var/www/html/ambari/
cp -rf /mnt/vrv/vrv/vmp-extend-1.0/* /var/www/html/vmp-extend/
createrepo /var/www/html/vmp-extend/
createrepo /var/www/html/ambari/
# 寫入文件
touch /etc/yum.repos.d/ambari.repo
touch /etc/yum.repos.d/vmp-extend.repo
echo "
[ambari-2.x]
name=Ambari 2.x
baseurl=http://$host_ip/ambari/
gpgcheck=0
enabled=1
priority=1
" >> /etc/yum.repos.d/ambari.repo
echo "
#cd /mnt/vrv/vrv/vmp-extend-1.0
#chmod 777 vmp-extend-1.0.sh
#sh vmp-extend-1.0.sh
[vmp-extend-1.0]
name=vmp-extend-1.0
baseurl=http://$host_ip/vmp-extend/
gpgcheck=0
enabled=1
priority=1
" >> /etc/yum.repos.d/vmp-extend.repo
yum clean all && echo "ambari 配置完成"
# 配置selinux#############
echo "開始配置selinux..."
sed -i 's/enforcing/disabled/' /etc/selinux/config && echo "selinux 配置完成"
# 配置 iptalbes###########
echo "開始配置iptables..."
service iptables stop && chkconfig iptables off && service ip6tables stop && chkconfig ip6tables off && echo "iptables配置完成"
# 關(guān)閉 THP################
echo "關(guān)閉THP..."
echo "if test -f /sys/kernel/mm/redhat_transparent_hugepage/defrag;then echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag fi" >> /etc/rc.local && echo "閉THP完成"
echo "更新主節(jié)點(diǎn)完成"(3)generate_ssh.sh #配置ssh秘鑰,安裝jdk和mysql
#!/bin/bash
if [ $# -lt 2 ]; then
echo " HELP
generate_ssh.sh --generate ssh key for login without typing password;
this script should run on the namenode machine and user should edit the ip-list file
USAGE: ./generate_ssh.sh user pasaword
EXAMPLE: ./generate_ssh root admin
HELP
"
exit 0
fi
yum -y install expect && echo "expect 安裝完成"
user=$1
ip=$HOSTNAME
pass=$2
rm -rf /root/.ssh/*
echo "##################################"
echo " generate the rsa public key on $HOSTNAME ..."
echo "##################################"
expect -c "
set timeout -1
spawn ssh-keygen -t rsa
expect \"*id_rsa*\"
send \"\r\"
expect \"*passphrase*\"
send \"\r\"
expect \"*again*\"
send \"\r\"
expect eof
"
cat /usr/bin/os/hosts | while read line
do
#提取ip
ip_i=${line% *}
full_hostname_i=${ip_i##* }
ip_i=${ip_i% *}
hostname_i=${line##* }
expect -c "
set timeout -1
spawn ssh-copy-id -i /root/.ssh/id_rsa.pub $hostname_i
expect \"yes/no\"
send \"yes\r\"
expect \"password:\"
send \"$pass\r\"
expect \"#\"
expect eof
"
done
echo "ssh配置完成"
#安裝jdk
echo " jdk 安裝中"
rpm -e java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
rpm -e jdk-1.7.0_80-fcs.x86_64
rpm -e java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
cd /mnt/vrv/Packages/
rpm -ivh jdk-7u80-linux-x64.rpm
echo " jdk 安裝完成"
#安裝mysql
echo "安裝mysql中"
cd /mnt/vrv/Packages/
rpm -e mysql-5.1.73-7.el6.x86_64.rpm --nodeps
rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64.rpm
yum remove -y mysql-libs
rm -fr /usr/lib/mysql
rm -fr /usr/include/mysql
rm -f /etc/my.cnf
rm -fr /var/lib/mysql
rpm -ivh MySQL-server-5.5.50-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-client-5.5.50-1.linux2.6.x86_64.rpm
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
service mysql restart
service httpd restart
echo "安裝mysql完成"
echo "初始化mysql"
mysqladmin -uroot password 123456.
echo "初始化mysql完成"
touch /etc/my.cnf
echo "
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
lower_case_table_names=1
" >> /etc/my.cnf
service mysql restart(4)mysql_start.sh #主要用來配置mysql配置
echo "安裝ambari中" rpm -e vmp-i18n-2.1.1.0 yum -y install ambari-server echo "安裝ambari完成" mysql -uroot -pvrv123456. -e " grant all on *.* to root@'%' identified by 'vrv123456.'; flush privileges; CREATE USER 'ambari'@'%' IDENTIFIED BY 'ambari'; grant all privileges on *.* to 'ambari'@'%' identified by 'ambari' with grant option; CREATE USER 'ambari'@'localhost' IDENTIFIED BY 'ambari'; grant all privileges on *.* to 'ambari'@'localhost' identified by 'ambari' with grant option; CREATE USER 'ambari'@'os-manager' IDENTIFIED BY 'ambari'; grant all privileges on *.* to 'ambari'@'os-manager' identified by 'ambari' with grant option; flush privileges; CREATE USER 'hive'@'%' IDENTIFIED BY 'hive'; grant all privileges on *.* to 'hive'@'%' identified by 'hive' with grant option; CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive'; grant all privileges on *.* to 'hive'@'localhost' identified by 'hive' with grant option; CREATE USER 'hive'@'os-manager' IDENTIFIED BY 'hive'; grant all privileges on *.* to 'hive'@'os-manager' identified by 'hive' with grant option; flush privileges; CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie'; GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%'; FLUSH PRIVILEGES; create database ambari default charset='UTF8'; create database hive default charset='UTF8'; create database oozie default charset='UTF8'; quit" mysql -uroot -p123456. -e " use ambari; SOURCE /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql; quit"
(5)jiaohu.sh #自動配置ambari(需要提前設(shè)置好)
#!/bin/bash #修改參數(shù) echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled sysctl vm.swappiness=10 #安裝mysql驅(qū)動 echo "安裝mysql驅(qū)動中" #yum install mysql-connector-java -y mkdir -p /usr/share/java/ cp -rf /mnt/vrv/vrv/vmp-extend-1.0/misc/mysql-connector-java-5.1.36.jar /usr/share/java/ mv /usr/share/java/mysql-connector-java-5.1.36.jar /usr/share/java/mysql-connector-java.jar #cp -rf /mnt/vrv/vmp-extend-1.0/misc/mysql-connector-java-5.1.36.jar /usr/share/java/ cp -rf /usr/share/java/mysql-connector-java.jar /usr/lib/ambari-server/ echo "安裝mysql驅(qū)動完成" ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar expect -c " spawn ambari-server setup expect \"*continue*\" send \"y\r\" expect \"*Customize*\" send \"y\r\" expect \"*Enter*\" send \"root\r\" expect \"*JDK*\" send \"y\r\" expect \"*choice*\" send \"3\r\" expect \"*JAVA*\" send \"\/usr\/java\/default\r\" expect \"*configuration*\" send \"y\r\" expect \"*choice*\" send \"3\r\" expect \"*Hostname*\" send \"os-manager\r\" expect \"*Port*\" send \"3306\r\" expect \"*Database*\" send \"ambari\r\" expect \"*Username*\" send \"ambari\r\" expect \"*Database*\" send \"ambari\r\" expect \"*Re-enter*\" send \"ambari\r\" expect \"*properties*\" send \"y\r\" expect eof " cd /mnt/vrv/vrv/vmp-extend-1.0/ sh vmp-extend-1.0.sh echo "api.csrfPrevention.enabled=false" >>/etc/ambari-server/conf/ambari.properties ambari-server start yum install dos2* -y dos2unix /usr/bin/os/*.sh echo "安裝server端完成"
到這一步服務(wù)端已經(jīng)安裝完成。
4.客戶端腳本分析
(1)create_local_yum.sh #安裝本地yum 源
#!/bin/bash
iso_path=/dev/sr0
echo "Iso file path is :" /dev/sr0
yum_path=/mnt/vrv/
echo 'Creating mount directory :' /mnt/vrv/
mkdir -p /mnt/vrv/
mount /dev/sr0 /mnt/vrv
echo 'Updating /etc/yum.repos.d/ files...'
rm -rf /etc/yum.repos.d/*
touch /etc/yum.repos.d/vrv.repo
echo "
[vrv-local]
name=vrv-local
baseurl=file:///mnt/vrv/
gpgcheck=0
enabled=1
" >> /etc/yum.repos.d/vrv.repo
yum clean all && echo 'yum repository has been updated!'
host_ip=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
echo "$host_ip os-manager" >>/usr/bin/os/hosts
#echo "$host_ip os-manager" >>/etc/hosts(2)ntp.sh #安裝ntp服務(wù),選擇安裝mysql
#!/bin/bash
#往本機(jī)/etc/hosts添加hosts文件內(nèi)容#############
echo "添加hosts到/etc/hosts文件完成";
host_ip=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
suffix_ip=${host_ip%.*}
suffix_ip=${suffix_ip%.*}
yum -y install mkisofs vim httpd python createrepo perl bind-utils openssh-clients ntp vim wget unzip bind
yum clean all
echo "開始配置ntp..."
chkconfig ntpd on
echo "
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict $suffix_ip.0.0 mask 255.255.0.0 nomodify notrap
restrict 0.vrv.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.vrv.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.vrv.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
#server 210.72.145.44
#server 192.168.2.11 # local clock
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
" > /etc/ntp.conf
service ntpd restart && echo "ntp 配置完成!"
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc --localtime
# 配置selinux#############
echo "開始配置selinux..."
sed -i 's/enforcing/disabled/' /etc/selinux/config && echo "selinux 配置完成"
# 配置 iptalbes###########
echo "開始配置iptables..."
service iptables stop && chkconfig iptables off && service ip6tables stop && chkconfig ip6tables off && echo "iptables配置完成"
# 關(guān)閉 THP################
echo "關(guān)閉THP..."
echo "if test -f /sys/kernel/mm/redhat_transparent_hugepage/defrag;then echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag fi" >> /etc/rc.local && echo "閉THP完成"
echo "更新節(jié)點(diǎn)完成"
#安裝jdk
echo " jdk 安裝中"
rpm -e java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
rpm -e jdk-1.7.0_80-fcs.x86_64
rpm -e java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
cd /mnt/vrv/Packages/
rpm -ivh jdk-7u80-linux-x64.rpm
echo " jdk 安裝完成"
read -p "install mysql,Please insert y or n ": name
if [ $name = "n" ]
then
echo "不需要安裝mysql"
elif [ $name = "y" ]
then
#安裝mysql
echo "安裝mysql中"
cd /mnt/vrv/Packages/
rpm -e mysql-5.1.73-7.el6.x86_64.rpm --nodeps
rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64.rpm
yum remove -y mysql-libs
rm -fr /usr/lib/mysql
rm -fr /usr/include/mysql
rm -f /etc/my.cnf
rm -fr /var/lib/mysql
rpm -ivh MySQL-server-5.5.50-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-client-5.5.50-1.linux2.6.x86_64.rpm
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
service mysql start
echo "安裝mysql完成"
echo "初始化mysql"
mysqladmin -uroot password vrv123456.
echo "初始化mysql完成"
echo "增加客戶端完成"
touch /etc/my.cnf
echo "
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
lower_case_table_names=1
" >> /etc/my.cnf
service mysql restart
fi5.一鍵命令腳本分析:
#!/bin/sh
echo "os 1.1 install script"
echo "1.安裝os server 2.加固系統(tǒng) 3.修改主機(jī)ip地址 4.修改主機(jī)名 5.修改網(wǎng)絡(luò) 6.修改ambari主機(jī)地址 7.修改root密碼 8.重啟網(wǎng)絡(luò)服務(wù) 9.退出"
echo "++++++++自動修改ip和主機(jī)名等相關(guān)信息+++++++++"
echo "ETHCONF=/etc/sysconfig/network-scripts/ifcfg-eth0"
echo "HOSTS=/etc/hosts"
echo "NETWORK=/etc/sysconfig/network"
echo "DIR=/data/backup/`date +%Y%m%d`"
echo "NETMASK=255.255.255.0"
echo "安裝好mysql默認(rèn)密碼為vrv123456."
echo "+++++++++-------------------------+++++++++++"
#Define Path 定義變量,可以根據(jù)實(shí)際情況修改
ETHCONF=/etc/sysconfig/network-scripts/ifcfg-eth0
HOSTS=/etc/hosts
NETWORK=/etc/sysconfig/network
DIR=/data/backup/`date +%Y%m%d`
NETMASK=255.255.255.0
echo "================================================"
echo
#定義change_ip函數(shù)
function Change_ip ()
{
#判斷備份目錄是否存在,中括號前后都有空格,!嘆號在shell表示相反的意思#
if
[ ! -d $DIR ];then
mkdir -p $DIR
fi
echo "Now Change ip address ,Doing Backup Interface eth0"
cp $ETHCONF $DIR
grep "dhcp" $ETHCONF
#如下0用來判斷上一次操作的狀態(tài),為0,表示上一次操作狀態(tài)正確或者成功#
if
[ $? -eq 0 ];then
#read -p 交互輸入變量IPADDR,注冒號后有空格,sed -i 修改配置文件#
read -p "Please insert ip Address:" IPADDR
read -p "Please insert gatway Address:" gateway
sed -i 's/dhcp/static/g' $ETHCONF
#awk -F. 意思是以.號為分隔域,打印前三列#
echo -e "IPADDR=$IPADDR\nNETMASK=$NETMASK\nGATEWAY=`echo $gateway|awk -F. '{print $1"."$2"."$3"."$4}'`" >>$ETHCONF
echo "This IP address Change success !"
else
echo -n "This $ETHCONF is static exist ,please ensure Change Yes or NO":
read i
fi
if
[ "$i" == "y" -o "$i" == "yes" ];then
read -p "Please insert ip Address:" IPADDR
read -p "Please insert gateway Address:" gateway
count=(`echo |awk -F. '{print $1,$2,$3,$4}'`)
#定義數(shù)組, 0代表獲取變量值總個(gè)數(shù)#
A=${#count[@]}
#while條件語句判斷,個(gè)數(shù)是否正確,不正確循環(huán)提示輸入,也可以用[0-9]來判斷ip#
while
[ "$A" -ne "4" ]
do
read -p "Please re Inster ip Address,example 192.168.0.11 ip": IPADDR
count=(`echo $IPADDR|awk -F. '{print $1,$2,$3,$4}'`)
A=${#count[@]}
done
#sed -e 可以連續(xù)修改多個(gè)參數(shù)#
sed -i -e 's/^IPADDR/#IPADDR/g' -e 's/^NETMASK/#NETMASK/g' -e 's/^GATEWAY/#GATEWAY/g' $ETHCONF
#echo -e \n為連續(xù)追加內(nèi)容,并自動換行#
echo -e "IPADDR=$IPADDR\nNETMASK=$NETMASK\nGATEWAY=`echo $gateway|awk -F. '{print $1"."$2"."$3"."$4}'`" >>$ETHCONF
echo "This IP address Change success !"
else
echo "This $ETHCONF static exist,please exit"
exit $?
fi
}
#定義hosts函數(shù)
############function hosts##############
function Change_hosts ()
{
if
[ ! -d $DIR ];then
mkdir -p $DIR
fi
cp $HOSTS $DIR
read -p "Please insert ip address": IPADDR
read -p "Please insert ip hostname": hostname
host=`echo $IPADDR|sed 's/\././g'`
cat $HOSTS |grep 127.0.0.1 |grep "$host"
if
[ $? -ne 0 ];then
# sed -i "s/127.0.0.1/127.0.0.1 $host/g" $HOSTS
echo "$host $hostname" >> /etc/hosts
echo "This hosts change success "
else
echo "This $host IS Exist .........."
fi
}
###########fuction network###############
#定義network函數(shù)
function Change_network ()
{
if
[ ! -d $DIR ];then
mkdir -p $DIR
fi
cp $NETWORK $DIR
read -p "Please insert host name": IPADDR
host=`echo $IPADDR|sed 's/\././g'`
grep "$host" $NETWORK
if
[ $? -ne 0 ];then
sed -i "s/^HOSTNAME/#HOSTNAME/g" $NETWORK
echo "HOSTNAME=$IPADDR" >>$NETWORK
else
echo "This $host IS Exist .........."
fi
}
function Change_rootpassword ()
{
read -p "Please insert you root password": password
echo $password | passwd --stdin root
}
function restart_server ()
{
echo "restart network server ...."
service network restart
ifup eth0
}
function exit_quit ()
{
echo "quit......"
break
}
function install_os_server ()
{
cd /usr/bin/os/
sh create_local_yum.sh && sh update_master.sh && ./generate_ssh.sh root root && sh mysql_start.sh && sh jiaohu.sh >> /usr/bin/os/install.os_server.log
}
function jiagu ()
{
cd /usr/bin/os/
sh jiagu.sh >>/usr/bin/os/install.jiagu.log
}
function Change_ambari_host ()
{
echo "正在備份ambari.properties"
cp -rf /etc/ambari-server/conf/ambari.properties /etc/ambari-server/conf/ambari.properties.bak
read -p "Please insert ip oldhostname(默認(rèn)為os-manager)": oldhostname
read -p "Please insert ip newhostname": newhostname
sed -i 's/'$oldhostname'/'$newhostname'/' /etc/ambari-server/conf/ambari.properties
echo "已修改主機(jī)名,正在重啟服務(wù)"
service ambari-server restart
echo "重啟ambari完成,訪問:http://$newhostname:8080"
}
function add_key ()
{
cd /usr/bin/os/
sh miyao.sh
}
#PS3一般為菜單提示信息#
PS3="Please Select Menu":
#select為菜單選擇命令,格式為select $var in ..command.. do .... done
select i in "install_os_server" "jiagu" "Change_ip" "Change_hosts" "Change_network" "Change_ambari_host" "Change_rootpassword" "restart_server" "add_key" "exit_quit"
do
#case 方式,一般用于多種條件下的判斷
case $i in
install_os_server )
install_os_server
;;
jiagu )
jiagu
;;
Change_ip )
Change_ip
;;
Change_hosts )
Change_hosts
;;
Change_network )
Change_network
;;
Change_ambari_host )
Change_ambari_host
;;
Change_rootpassword )
Change_rootpassword
;;
restart_server )
restart_server
;;
add_key )
add_key
;;
exit_quit )
exit_quit
;;
*)
echo
echo "Please Insert $0: install_os_server(1)|jiagu(2)|Change_ip(3)|Change_hosts(4)|Change_network(5)|Change_ambari_host(6)|Change_rootpassword(7)|restart_network_server(8)|add_key(9)|quit(10)|"
echo "溫馨提示:請按8重啟網(wǎng)絡(luò)服務(wù)"
break
;;
esac
done6.安裝操作系統(tǒng):
首先在服務(wù)器啟動時(shí),按DEL進(jìn)入boot選項(xiàng)選光驅(qū)啟動。
掛載鏡像os1.1.iso開始進(jìn)行安裝

選擇menu vasp server install new system,進(jìn)行服務(wù)端安裝。
7.操作系統(tǒng)硬盤選擇
選擇一塊硬盤進(jìn)行系統(tǒng)安裝



安裝完成

默認(rèn)用戶:root 密碼:root
8.服務(wù)端設(shè)置
進(jìn)入/usr/bin/os/目錄
cd /usr/bin/os/
腳本說明:
1.create_local_yum.sh #作用用來更新本地yum源裝一些系統(tǒng)工具
2.update_master.sh #更新ambari要用的yum源并且安裝http服務(wù)和主服務(wù)節(jié)點(diǎn)
3.generate_ssh.sh #個(gè)性化安裝ssh服務(wù) 示例:./generate_ssh.sh root root 第一個(gè)root是賬號,第二個(gè)root是密碼。
4.mysql_start.sh #mysql服務(wù)安裝和非交互式安裝數(shù)據(jù)庫,用戶名和密碼
默認(rèn)密碼為123456.
5.jiaohu.sh #運(yùn)行此腳本可以實(shí)現(xiàn)非交互式安裝ambari
6.change.sh #運(yùn)行此腳本出9個(gè)選項(xiàng)可以一鍵安裝ambari服務(wù)端和客戶端手動設(shè)定ip地址,主機(jī)名和root密碼,修改ambari主機(jī)名。
7.yum-hdp.sh #運(yùn)行此腳本執(zhí)行hdp源操作。
8.jiagu.sh #運(yùn)行此腳本進(jìn)行安全加固。
9.miyao.sh #添加服務(wù)端公鑰到客戶
執(zhí)行sh change.sh
進(jìn)入菜單選項(xiàng)

8.1 修改ip地址
運(yùn)行change.sh 執(zhí)行3進(jìn)行ip地址修改
(需要重啟網(wǎng)卡服務(wù))
輸入yes,然后輸入ip地址和網(wǎng)關(guān)地址,最后再確認(rèn)一遍ip地址。

運(yùn)行8重啟服務(wù)

8.2 安裝vasp server
運(yùn)行change.sh 執(zhí)行1進(jìn)行server安裝
安裝完成如圖:

8.3 修改hosts
運(yùn)行change.sh 執(zhí)行4進(jìn)行hosts修改

8.4 修改hostnames
運(yùn)行change.sh 執(zhí)行5進(jìn)行hostname修改
(需要重啟服務(wù)器)
#reboot
8.5 修改ambari hostname
運(yùn)行change.sh 執(zhí)行6進(jìn)行ambari hostname修改
首先要輸入默認(rèn)的vasp-manager然后再輸入hostname
(需要跟hostname名字一致)

8.6 修改root密碼
運(yùn)行change.sh 執(zhí)行7進(jìn)行root密碼修改
8.7 服務(wù)端更新時(shí)間
9.配置平臺yum源
掛載hdp.iso
cd /usr/bin/vasp/
執(zhí)行sh yum-hdp.sh
# sh yum-hdp.sh
Please insert source path:/dev/sr0
Please insert target path:/mnt
輸入源路徑,目標(biāo)路徑

輸入本機(jī)ip地址:192.168.2.11
自動執(zhí)行#yum clean all && yum list
訪問http:192.168.2.11/centos 獲取centos的yum源地址
訪問http:192.168.2.11/ambari 獲取ambari的yum源地址
訪問http:192.168.2.11/HDP 獲取HDP的yum源地址
訪問http:192.168.2.11/HDP-UTILS 獲取HDP-UTILS的yum源地址
訪問http:192.168.2.11/vmp-extend 獲取vmp-extend的yum源地址
10.vmp管理平臺
在網(wǎng)頁輸入:http://192.168.2.11:8080/
//mysql初始庫密碼 用戶:root 密碼:123456.
//vmp管理平臺密碼 用戶:admin 密碼:admin

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“大數(shù)據(jù)平臺如何使用搭建腳本一鍵安裝OS”這篇文章對大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識等著你來學(xué)習(xí)!
當(dāng)前標(biāo)題:大數(shù)據(jù)平臺如何使用搭建腳本一鍵安裝OS-創(chuàng)新互聯(lián)
文章出自:http://chinadenli.net/article24/didoje.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)頁設(shè)計(jì)公司、虛擬主機(jī)、品牌網(wǎng)站設(shè)計(jì)、云服務(wù)器、品牌網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容