当前位置:网站首页>Virtual machine initialization script, virtual machine mutual secret key free
Virtual machine initialization script, virtual machine mutual secret key free
2022-07-02 19:18:00 【Upward Wolf】
One 、 Virtual machine initialization script
#!/bin/bash
## -bash: ./lucky.sh: /bin/bash^M: bad interpreter: No such file or directory
## vim perhaps vi In command mode , Enter the command set fileformat=unix You can solve the line feed problem
echo -e "\e[1;31m【---------------------------------------- stay opt and var establish lucky Folder 】\e[0m"
sleep5
mkdir -p /opt/lucky
mkdir -p /var/lucky
mkdir -p /usr/local/script
echo -e "\e[1;31m【---------------------------------------- Disable firewall 】\e[0m"
sleep 5
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
echo -e "\e[1;32m【---------------------------------------- modify selinux】\e[0m"
sleep 5
sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config
echo -e "\e[1;32m【---------------------------------------- install wget】\e[0m"
sleep 5
yum install wget -y
echo -e "\e[1;33m【---------------------------------------- modify yum Source 】\e[0m"
sleep 5
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-
7.repo
yum clean all
yum makecache
echo -e "\e[1;33m【---------------------------------------- Install common software 】\e[0m"
yum install man man-pages ntp vim lrzsz zip unzip telnet perl net-tools -y
echo -e "\e[1;34m【---------------------------------------- Synchronization system time 】\e[0m"
yum info ntp && ntpdate cn.ntp.org.cn
echo -e "\e[1;34m【----------------------------------------DNS Domain name configuration 】\e[0m"
sleep 5
echo "192.168.58.100 basenode" >> /etc/hosts
echo "192.168.58.161 bd1601" >> /etc/hosts
echo "192.168.58.162 bd1602" >> /etc/hosts
echo "192.168.58.163 bd1603" >> /etc/hosts
echo -e "\e[1;34m【---------------------------------------- install JDK】\e[0m"
sleep 5
rpm -ivh jdk-8u231-linux-x64.rpm
echo 'export JAVA_HOME=/usr/java/jdk1.8.0_231-amd64' >> /etc/profile
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> /etc/profile
source /etc/profile
echo -e "\e[1;35m【---------------------------------------- install Tomcat】\e[0m"
sleep 5
tar -zxf apache-tomcat-8.5.47.tar.gz
mv apache-tomcat-8.5.47 /opt/lucky/
echo -e "\e[1;35m【---------------------------------------- install Mysql】\e[0m"
sleep 5
rpm -e --nodeps `rpm -qa | grep mariadb`
tar -xvf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.28-1.el7.x86_64.rpm
systemctl start mysqld
systemctl enable mysqld
temppasswd=`grep "A temporary password" /var/log/mysqld.log | awk '{ print
$NF}'`
mysql -uroot -p$temppasswd --connect-expired-password << EOF
set global validate_password_policy=low;
set global validate_password_length=6;
alter user [email protected] identified by '123456';
use mysql;
update user set host='%' where user = 'root';
commit;
quit
EOF
systemctl restart mysqld
echo -e "\e[1;35m【---------------------------------------- install Nginx】\e[0m"
sleep 5
echo -e "\e[1;36m【---------------------------------------- Set the boot entry 】\e[0m"
sleep 5
touch /usr/local/script/auto_ntpdate.sh
echo '#!/bin/bash' >> /usr/local/script/auto_ntpdate.sh
echo 'yum info ntp && ntpdate cn.ntp.org.cn' >>
/usr/local/script/auto_ntpdate.sh
chmod u+x /usr/local/script/auto_ntpdate.sh
echo '/usr/local/script/auto_ntpdate.sh' >> /etc/rc.local
chmod u+x /etc/rc.local
echo -e "\e[1;36m【---------------------------------------- Delete file 】\e[0m"
sleep 5
rm -rf apache-tomcat-8.5.47.tar.gz
rm -rf jdk-8u231-linux-x64.rpm
rm -rf mysql*
rm -rf *.sh
echo -e "\e[1;36m【---------------------------------------- Close the calculator , Take a snapshot 】
\e[0m"
sleep 5
shutdown -h now
Two 、 Virtual machines are mutually keyless
## The three hosts generate secret keys
【123】ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
##host verification
【123】vim /etc/ssh/ssh_config Add at the end
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
## Copy the secret key to yourself and others
【123】ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
【123】ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
【123】ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
123456
## Turn off the host to take a snapshot
power off
边栏推荐
- Develop fixed asset management system, what voice is used to develop fixed asset management system
- R language ggplot2 visual Facet: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
- Mysql高级篇学习总结7:Mysql数据结构-Hash索引、AVL树、B树、B+树的对比
- Markdown basic grammar
- 2022编译原理期末考试 回忆版
- ORA-01455: converting column overflows integer datatype
- Yolov3 trains its own data set to generate train txt
- Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
- 电商系统中常见的 9 大坑,你踩过没?
- 2022 compilation principle final examination recall Edition
猜你喜欢
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
Develop fixed asset management system, what voice is used to develop fixed asset management system
The difference between interceptor and filter
Obligatoire pour les débutants, cliquez sur deux boutons pour passer à un contenu différent
论文导读 | 关于将预训练语言模型作为知识库的分析与批评
【JVM调优实战100例】02——虚拟机栈与本地方法栈调优五例
新手必看,点击两个按钮切换至不同的内容
Machine learning notes - time series prediction research: monthly sales of French champagne
高级性能测试系列《24. 通过jdbc执行sql脚本》
Compile oglpg-9th-edition source code with clion
随机推荐
[daily question] the next day
Thread application instance
Progress-进度条
Binary operation
Emmet基础语法
SIFT特征点提取「建议收藏」
QT中的QPropertyAnimation使用和toast案列
R语言使用epiDisplay包的cox.display函数获取cox回归模型汇总统计信息(风险率HR、调整风险率及其置信区间、模型系数的t检验的p值、Wald检验的p值和似然比检验的p值)、汇总统计
从list转化成map的时候,如果根据某一属性可能会导致key重复而异常,可以设置处理这种重复的方式
Date tool class (updated from time to time)
STM32G0 USB DFU 升级校验出错-2
数据降维——因子分析
Novice must see, click two buttons to switch to different content
2022软件工程期末考试 回忆版
codeforces每日5题(均1700)-第四天
R language ggplot2 visualization: visualize the line chart and add customized X-axis label information to the line chart using labs function
juypter notebook 修改默认打开文件夹以及默认浏览器
Gstore weekly gstore source code analysis (4): black and white list configuration analysis of security mechanism
When converting from list to map, if a certain attribute may cause key duplication and exceptions, you can set the way to deal with this duplication
Excel如何进行隔行复制粘贴