当前位置:网站首页>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
边栏推荐
- Fastdfs installation
- 高级性能测试系列《24. 通过jdbc执行sql脚本》
- Develop fixed asset management system, what voice is used to develop fixed asset management system
- R language dplyr package filter function filters dataframe data. If the name of the data column (variable) to be filtered contains quotation marks, you need to use!! SYM syntax processing, otherwise n
- 聊聊电商系统中红包活动设计
- Tutorial (5.0) 09 Restful API * fortiedr * Fortinet network security expert NSE 5
- MySQL advanced learning summary 8: overview of InnoDB data storage structure page, internal structure of page, row format
- [0701] [paper reading] allowing data imbalance issue with perforated input during influence
- golang:[]byte转string
- Introduction to the paper | application of machine learning in database cardinality estimation
猜你喜欢
Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5
How can retail enterprises open the second growth curve under the full link digital transformation
Markdown基础语法
[0701] [paper reading] allowing data imbalance issue with perforated input during influence
yolov3 训练自己的数据集之生成train.txt
仿京东放大镜效果(pink老师版)
【JVM调优实战100例】01——JVM的介绍与程序计数器
教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 网络安全专家 NSE 5
思维意识转变是施工企业数字化转型成败的关键
Have you stepped on the nine common pits in the e-commerce system?
随机推荐
PHP非对称加密方法私钥及公钥加密解密的方法
Markdown basic grammar
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
Reduce -- traverse element calculation. The specific calculation formula needs to be passed in and combined with BigDecimal
虚拟机初始化脚本, 虚拟机相互免秘钥
Thread application instance
Kubernetes three open interfaces first sight
Fastdfs installation
二进制操作
[0701] [paper reading] allowing data imbalance issue with perforated input during influence
MySQL advanced learning summary 7: MySQL data structure - Comparison of hash index, AVL tree, B tree and b+ tree
According to the atlas of data security products and services issued by the China Academy of information technology, meichuang technology has achieved full coverage of four major sectors
聊聊电商系统中红包活动设计
Preprocessing and preprocessing macros
云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统
学习八股文的知识点~~1
横向越权与纵向越权[通俗易懂]
Page title component
Emmet basic syntax
FastDFS安装