Record an exercise

Keywords: Linux MySQL CentOS

Practice content

1. Install centos

  • VI / etc / sysconfig / network scripts / ifcfg-ens33 modify the network configuration file

IPADDR=     Virtual machine IP Address. The last bit is between 128 and 200

NETMASK=              Subnet mask

GATEWAY=              Default gateway    install CentOS There are in the network interface when installing, and record it when installing

DNS1=				 DNS Domain name system( System) (Domain Name System) It is composed of parser and domain name server.

  • vi /etc/hostname modify the host name, delete the original, and write only one host name

  • vi /etc/hosts configure host name and ip address mapping. Write ip address first and then host name

  • Restart systemctl restart network

  • Install editor yum install -y vim

  • Install downloader yum install -y wget

yum replace domestic source



cd /etc/yum.repos.d/

mv CentOS-Base.repo CentOS-Base.repo_bak
  • Alibaba cloud yum source:
wget -O /etc/yum.repos.d/CentOS-Base.repo
  • yum clean all

  • yum makecache

Turn off firewall

systemctl stop firewalld

systemctl disable firewalld

2. Install JDK

  • Upload installation package to linux
  • Unzip it to the appropriate location, create a folder, put it in the folder and rename it
tar -zxvf jdk-8u251-linux-x64.tar.gz
mkdir /opt/soft
mv jdk1.8.0_251/ /opt/soft/jdk180
  • Configure environment variable / etc/myprofile
export JAVA_HOME=/opt/soft/jdk180
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
  • Then execute
source /etc/profile
  • Test for successful installation
java -version

3. Install mysql

  • Check whether mariadb of linux is uninstalled. If not, mysql has not been installed
rpm -qa | grep mariadb
  • If it is installed, uninstall the mariadb database. If it is not installed, the following operations are not required
rpm -e --nodeps `rpm -qa | grep mariadb`
  • Enter the / opt / directory
wget -i -c
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
  • Modify / etc/my.cnf file to solve Chinese garbled code
stay socket=/var/lib/mysql/mysql.sock Add below

Add at the end
  • start-up
service mysqld restart
systemctl start  mysqld.service
  • Get temporary password
pwdinfo=`grep "password" /var/log/mysqld.log | grep -wF "temporary password"`
passwd=$(echo $passwd)
  • Execute password change statement
mysql -uroot -p$passwd --connect-expired-password -e "set global validate_password_policy=0"
mysql -uroot -p$passwd --connect-expired-password -e "set global validate_password_length=1"
mysql -uroot -p$passwd --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'okok'"
  • Modify remote login
mysql -uroot -pokok -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'okok' WITH GRANT OPTION"
mysql -uroot -pokok -e "flush privileges"

4. Install Hadoop 260 standalone cdh

  • Unzip it to the appropriate location, create a folder, put it in the folder and rename it
tar -zxvf hadoop-2.6.0-cdh5.14.2.tar.gz
mv hadoop-2.6.0-cdh5.14.2 /opt/soft/hadoop260
  • Modify core-site.xml under / etc/hadoop take java Change the reference path of to an absolute path
export JAVA_HOME=/opt/soft/jdk180
core-site.xml Add the following configuration


  • Modify hdfs-site.xml
Add the following configuration


  • Copy cp mapred-site.xml.template mapred-site.xml and rename it
cp mapred-site.xml.template mapred-site.xml
 Add the following configuration
  • Modify yarn-site.xml
Add the following configuration

  • Modify / etc/profile
increase hadoop route
#hadoop environment
export HADOOP_HOME=/opt/soft/hadoop260
  • source /etc/profile
  • hadoop namenode -format
  • or
  • Test
  • close or

SSH password free login

A pair of passes generates a pair of public and private keys. The private key is kept by itself and the public key is given to others. If there is a public key, the machine with the private key does not need a password

It can be in any path

ssh-keygen -t rsa -P ''   ---Then enter
ls -al //View hidden file.ssh
cd .ssh
ssh-copy-id root@hd01   ---Then you need to enter the password
 notes:hd01 Is the host name

5. Install Hive1.1.0cdh

  • Unzip it to the appropriate location, create a folder, put it in the folder and rename it
tar -zxvf hive-1.1.0-cdh5.14.2.tar.gz
mv hive-1.1.0-cdh5.14.2 /opt/soft/hive110
  • Go to cd /opt/soft/hive110/conf
  • New file hive-site.xml mkdir hive-site.xml
Add the following
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>



	<!-- If remote mysql If the database needs to be written to the remote database here IP or hosts -->







  • Download the mysql driver package and save it in / opt/soft/hive110/lib
mv mysql-connector-java-5.1.38.jar /opt/soft/hive110/lib/
  • Configure environment variable / etc/profile
#hive environment
export HIVE_HOME=/opt/soft/hive110
export PATH=$PATH:$HIVE_HOME/bin
  • source /etc/profile
  • initialization
schematool -dbType mysql -initSchema

When you enter hive, note that hadoop should be started in advance

First enter the command in a window
hive --service hiveserver2
 Background startup method:nohup hive --service hiveserver2 &

Then open another window

  • hive exit: exit;
  • beeline -u jdbc:hive2:// this is a connection exit as java:! q

Command line mode

hive -e 'show databases'
hive -e 'select * from mydemo.userinfos'

6. Install zeppelin081

  • Find a suitable place to unzip and rename
tar -zxvf zeppelin-0.8.1-bin-all.tgz
mv zeppelin-0.8.1-bin-all /opt/soft/zeppelin081
  • Enter the directory cd /opt/soft/zeppelin081/conf
  • To modify the configuration file, first copy zeppelin-site.xml.template and rename it to zeppelin-site.xml
cp zeppelin-site.xml.template zeppelin-site.xml

Add as follows

Other configuration files can modify the default port number or not
  <description>Server port.</description>
  • cp
add to JAVA_HOME and HADOOP_CONF_DIR  (Specify your own java and hadoop Installation directory)
export JAVA_HOME=/opt/soft/jdk180
export HADOOP_CONF_DIR=/opt/hadoop260/etc/hadoop
  • Modify / etc/profile and configure environment variables
#zeppelin environment
export ZEPPELIN_HOME=/opt/soft/zeppelin081
  • source /etc/profile

  • Start: start

  • Browser access

  • Close: stop

  • Configure hive interpreter

    • There is no default hive interpreter in Zepplin, but we can add it through the jdbc interpreter.
    • Copy hive-site.xml to zeppelin-0.8.1-bin-all/conf
    cp /opt/soft/hive110/conf/hive-site.xml /opt/soft/zeppelin081/conf/
    • Copy jar package: copy the following two jar packages to interperter under the zeppelin installation directory
    (If installed cdh Version, jar There are in the bag cdh (version number)
    cp /opt/soft/hadoop260/share/hadoop/common/hadoop-common-2.6.0-cdh5.14.2.jar /opt/soft/zeppelin081/interpreter/jdbc/
    cp /opt/soft/hive110/lib/hive-jdbc-1.1.0-cdh5.14.2-standalone.jar /opt/soft/zeppelin081/interpreter/jdbc/
  • Configure integrated hive in web interface

    • In the upper right corner, anonymous -- > interpreter -- > create creates an integrated environment called hive

    • default.driver org.apache.hive.jdbc.HiveDriver

      default.url jdbc:hive2://

      default.user hive

      Click save and restart the hive interpreter

Posted by themaxx113 on Mon, 27 Sep 2021 15:41:33 -0700