一、把所有软件放入deploy文件夹:
二、zip deploy 文件夹
三、用 FileZilla 上传deploy.zip到服务器对应目录,系统安装U盘插到服务器上面 (1start.sh 中的 run/media/root/CT7/ ,根据实际情况修改)
四、到服务器对应目录unzip deploy.zip (没有按照unzip的先执行 yum install unzip)
五、执行 cd deploy && chmod +x *.sh
六、执行 1start.sh;
七、按照打印出来的MySQL初始密码 登陆MySQL :
1.mysql -uroot -p 回车;
2.输入MySQL初始密码 ,回车;
3.执行以下sql,此处 PwdTest123 :
set password=password('PwdTest123');
use mysql;
grant all privileges on *.* to 'root'@'%' identified by 'your_password';
update mysql.user set password=PASSWORD('PwdTest123')where User='root';
flush privileges;
create database TestDB;
exit;
八、执行 4restart.sh,重启以后部署就完成了
此处附上个sh的范例:
1start.sh 如下:
#BackUpAll file
cp /etc/profile /etc/profile.zcBak
cp /etc/rc.local /etc/rc.local.zcBak
yum -y remove mariadb-libs
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old
cp /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo.old
sed -i '16,21d' /etc/yum.repos.d/CentOS-Media.repo
echo 'baseurl=file:///run/media/root/CT7/' >> /etc/yum.repos.d/CentOS-Media.repo
echo 'gpgcheck=1' >> /etc/yum.repos.d/CentOS-Media.repo
echo 'enabled=1' >> /etc/yum.repos.d/CentOS-Media.repo
echo 'gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7' >> /etc/yum.repos.d/CentOS-Media.repo
yum clean all
yum -y install gcc
yum -y install perl
yum -y install zlib-devel
yum -y install cmake
yum -y install ncurses-devel
yum -y install httpd
yum -y install gcc-c++
yum -y install autoconf
yum -y install pcre-devel
#echo tar -xf pack
mkdir /home/ZC
mkdir /home/ZC/path
pwd >> /home/ZC/makeInstallPath.txt
makeInstallPath=$(cat /home/ZC/makeInstallPath.txt)
cd $makeInstallPath/
tar -xf jdk-8u171-linux-x64.tar.gz
tar -xf nginx-1.18.0.tar.gz
tar -xf redis-5.0.5.tar.gz
#echo redis nginx
cd $makeInstallPath/redis-5.0.5/
make && make install
cd $makeInstallPath/nginx-1.18.0/
./configure
make && make install
echo '/usr/local/nginx/sbin/nginx' >> /etc/rc.local
#zcnest copy
cp -R $makeInstallPath/PG /home/PG
cp -R $makeInstallPath/RGC /home/RGC
#jdk config
cp -R $makeInstallPath/jdk1.8.0_171 /home/jdk
echo 'export JAVA_HOME=/home/jdk' >> /etc/profile
echo 'export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
#echo mysql
cd $makeInstallPath/MySQL-5.6.49-1.el7.x86_64.rpm-bundle
rpm -ivh MySQL-client-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-devel-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-embedded-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.6.49-1.el7.x86_64.rpm
rpm -ivh MySQL-test-5.6.49-1.el7.x86_64.rpm
systemctl disable firewalld
#sed -i '5askip-grant-tables' /usr/my.cnf
chkconfig --add mysql
chkconfig mysql on
/etc/init.d/mysql restart
#init all jar
chmod +x /etc/rc.local
chmod +x /home/Test/Start.sh
echo '/home/Test/Start.sh' >> /etc/rc.local
cp -R $makeInstallPath/html/* /usr/local/nginx/html
cat /root/.mysql_secret | grep 'password' >> $makeInstallPath/sqlPwd.txt
awk '{print $18}' $makeInstallPath/sqlPwd.txt >>$makeInstallPath/pd.txt
cd $makeInstallPath
echo 数据库密码是:
cat $makeInstallPath/pd.txt
4restart.sh 如下:
#DataBase import
/etc/init.d/mysql restart
mysql -uroot -pTestPwd TestDB < /home/test.sql
#ZC AGV LOG dir
mkdir /home/Logs
source /etc/profile
reboot