linux網(wǎng)絡(luò)配置:
1.為什么要進(jìn)行網(wǎng)絡(luò)配置?
1.ifconfig =》 查看不了ip? (無法遠(yuǎn)程登錄)
2.ip會(huì)變掉=》動(dòng)態(tài)ip =》靜態(tài)ip
systemctl restart network =》 重啟網(wǎng)絡(luò)配置
配置ip:
1.linux ip
1.vim /etc/sysconfig/network-scripts/ifcfg-ens33
修改:
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.10.10? //linux ip
GATEWAY=192.168.10.2? // => vm
DNS1=192.168.10.2
2.vm ip
1.ip
192.168.10.0
2.網(wǎng)關(guān)
192.168.10.2
3.重啟linux
reboot 重啟
shutdown 關(guān)機(jī)
gh03 :
1. linux ip? => 靜態(tài)ip
2. vm ip :
vm ip
1.ip
192.168.10.0
2.網(wǎng)關(guān)
192.168.10.2
3.測(cè)試是否成功:
linux =》 192.168.10.3
克隆機(jī)器:
1.機(jī)器名
vim /etc/hostname
2.ip
vim /etc/sysconfig/network-scripts/ifcfg-ens33
3.驗(yàn)證:
遠(yuǎn)程連接
shell :
1.編程語言
2.可以執(zhí)行的文件
2.文件內(nèi)容:就是linux命令組成在一起的
1.入門:
shell腳本: xxx.sh
1.編寫腳本
vim wc.sh
2.賦予腳本權(quán)限
chmod 744 wc.sh
3.執(zhí)行腳本
#!/bin/bash? =》 編寫 =》 bin/bash執(zhí)行器? bash
sh xx.sh
1.編寫腳本
vim wc.sh
2.執(zhí)行腳本
sh xx.sh
執(zhí)行腳本:
1.賦予權(quán)限
./xx.sh? ? 【絕對(duì)路徑、相對(duì)路徑】
sh xx.sh? 【絕對(duì)路徑、相對(duì)路徑】
2.沒有賦予權(quán)限
sh xx.sh
2.變量與引用
1.變量
[root@gh04 shell]# cat variable.sh
name="zuoshao"
dt="date"
dt1=`date`
echo $name
echo $dt
echo $dt1
賦予權(quán)限:
[root@gh04 shell]# chmod u+x ./variable.sh
shell變量: shell里面變量類型默認(rèn)只有一種 string
1.定義 :
k=v
2.分類:
1.靜態(tài)變量
k=v k="v" k='v'
2.動(dòng)態(tài)變量
k=`v`
v:
1.變量
2.系統(tǒng)命令
注意:
1.= 前后不能有空格
2.變量名字 都是大寫 【規(guī)范】
3.定義變量的時(shí)候 建議使用 {}
2.引用:
$xx
${xx}
3.傳遞參數(shù)
$n? 想腳本傳遞參數(shù)
1.n 代表一個(gè)數(shù)字
1.
[root@gh04 shell]# cat parameter.sh
echo "第一個(gè)參數(shù):$1"
echo "第二個(gè)參數(shù):$2"
2.
[root@gh04 shell]# cat parameter.sh
echo "文件名:$0"
echo "第一個(gè)參數(shù):$1"
echo "第二個(gè)參數(shù):$2"
echo "參數(shù)的個(gè)數(shù):$#"
echo "傳遞的參數(shù)作為一個(gè)字符串:$*"
echo "腳本運(yùn)行時(shí)候的pid為:$$"
3.元素帶有空格 ""
[root@gh04 shell]# ./parameter.sh "zuo shao"
文件名:./parameter.sh
第一個(gè)參數(shù):zuo shao
第二個(gè)參數(shù):
參數(shù)的個(gè)數(shù):1
傳遞的參數(shù)作為一個(gè)字符串:zuo shao
腳本運(yùn)行時(shí)候的pid為:5731
安裝軟件:
1.rpm
2.yum
3.tar
rpm -qa | grep -i java | xargs -n1? rpm -e --nodeps
rpm -qa | grep -i java // rpm查詢
rpm -e? --nodeps? //rpm卸載
文件名字:
jdk-8u212-linux-x64.tar.gz
.gz =》 gzip 方式壓縮的文件
jdk-8u212-linux-x64.tar =》 tar文件 【歸檔文件】
jdk-8u212-linux-x64 =》 linux 工具 tar命令 =》 歸檔文件
部署jdk:
1.解壓
[root@gh04 software]# tar -zxvf ./jdk-8u212-linux-x64.tar.gz -C ~/app/
2.部署
配置環(huán)境變量
vim ~/.bashrc
export? JAVA_HOME=/root/app/jdk1.8.0_212
export PATH=${JAVA_HOME}/bin:${PATH}
source ~/.bashrc
[root@gh04 jdk1.8.0_212]# ll
總用量 26000
drwxr-xr-x. 2 10 143? ? 4096 4月? 2 2019 bin? //jdk 的腳本
drwxr-xr-x. 5 10 143? ? 4096 4月? 2 2019 lib
4.數(shù)組
語法格式:
arr=(v1 v2 v3)
[root@gh04 shell]# cat arr.sh
arr_name=(zuoshao banzhang haoge)
echo "數(shù)組所有元素:${arr_name[@]}"
echo "第二個(gè)元素:${arr_name[1]}"
echo "數(shù)組的大小:${#arr_name[@]}"
5.流程控制
if else
語法格式
if contdition ;then
cmd ;
else
cmd;
fi
contdition:
[ 條件表達(dá)式 ]
1、值判斷
數(shù)值類型和字符串
=
==
數(shù)值類型
-lt? less 小于
-le? less equals 小于等于
-gt? 大于
-ge? 大于等于
-ne? 不等于
案例:
[root@gh04 shell]# cat if.sh
name1="zuoshao"
name2="xuanxuan"
if [ ${name1} == ${name2} ];then
echo "${name1} == ${name2}"
else
echo "${name1} != ${name2}"
fi
思考:
shell 里面能不能debug?
1.直接執(zhí)行
./if.sh
2.debug模式
1.常用
sh -x ./if.sh
2.腳本里面
#!/bin/bash -x
if contdition ;then
cmd ;
elif contdition ;then
cmd;
else
cmd;
fi
案例:
[root@gh04 shell]# cat elif.sh
input=$1
if [ ${input} -gt 90 ];then
echo "男神"
elif [ ${input} -ge 60 ];then
echo "軒軒"
else
echo "屌絲"
fi
循環(huán):
for while
for:
語法格式:
for xx in arr
do
cmd;
done
[root@gh04 shell]# cat forwhile.sh
for x in 1 2 3 4 5
do
echo $x
done
for((i=1;i<=10;i++));?
do?
echo ${i}
done
while:
while(條件)
do
cmd;
done
案例:
[root@gh04 shell]# cat forwhile.sh
for x in 1 2 3 4 5
do
echo $x
done
echo "------------"
for((i=1;i<=10;i++));?
do?
echo ${i}
done
echo "------------"
a=0
while(($a <=5))
do
echo "$a"
let a++;
done
案例:
遍歷字符串?dāng)?shù)組
1.語法
function
Switch case
2.兩個(gè)命令
awk
sed
MySQL:
1.使用場(chǎng)景?
1.java =》 app業(yè)務(wù)數(shù)據(jù)庫 存儲(chǔ)業(yè)務(wù)數(shù)據(jù)
2.大數(shù)據(jù) =》 框架 =》 元數(shù)據(jù)的庫
=》采集業(yè)務(wù)數(shù)據(jù)
=》結(jié)果數(shù)據(jù) =》 mysql =》 數(shù)據(jù)可視化
3.沒有it =》 excel =》 mysql oracle
2.MySQL是什么?
1.關(guān)系型數(shù)據(jù)庫
2.類似一個(gè)表格
3.有行有列
4.存儲(chǔ)數(shù)據(jù)的
3.為什么學(xué)習(xí)mysql ?
1.掌握sql開發(fā) =》 數(shù)據(jù)分析 sql
2.大數(shù)據(jù) 為后續(xù)大數(shù)據(jù)框架hive sparksql flinksql? =》 打下基礎(chǔ) sql
4.官網(wǎng)
www.mysql.com
MySQL部署:
1.平臺(tái):
1.linux
2.win :
數(shù)據(jù)分析
2.部署的方式: linux
1.rpm 方式部署【】
1.方便
2.學(xué)習(xí)
3.不能夠定制化
2.tar包方式【二進(jìn)制方式】
3.版本:
三大版本:
5.6
5.7 主流
8.x 次主流
MySQL支持了開窗函數(shù)、
部署MySQL:
1.解析tar
tar -zxvf? xxx.tar.gz
tar -xvf xxx.tar?
[root@gh04 software]# tar -xvf ./mysql-8.0.21-1.el7.x86_64.rpm-bundle.tar -C ./mysql
2.安裝mysql
rmp 包
1.卸載自帶mysql相關(guān)的內(nèi)容
rpm -qa | grep mariadb
mariadb => mysql分支
rpm -e? --nodeps mariadb-libs-5.5.68-1.el7.x86_64
2.安裝
rpm -ivh xxx.rpm
rpm -ivh mysql-community-common-8.0.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.21-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.21-1.el7.x86_64.rpm
rpm -qa | grep mysql | xargs -n1 rpm -e? --nodeps
3.啟動(dòng)mysql
每個(gè)軟件 都有自己的 配置文件:
vim /etc/my.cnf
mysql日志文件:/var/log/mysqld.log
第一次啟動(dòng):
mysqld --initialize --user=mysql
日志臨時(shí)密碼: root@localhost: j9kkdlwe<doF
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? yJ((Fl8E/y?h
啟動(dòng)mysql :
systemctl start mysqld
登錄MySQL:
mysql -uroot -p
修改密碼:
alter user root@localhost identified by '123456';
修改ip登錄【任意ip】
update mysql.user set host='%' where user='root';
刷新權(quán)限
flush privileges;
遠(yuǎn)程連接:
mysql遠(yuǎn)程連接工具:
Navicat
dbvear 【網(wǎng)盤連接 mysql相關(guān)資料】
1.關(guān)閉防火墻
systemctl stop firewalld
systemctl disable firewalld