# auto-linux **Repository Path**: lx_git_osc/auto-linux ## Basic Information - **Project Name**: auto-linux - **Description**: linux 脚本安装 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2016-11-29 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Linux 软件列表 ## 资源收集 - [Linux 软件资源列表(英文)](https://github.com/VoLuong/Awesome-Linux-Software) - [Linux 软件资源列表(中文)](https://github.com/ChrisLeeGit/awesome-linux-software-cn) ## Linux 常用软件库 - [RPMForge](http://pkgs.repoforge.org) > 为社区贡献源,拥有5000多种CentOS的软件包,被CentOS社区认为是最安全也是最稳定的一个多媒体软件仓库 `rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm` - [EPEL (Extra Packages for Enterprise Linux)](http://dl.fedoraproject.org) > 用于 Fedora-based Red Hat Enterprise Linux (RHEL) 的一个高质量软件源,所以同时也适用于 CentOS 或者 Scientific Linux 等发行版。 > 用人话就是说EPEL是老东家为Fedora提供的高质量软件源,咱可以拿来用。其实也算不上第三方吧,还是自家的。 > 阿里云也提供了epel镜像 http://mirrors.aliyun.com/epel/ > `rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm` - [REMI](http://rpms.famillecollet.com) > 提供了MySQL&&PHP&&HTTP的最新最新最最新的版本的安装。 > 在remi源上http扩展、php扩展要比epel全的多。曾经找php-ffmpeg的yum源,只在remi上找到了。 > `rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm` - [ATRPMS](http://dl.atrpms.net) > 逼格高,最前沿的科技。最初的ATrpms重点放在在自然科学中使用的软件,特别是在高能物理、数学计算、图形编程等科学领域。 > 但此后该存储库包含了许多非科学的软件产品,例如系统工具或多媒体包,从而导致一个更为通用的存储库。 > `rpm -Uvh http://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm` - [WEBTATIC](http://repo.webtatic.com) > 跟remi源有点像,提供的php/mysql/http版本比较全,企业级稳定。 > `rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm` ## CentOS6 初始化脚本 ``` # 安装常用库 rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh http://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm # 更新yun仓库 cd /etc/yum.repos.d cp CentOS-Base.repo CentOS-Base.repo.bak wget http://mirrors.163.com/.help/CentOS6-Base-163.repo mv CentOS6-Base-163.repo CentOS-Base.repo yum clean all yum -y makecache yum -y update # 安装常用软件包 yum -y install yum-fastestmirror yum -y groupinstall "Development Tools" yum -y groupinstall "Chinese Support" ``` ## 开发软件安装 ### Java ``` #!/bin/bash echo "+++++++++++++++++++++++ $(cd `dirname $0`; pwd)/$(basename $0) +++++++++++++++++++++++++" # 当前脚本绝对路径 v_d_current=$(cd `dirname $0`; pwd) # 当前脚本的配置信息 v_f_settings=${v_d_current}/settings # 当前脚本的环境变量配置 v_env_filename=`ls ${v_d_current} | grep env.sh` v_f_env=${v_d_current}/${v_env_filename} # 环境变量文件 v_f_profile=${g_d_profile}/${v_env_filename} # 检查配置文件是否存在 if [ ! -f ${v_f_settings} ]; then echo "settings file does not exist : $v_f_settings" exit -1 fi # 检查环境变量文件是否存在 if [ ! -f ${v_f_env} ]; then echo "env file does not exist : $v_f_env" exit -1 fi # 加载配置信息 source ${g_f_util_properties} "load" ${v_f_settings} # 检查安装目录是否存在 if [ ! -n "$install_dir" ] || [ ! -d ${install_dir} ]; then echo "installation directory does not exist : $install_dir" exit -1 fi # 检查安装包是否存在 if [ ! -n "$install_file" ] || [ ! -f ${install_file} ]; then echo "installation file does not exist : $install_file" exit -1 fi # 解压安装包到安装目录 tar -zxf ${install_file} -C ${install_dir} # 建立软连接 v_d_home=${install_dir}/jdk ln -fs ${install_dir}/jdk* ${v_d_home} # 设置环境变量 \cp ${v_f_env} ${v_f_profile} ${g_f_util_replace} -s "$v_f_env" -t "$v_f_profile" HOME=${v_d_home} source /etc/profile echo "PATH : $PATH" echo "JAVA_HOME : $JAVA_HOME" echo "CLASSPATH : $CLASSPATH" java -version exit -1 ``` ### Maven ``` #!/bin/bash echo "+++++++++++++++++++++++ $(cd `dirname $0`; pwd)/$(basename $0) +++++++++++++++++++++++++" # 当前脚本所在目录 v_d_current=$(cd `dirname $0`; pwd) # 当前脚本的配置信息 v_f_settings=${v_d_current}/settings # 当前脚本的环境变量配置 v_env_filename=`ls ${v_d_current} | grep env.sh` v_f_env=${v_d_current}/${v_env_filename} # 环境变量文件 v_f_profile=${g_d_profile}/${v_env_filename} # 检查配置文件是否存在 if [ ! -f ${v_f_settings} ]; then echo "settings file does not exist : $v_f_settings" exit -1 fi # 加载配置信息 source ${g_f_util_properties} "load" ${v_f_settings} # 检查环境变量文件是否存在 if [ ! -f ${v_f_env} ]; then echo "env file does not exist : $v_f_env" exit -1 fi # 检查安装目录是否存在 if [ ! -n "$install_dir" ] || [ ! -d ${install_dir} ]; then echo "installation directory does not exist : $install_dir" exit -1 fi # 检查安装包是否存在 if [ ! -n "$install_file" ] || [ ! -f ${install_file} ]; then echo "installation file does not exist : $install_file" exit -1 fi # 解压安装包到安装目录 tar -zxf ${install_file} -C ${install_dir} # 建立软连接 v_d_home=${install_dir}/maven ln -fs ${install_dir}/apache-maven* ${v_d_home} # 设置环境变量 \cp ${v_f_env} ${v_f_profile} ${g_f_util_replace} -s "$v_f_env" -t "$v_f_profile" HOME=${v_d_home} source /etc/profile echo "PATH : $PATH" echo "M2_HOME : $M2_HOME" mvn -version exit -1 ``` ### Jenkins(war包格式,用Tomcat部署) ``` #!/bin/bash echo "+++++++++++++++++++++++ $(cd `dirname $0`; pwd)/$(basename $0) +++++++++++++++++++++++++" # 当前脚本所在目录 v_d_current=$(cd `dirname $0`; pwd) # 当前脚本的配置信息 v_f_settings=${v_d_current}/settings # 当前脚本的环境变量配置 v_env_filename=`ls ${v_d_current} | grep env.sh` v_f_env=${v_d_current}/${v_env_filename} v_f_server_config=${v_d_current}/tomcat-server.xml v_f_service_config=${v_d_current}/tomcat-service # 环境变量文件 v_f_profile=${g_d_profile}/${v_env_filename} # 检查配置文件是否存在 if [ ! -f ${v_f_settings} ]; then echo "settings file does not exist : $v_f_settings" exit -1 fi # 加载配置信息 source ${g_f_util_properties} "load" ${v_f_settings} # 检查环境变量文件是否存在 if [ ! -f ${v_f_env} ]; then echo "env file does not exist : $v_f_env" exit -1 fi # 检查安装目录是否存在 if [ ! -n "$install_dir" ] || [ ! -d ${install_dir} ]; then echo "installation directory does not exist : $install_dir" exit -1 fi # 检查安装包是否存在 if [ ! -n "$install_file" ] || [ ! -f ${install_file} ]; then echo "installation file does not exist : $install_file" exit -1 fi # 检查服务安装包是否存在 if [ ! -n "$server_file" ] || [ ! -f ${server_file} ]; then echo "installation file does not exist : $server_file" exit -1 fi # apache-tomcat-7.0.62.tar.gz -> /opt/jenkins tar -zxf ${server_file} -C ${install_dir} # tomcat-server.xml -> tomcat/conf/server.xml cd ${install_dir}/*tomcat* v_d_server=`pwd` \cp ${v_d_current}/tomcat-server.xml ${v_d_server}/conf/server.xml # find tomcat/webapps v_d_deploy=${v_d_server}/webapps if [ ! -d ${v_d_deploy} ]; then echo "deploy directory does not exist : $v_d_deploy" exit -1 fi # jenkins.war -> tomcat/webapps/ \cp ${install_file} ${v_d_deploy} # 设置环境变量 \cp ${v_f_env} ${v_f_profile} ${g_f_util_replace} -s "$v_f_env" -t "$v_f_profile" HOME=${install_dir} # 设置开机启动 v_service="jenkins" v_f_service="/etc/init.d/$v_service" touch "$v_f_service" ${g_f_util_replace} -s "$v_f_service_config" -t "$v_f_service" HOME=${v_d_server} chmod 755 "$v_f_service" chown root "$v_f_service" chkconfig --add "$v_service" chkconfig --levels 345 "$v_service" on source /etc/profile echo "PATH : $PATH" echo "JENKINS_HOME : $JENKINS_HOME" chkconfig --list | grep "$v_service" exit -1 ``` ### Nexus ``` #!/bin/bash echo "+++++++++++++++++++++++ $(cd `dirname $0`; pwd)/$(basename $0) +++++++++++++++++++++++++" # 当前脚本所在目录 v_d_current=$(cd `dirname $0`; pwd) # 当前脚本的配置信息 v_f_settings=${v_d_current}/settings # 当前脚本的环境变量配置 v_env_filename=`ls ${v_d_current} | grep env.sh` v_f_env=${v_d_current}/${v_env_filename} # 环境变量文件 v_f_profile=${g_d_profile}/${v_env_filename} # 检查配置文件是否存在 if [ ! -f ${v_f_settings} ]; then echo "settings file does not exist : $v_f_settings" exit -1 fi # 加载配置信息 source ${g_f_util_properties} "load" ${v_f_settings} # 检查环境变量文件是否存在 if [ ! -f ${v_f_env} ]; then echo "env file does not exist : $v_f_env" exit -1 fi # 检查安装目录是否存在 if [ ! -n "$install_dir" ] || [ ! -d ${install_dir} ]; then echo "installation directory does not exist : $install_dir" exit -1 fi # 检查安装包是否存在 if [ ! -n "$install_file" ] || [ ! -f ${install_file} ]; then echo "installation file does not exist : $install_file" exit -1 fi # 解压安装包到安装目录 tar -zxf ${install_file} -C ${install_dir} # nexus.properties 配置 \cp ${v_d_current}/nexus.properties ${install_dir}/nexus-*/conf/nexus.properties # 建立软连接 v_d_home=${install_dir}/nexus ln -fs ${v_d_home}-* ${v_d_home} # 设置环境变量 \cp ${v_f_env} ${v_f_profile} ${g_f_util_replace} -s "$v_f_env" -t "$v_f_profile" HOME=${v_d_home} # 设置开机启动 v_f_service_config=${v_d_current}/nexus-service v_service="nexus" v_f_service="/etc/init.d/$v_service" touch "$v_f_service" ${g_f_util_replace} -s "$v_f_service_config" -t "$v_f_service" HOME=${v_d_home} chmod 755 "$v_f_service" chown root "$v_f_service" chkconfig --add "$v_service" chkconfig --levels 345 "$v_service" on source /etc/profile echo "PATH : $PATH" echo "NEXUS_HOME : $NEXUS_HOME" chkconfig --list | grep "$v_service" exit -1 ``` ### dubbo-admin ``` #!/bin/bash echo "+++++++++++++++++++++++ $(cd `dirname $0`; pwd)/$(basename $0) +++++++++++++++++++++++++" # 当前脚本所在目录 v_d_current=$(cd `dirname $0`; pwd) # 当前脚本的配置信息 v_f_settings=${v_d_current}/settings v_f_server_config=${v_d_current}/tomcat-server.xml v_f_service_config=${v_d_current}/tomcat-service # 检查配置文件是否存在 if [ ! -f ${v_f_settings} ]; then echo "settings file does not exist : $v_f_settings" exit -1 fi # 加载配置信息 source ${g_f_util_properties} "load" ${v_f_settings} # 检查安装目录是否存在 if [ ! -n "$install_dir" ] || [ ! -d ${install_dir} ]; then echo "installation directory does not exist : $install_dir" exit -1 fi # 检查安装包是否存在 if [ ! -n "$install_file" ] || [ ! -f ${install_file} ]; then echo "installation file does not exist : $install_file" exit -1 fi # 检查服务安装包是否存在 if [ ! -n "$server_file" ] || [ ! -f ${server_file} ]; then echo "installation file does not exist : $server_file" exit -1 fi # apache-tomcat-7.0.62.tar.gz -> /opt/jenkins tar -zxf ${server_file} -C ${install_dir} # tomcat-server.xml -> tomcat/conf/server.xml cd ${install_dir}/*tomcat* v_d_server=`pwd` \cp ${v_d_current}/tomcat-server.xml ${v_d_server}/conf/server.xml # find tomcat/webapps v_d_deploy=${v_d_server}/webapps if [ ! -d ${v_d_deploy} ]; then echo "deploy directory does not exist : $v_d_deploy" exit -1 fi # war -> tomcat/webapps/ \cp ${install_file} ${v_d_deploy} mv -f ${v_d_deploy}/dubbo-admin-*.war ${v_d_deploy}/dubbo-admin.war # 设置开机启动 v_service="dubbo-admin" v_f_service="/etc/init.d/$v_service" touch "$v_f_service" ${g_f_util_replace} -s "$v_f_service_config" -t "$v_f_service" HOME=${v_d_server} chmod 755 "$v_f_service" chown root "$v_f_service" chkconfig --add "$v_service" chkconfig --levels 345 "$v_service" on source /etc/profile chkconfig --list | grep "$v_service" exit -1 ``` ### Zookeeper ``` #!/bin/bash echo "+++++++++++++++++++++++ $(cd `dirname $0`; pwd)/$(basename $0) +++++++++++++++++++++++++" # 当前脚本所在目录 v_d_current=$(cd `dirname $0`; pwd) # 当前脚本的配置信息 v_f_settings=${v_d_current}/settings # 检查配置文件是否存在 if [ ! -f ${v_f_settings} ]; then echo "settings file does not exist : $v_f_settings" exit -1 fi # 加载配置信息 source ${g_f_util_properties} "load" ${v_f_settings} # 检查安装目录是否存在 if [ ! -n "$install_dir" ] || [ ! -d ${install_dir} ]; then echo "installation directory does not exist : $install_dir" exit -1 fi # 检查安装包是否存在 if [ ! -n "$install_file" ] || [ ! -f ${install_file} ]; then echo "installation file does not exist : $install_file" exit -1 fi # 解压安装包到安装目录 tar -zxf ${install_file} -C ${install_dir} cd ${install_dir}/zookeeper* v_d_home=`pwd` v_d_data=${v_d_home}/data v_d_dataLog=${v_d_home}/dataLog mkdir -p ${v_d_data} ${v_d_dataLog} echo 1 > ${v_d_data}/myid # zoo.cfg \cp ${v_d_current}/zoo.cfg ${v_d_home}/conf ${g_f_util_replace} -s ${v_d_current}/zoo.cfg -t ${v_d_home}/conf/zoo.cfg dataDir=${v_d_data} dataLogDir=${v_d_dataLog} # 设置开机启动 v_f_service_config=${v_d_current}/zookeeper-service v_service="zookeeper" v_f_service="/etc/init.d/$v_service" touch "$v_f_service" ${g_f_util_replace} -s "$v_f_service_config" -t "$v_f_service" HOME=${v_d_home} chmod 755 "$v_f_service" chown root "$v_f_service" chkconfig --add "$v_service" chkconfig --levels 345 "$v_service" on source /etc/profile chkconfig --list | grep "$v_service" exit -1 ```