Shell Scripts Automate installation

Source: Internet
Author: User

In a Linux environment, automate installation steps for multiple packages:

1, find the software package, extract the name of the package to establish the decompression path (in order to let us more clearly find our files)

Pkg= ' Find ${package_path}-name *bin*.tar.gz | Sed-n ' $ ' p ' (assuming the name of the package I'm looking for has BIN)

T_dir= ' basename ${pkg} | Awk-f '. Tar ' ' {print '} ' (read package name)

Rm-r/opt/${t_dir}

Mkdir/opt/${t_dir}

Tar-xvzf ${pkg}-c/opt/${t_dir}

Find/opt/${t_dir}-name "*.sh"-exec Dos2unix ' {} ' \; (format for. sh files in the package)

Chown-r ${username}:${_users_groupname} Opt/${t_dir} for the established file change owner

chmod +x-r Opt/${t_dir} additional executable permissions

Generally in such a way as Tomcat, Apache and other software is the equivalent of installation completed, as long as the attention to the path and permissions on the line.

But I'm here. Only the main code, the general use of variables to determine whether the variable is empty, to find files to determine whether the file is found, after the execution of the command to determine whether the correct implementation of the command. After the software installation is complete, check the environment for proper operation of the software.

such as commonly used variables such as the written configuration file, referenced in the script. ./include/global.inc or source./include/global.inc

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.