Automated installation of shell scripts Universal binary format mariadb

Source: Internet
Author: User

#!/bin/Bashdatadir="/mydata/data"sqlconf=/etc/Mysqlinstalldir=/usr/local/mysql# about the installation package you can go to the official website to download, pay attention to download the common binary format, and then put on the FTP server can be # here assume I put mariadb5.5 's installation package on the FTP/pub/sources/6. x86_64/MARIADB below Case$1 inch $) Package=mariadb-5.5. $-linux-x86_64.Tar. GZdir=mariadb-5.5. $-linux-x86_64wgetLftp172.16.0.1:/pub/sources/6. x86_64/mariadb/$package;; +) Package=mariadb-5.5. +-linux-x86_64.Tar. GZdir=mariadb-5.5. +-linux-x86_64wgetLftp172.16.0.1:/pub/sources/6. x86_64/mariadb/$package;;*)        Echo "Usage/bin/bash ' basename $ ' 36|40"Exit1Esac#Echo 'Get mariadb-5.5.36-linux-x86_64.tar.gz#bye'| lftp 172.16.0.1:/pub/sources/6.x86_64/mariadbTarXF ${package}-c/usr/LOCALCD/usr/local# for it to create links MySQL easy to manage laterLN-S ${dir} MYSQLCD ${installdir} #创建mysql系统用户if!IDMySQL &>/dev/NULL; ThenUseradd-R MySQLfi# Create a data file directoryif[!-d ${datadir}]; Then        mkdir-PV ${datadir} &>/dev/NULL        Chown-R mysql:mysql ${datadir}fi# Initialize MARIADBCD ${installdir}scripts/mysql_install_db--user=mysql--datadir=/mydata/data &>/dev/NULL# Add a configuration file for mariadbif[!-d ${sqlconf}]; Then        mkdir-p/etc/mysql &>/dev/NULLfiCD ${installdir}CPsupport-files/my-large.cnf/etc/mysql/my.cnfsed-I.'/^thread_ca/a \datadir =/mydata/data \ninnodb_file_per_table = on \nskip_name_resolve = on'/etc/mysql/my.cnf# Adding service scripts for mariadbCP${installdir}/support-files/mysql.server/etc/rc.d/init.d/Mysqldchkconfig--add mysqld# Adding mariadb command to PATH environment variableEcho 'export Path=/usr/local/mysql/bin: $PATH'>/etc/profile.d/mysql.SH. /etc/profile.d/mysql.SH# Add man manualsed-I.'/^man.*\/usr\/man/a manpath/usr/local/mysql/man/'/etc/Mans. configEcho 'The mariadb has installed successfully'Echo 'Please Exect ". /etc/profile.d/mysql.sh "To update PATH'

Automated installation of shell scripts Universal binary format mariadb

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.