这是企业中常用的方法
比如一台服务器准备好了,公司必然要安装一些应用
这时可以用这种方法批量安装应用
运行一条命令,服务器就会自己去连接软件仓库,去下载来安装。
[root@webmaster html]# lltotal 2680-rw-r--r-- 1 root root ????788 Sep 13 17:40 update_zabbix_agent.sh-rw-r--r-- 1 root root 2737299 Sep 13 14:56 zabbix_agent.zip#一个开启autoindex的nginx#创建一个安装软件的脚本
使用者可以通过网页查看相关内容
[root@webmaster html]# cat update_zabbix_agent.sh #!/bin/shcd /appif [ -e "/app/zabbix_agent.zip" ]then ???sleep 5 ???echo ‘1‘ ???rm -f /app/zabbix_agent.zipfiif [ -d "/app/zabbix" ]then ???rm -fr /app/zabbixfiwget --tries=2 http://192.168.10.10/zabbix_agent.zip >>/tmp/update.`date +%Y%m%d-%H`.log#update zabbix agentecho ‘-------------------------‘unzip ?zabbix_agent.zip >/dev/null && echo "zabbix directory downloaded sucessfully"cd zabbix./sbin/zabbix_agentd -c etc/zabbix_agentd.conf >>/tmp/update.zabbix.`date +%Y%m%d-%H`.logif [ $? == 0 ]then ???echo "zabbix agent update success" ???echo "zabbix agent update success" >>/tmp/update.`date +%Y%m%d-%H`.logelse ???echo "zabbix agent update failed" ???echo "zabbix agent update failed" >>/tmp/update.`date +%Y%m%d-%H`.logfi
[root@mysql app]# wget -O update_zabbix_agent.sh ?http://192.168.10.10/update_zabbix_agent.sh;sh update_zabbix_agent.sh--2018-09-14 01:39:38-- ?http://192.168.10.10/update_zabbix_agent.shConnecting to 192.168.10.10:80... connected.HTTP request sent, awaiting response... 200 OKLength: 788 [application/octet-stream]Saving to: ‘update_zabbix_agent.sh’100%[================================================================================================>] 788 ????????--.-K/s ??in 0s ?????2018-09-14 01:39:38 (63.3 MB/s) - ‘update_zabbix_agent.sh’ saved [788/788]1--2018-09-14 01:39:43-- ?http://192.168.10.10/zabbix_agent.zipConnecting to 192.168.10.10:80... connected.HTTP request sent, awaiting response... 200 OKLength: 2737299 (2.6M) [application/zip]Saving to: ‘zabbix_agent.zip’100%[================================================================================================>] 2,737,299 ??--.-K/s ??in 0.02s ??2018-09-14 01:39:43 (112 MB/s) - ‘zabbix_agent.zip’ saved [2737299/2737299]-------------------------zabbix directory downloaded sucessfullyzabbix agent update success-------------------------#在服务器上wget这个脚本并执行
基于http的软件仓库
原文地址:https://www.cnblogs.com/jabbok/p/9642020.html