Ubuntu系统编写shell脚本程序一次安装多个软件包

Ubuntu系统编写shell脚本程序一次安装多个软件包


编写shell脚本程序一次安装多个软件,主要用于一些软件依赖环境配置。

1、shell脚本程序必须以下面的行开始(必须方在文件的第一行):

  #!/bin/sh

 

符号#!用来告诉系统它后面的参数是用来执行该文件的程序。在这个例子中我们使用/bin/sh来执行程序。

2、当编辑好脚本后,还必须使其可执行。

使脚本可执行:

  chmod +x filename

3、然后,您可以通过输入: ./filename 来执行您的脚本。


如下:

下面是我安装Oracle11g之前,安装Oracle11g依赖的多个软件包:

1、在vi中编辑如下文件

#!/bin/sh

sudo apt-get install automake -y
sudo apt-get install autotools-dev -y
sudo apt-get install binutils -y
sudo apt-get install bzip2 -y
sudo apt-get install elfutils -y
sudo apt-get install expat -y
sudo apt-get install gawk -y
sudo apt-get install gcc -y
sudo apt-get install gcc-multilib -y
sudo apt-get install g++-multilib -y
sudo apt-get install ia32-libs -y
sudo apt-get install ksh -y
sudo apt-get install less -y
sudo apt-get install lesstif2 -y
sudo apt-get install lesstif2-dev -y
sudo apt-get install lib32z1 -y
sudo apt-get install libaio1 -y
sudo apt-get install libaio-dev -y
sudo apt-get install libc6-dev -y
sudo apt-get install libc6-dev-i386 -y
sudo apt-get install libc6-i386 -y
sudo apt-get install libelf-dev -y
sudo apt-get install libltdl-dev -y
sudo apt-get install libmotif4 -y
sudo apt-get install libodbcinstq4-1 libodbcinstq4-1:i386 -y
sudo apt-get install libpth-dev -y
sudo apt-get install libpthread-stubs0 -y
sudo apt-get install libpthread-stubs0-dev -y
sudo apt-get install libstdc++5 -y
sudo apt-get install lsb-cxx -y
sudo apt-get install make -y
sudo apt-get install openssh-server -y
sudo apt-get install pdksh -y
sudo apt-get install rlwrap -y
sudo apt-get install rpm -y
sudo apt-get install sysstat -y
sudo apt-get install unixodbc -y
sudo apt-get install unixodbc-dev -y
sudo apt-get install unzip -y
sudo apt-get install x11-utils -y
sudo apt-get install zlibc -y

:wq orasetup      #(注释)保存为以orasetup为名字的文件


2、终端中编译: chmod +x orasetup 

3、运行安装,终端中输入: ./orasetup

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值