shell
多级构建镜像脚本
ecs初始化1
ecs初始化2
nginx rpm编译
shell 批量改名
mysql rpm 编译
-
+
首页
mysql rpm 编译
``` #!/bin/bash #centos7编译mysql的rpm包并利用sftp上传脚本 ######################变量########################## #获取解压后的包 #mysql-5.7.32 var2="mysql-`echo $VERSION`" #连接sftp user=sftp passwd='sftp' port=18884 ip=192.168.0.173 #传输目的地 addr="/sftp/openeuler/rpm/" cd /home/ curl -o /etc/yum.repos.d/openEulerOS.repo https://repo.huaweicloud.com/repository/conf/openeuler_aarch64.repo yum install -y wget rpm-build make gcc gcc-c++ cmake perl-Env perl-Data-Dumper perl-JSON time libaio-devel ncurses-devel numactl-devel openssl-devel zlib-devel cyrus-sasl-devel openldap-devel git rpcgen wget -c https://downloads.mysql.com/archives/get/p/23/file/mysql-community-$VERSION-1.el7.src.rpm -O mysql.src.rpm rpm -ivh mysql.src.rpm cd /root/rpmbuild/SOURCES/ tar xf mysql-$VERSION.tar.gz sed -i '/mysqld_daemon.h/ a #include <sys/prctl.h>' mysql-$VERSION/sql/mysqld.cc tar -zcf mysql-$VERSION.tar.gz mysql-$VERSION #执行编译#4表示并发数,要小于内存除以2G ,例如16G内存,则并发数小于8,_smp_mflags -j4 等于同时使用4个内核去并发执行。 rpmbuild -bb --define '_smp_mflags -j4' /root/rpmbuild/SPECS/mysql.spec yum install createrepo -y createrepo /root/rpmbuild/RPMS/aarch64 cd /root/rpmbuild/RPMS/ mkdir $var2 cd /root/rpmbuild/RPMS/aarch64/ cp -r * ../$var2 #利用sftp传输脚本生成的包 yum install vim wget -y yum install glibc-headers gcc-c++ make unzip -y cd /opt #编译tcl,expect编译依赖tcl wget http://core.tcl.tk/tcl/zip/release/tcl.zip unzip tcl.zip cd ./tcl/unix ./configure && make -j4 && make install cd /opt #编译expect,expect提供了shell中的人机交互 wget https://jaist.dl.sourceforge.net/project/expect/Expect/5.45.3/expect5.45.3.tar.gz --no-check-certificate tar -xzvf expect5.45.3.tar.gz && cd expect5.45.3/ ./configure --build=arm-linux && make -j4 && make install #安装sftp,传输需要 yum install openssh-clients -y cd /root/rpmbuild/RPMS #利用expect工具和sftp协议进行传输编译的包 /usr/local/bin/expect <<-EOF set timeout -1 spawn sftp -oPort=$port $user@$ip expect { "yes/no" { send "yes\r"; exp_continue } "Password:" { send "$passwd\r"; exp_continue } "sftp" { send "put -r ./$var2/ $addr\r" } } send "exit\r" expect eof EOF echo "make over finishjrt" ```
JRT
2022年3月9日 14:10
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码