自动部署LAMP环境脚本
2011-09-05 10:18
459 查看
在工作中经常会遇到许多的测试要求,测试环境一般都要求有lamp环境,或者单独要求mysql,apache;最近因为工作需要对extmail进行测试,测试环境需要lamp结构,因而抽空修改了下之前的脚本,将脚本整合成lamp.sh,可以单独来安装apache或者mysql,也可以集成lamp环境!注意:使用该脚本编译php前需要先编译好apache和mysql,脚本包含在附件中…
[root@orcl ~]# sh lamp.sh
Usage:lamp.sh {parpare|apache|php|mysql|lamp}
一:准备环境
为了节约脚本运行时间,每次可以在运行parpare之后,将软件源码包上传到/usr/local/src/tarbag目录,避免脚本自动下载源码包
二:测试编译php
三:测试编译apache
四:编译mysql
五:正常编译php
本文出自 “斩月” 博客,谢绝转载!
[root@orcl ~]# sh lamp.sh
Usage:lamp.sh {parpare|apache|php|mysql|lamp}
一:准备环境
[root@orcl ~]# sh lamp.sh parpare parparing enviroment.... setenforce: SELinux is disabled Loaded plugins: rhnplugin, security Package flex-2.5.4a-41.fc6.i386 already installed and latest version Package gcc-4.1.2-46.el5.i386 already installed and latest version ………………………………………………………………输出省略……………………………………………………………………………………………… Package libusb-devel-0.1.12-5.1.i386 already installed and latest version Package newt-devel-0.52.2-12.el5.i386 already installed and latest version Package 1:libvorbis-devel-1.1.2-3.el5_3.3.i386 already installed and latest version No packages in any requested group available to install or update Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. Setting up Install Process Package 2:libpng-devel-1.2.10-7.1.el5_3.2.i386 already installed and latest version Package libjpeg-devel-6b-37.i386 already installed and latest version Package freetype-devel-2.2.1-21.el5_3.i386 already installed and latest version Nothing to do parparing enviroment successful...
为了节约脚本运行时间,每次可以在运行parpare之后,将软件源码包上传到/usr/local/src/tarbag目录,避免脚本自动下载源码包
二:测试编译php
[root@orcl ~]# sh lamp.sh php Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. Setting up Remove Process No Match for argument: php Package(s) php available, but not installed. No Packages marked for removal Download and compile php... your must compile mysql-server first...
三:测试编译apache
[root@orcl ~]# sh lamp.sh apache Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. Setting up Remove Process No Match for argument: httpd Package(s) httpd available, but not installed. No Packages marked for removal download and install apache_2.2.16..... Download httpd... --2011-09-05 09:34:23-- http://archive.apache.org/dist/httpd/httpd-2.2.16.tar.gz Resolving archive.apache.org... 140.211.11.131 Connecting to archive.apache.org|140.211.11.131|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 6369022 (6.1M) [application/x-gzip] Saving to: `/usr/local/src/tarbag/httpd-2.2.16.tar.gz' 100%[========================================================================>] 6,369,022 193K/s in 32s 2011-09-05 09:34:56 (193 KB/s) - `/usr/local/src/tarbag/httpd-2.2.16.tar.gz' saved [6369022/6369022] apache install complete done ... Configure apache... [root@orcl ~]# ls /usr/local/apache2.2.16/ bin build cgi-bin conf error htdocs icons include lib logs man manual modules
四:编译mysql
[root@orcl ~]# sh lamp.sh mysql Setting Environment variables... Creating data directory... Download and install mysql... ………………………输出省略………………………………… Mysql install complete done... Initialization mysql... Modify mysql-server main parameter file... Initialization mysql complete done... [root@orcl ~]# ls /usr/local/mysql/ bin docs include lib libexec mysql-test share sql-bench [root@orcl ~]# ls /mydata/ aclocal mysql mysql-bin.000001 mysql-bin.000002 mysql-bin.index test [root@orcl ~]# service mysqld restart MySQL manager or server PID file could not be found![FAILED] Starting MySQL.[ OK ] [root@orcl ~]# /usr/local/mysql/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.1.36-log Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
五:正常编译php
[root@orcl ~]# sh lamp.sh php Loaded plugins: rhnplugin, security This system is not registered with RHN. RHN support will be disabled. Setting up Remove Process No Match for argument: php Package(s) php available, but not installed. No Packages marked for removal Download and compile php... ………………………输出省略………………………………… php install complete done ... Start Apache with php support OK... [root@orcl ~]# /usr/local/apache2.2.16/bin/apachectl -t -D DUMP_MODULES |grep php Syntax OK php5_module (shared) [root@orcl ~]# ls /usr/local/php5.2.13/ bin etc include lib man [root@orcl ~]# /usr/local/php5.2.13/bin/php -i |grep configure Configure Command => './configure' '--prefix=/usr/local/php5.2.13' '--with-config-file-path=/usr/local/php5.2.13/etc' '--with-apxs2=/usr/local/apache2.2.16/bin/apxs' '--with-bz2' '--with-curl' '--with-curlwrappers' '--enable-ftp' '--enable-sockets' '--disable-ipv6' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-freetype-dir=/usr/local' '--enable-gd-native-ttf' '--with-iconv-dir=/usr/local' '--enable-mbstring' '--enable-calendar' '--with-gettext' '--with-libxml-dir=/usr/local' '--with-zlib' '--enable-zend-multibyte' '--with-pdo-mysql=/usr/local/mysql' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-mysql=/usr/local/mysql' '--enable-dom' '--with-ldap' '--enable-xml' [root@orcl ~]# netstat -ntpl |grep :80 tcp 0 0 :::80 :::* LISTEN 20705/httpd
本文出自 “斩月” 博客,谢绝转载!
相关文章推荐
- 阿里云 持续集成环境自动部署cordova项目热更新脚本
- 通过ssh主机互信打通内、外网,使用shell脚本自动部署测试环境
- 用python脚本实现自动部署环境(二)
- 【自动构建系列】自动部署环境的shell脚本
- Java web项目在linux环境下自动编译和部署脚本
- 单台服务器LAMP环境自动搭建脚本
- 服务器环境之6:使用maven自动部署到tomcat及编写sh一键部署脚本
- 用python脚本实现自动部署环境(一)
- Shell脚本自动部署(编译)LAMP平台
- tomcat+jenks环境自动部署脚本
- lamp环境加glusterfs存储集群自动化监控自动修复python脚本
- 【自动构建系列】自动部署环境的shell脚本
- ansible集中化自动管理(部署LAMP环境)
- 打造jenkins+docker+nodejs项目的自动部署环境(webhook)
- Linux系统下tomcat自动拉取代码打包发布的配置部署和脚本编写(转朋友)
- LINUX 下LAMP之yum方法部署环境
- nagios基于客户端环境自动修改nrpe.cfg脚本
- CentOS自动安装LAMP及环境简易配置
- 使用Ansible部署LAMP环境
- PXE项目实战,通过编写脚本自动安装系统时批量部署服务器所需要的所有服务