shell脚本实现自动编译安装
来源:互联网 发布:淘宝店客服招聘 编辑:程序博客网 时间:2024/06/05 09:11
写了个脚本实现许多安装包的自动配置,编译,安装,脚本很简单,关键是我用的时候有个小问题,所以贴出来。
脚本如下:
#!/bin/sh
#install need root user.
if [ "whoami" != "root"];then
echo "Installtion this package needs root user."
exit 1
fi
#file exist problem
if [ ! -a /opt/work/libxml2.tar.gz ];then
echo "The sources of libxml2 is not exist."
exit
fi
tar xzvf /opt/work/libxml2.tar.gz
#test tar right or not
if [ ! -d /opt/work/libxml2 ];then
echo "The tar file is not uncompressed."
exit
fi
#into the directory
cd /opt/work/libxml2
/opt/work/libxml2/configure --prefix=/usr/local
make&make install
#into the root directory
cd /
脚本已经结束,可以执行,但是执行的时候不能以./filename.sh的格式,而是必须以source filename.sh的格式来运行,否则在cd /opt/work/libxml2的时候会进不去,当然接下的脚本执行就会错误了!--这是我犯错的地方。
如果你要编译安装很多tar包,在linux下,依赖关系复杂,很常见,你可以用这种方法,自动安装,省去不少麻烦!
- shell脚本实现自动编译安装
- Shell脚本实现应用自动安装部署
- shell脚本 自动安装
- mysql 自动 安装 shell脚本
- Shell脚本实现自动登录
- SHELL实现CentOS6,Ubuntu16下自动下载,编译安装LAMP
- Maven 自动打包编译的shell脚本
- .net2003自动编译脚本实现
- ant脚本实现自动编译
- shell脚本实现自动创建模拟器、启动模拟器、自动安装apk并进行monkey测试
- CentOS6.7下使用非root用户(普通用户)编译安装与配置mysql数据库并使用shell脚本定时任务方式实现mysql数据库服务随机自动启动
- Shell脚本实现自动化安装
- Linux自动安装JDK的shell脚本
- RHEL自动安装zookeeper的shell脚本
- shell脚本_自动安装mysql
- 自动安装LNMP的简洁Shell脚本
- Shell脚本 centOS7中自动安装JDK
- Shell脚本 centOS7中自动安装Tomcat7
- C# 为TextBox增加SelectText改变事件
- Vista恢复原主题
- Ruby on rails开发从头来(windows)(四)-第一个添删查改例子
- 隐形Kerio
- qt串口编程
- shell脚本实现自动编译安装
- 未来五年程序员应当具备的十项技能
- 应对异常网络流量,安全管理加网络管理,企业网络安全的精髓
- 打开Vista IIS7信息服务
- squid不缓存指定url和网站
- Oracle数据库的启动和关闭过程
- C++经典面试题之---String类
- VirtualBox VM won't start after kernal upgrade
- Java的ClassLoader与Package机制