声明
作者:昨夜星辰
博客:http://yestreenstars.blog.51cto.com/
本文由本人创作,如需转载,请注明出处,谢谢合作!
目的
用系统自带的yum源安装LAMP。
环境
OS:CentOS 6.6 32
服务端配置
#!/bin/bash # Script Name: One-key Automatic Install LAMP Server # Author: yestreenstars # Create Time: 2014-12-30 # Update Time: 2014-12-30 DOMAIN_NAME=‘www.example.com‘ # You can change this. MYSQL_ROOT_PASSWORD=‘mypassword‘ # You can change this. echo -n ‘--Stopping iptables and SELinux...‘ ( service iptables stop chkconfig iptables off setenforce 0 [ -f /etc/selinux/config ] && sed -i ‘/^SELINUX=/s/=.*/=disabled/‘ /etc/selinux/config ) &> /dev/null && echo ‘Completed!‘ || exit echo -n ‘--Installing Apache...‘ ( yum -y install httpd sed -ri ‘s/^#(ServerName).*/\1 ‘$DOMAIN_NAME‘:80/‘ /etc/httpd/conf/httpd.conf sed -i ‘/^DirectoryIndex/s/$/ index.php/‘ /etc/httpd/conf/httpd.conf service httpd start chkconfig httpd on ) &> /dev/null && echo ‘Completed!‘ || exit echo -n ‘--Installing MySQL...‘ ( yum -y install mysql-server /bin/cp -f /usr/share/mysql/my-medium.cnf /etc/my.cnf service mysqld start chkconfig mysqld on mysqladmin -uroot password $MYSQL_ROOT_PASSWORD ) &> /dev/null && echo ‘Completed!‘ || exit echo -n ‘--Installing PHP...‘ ( yum -y install php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt sed -i ‘/^short_open_tag/s/=.*/= On/‘ /etc/php.ini sed -i ‘/^;date.timezone/s/$/ Asia\/Shanghai/‘ /etc/php.ini sed -i ‘/^error_reporting/s/=.*/= E_ALL \& ~E_NOTICE/‘ /etc/php.ini service httpd restart ) &> /dev/null && echo ‘Completed!‘ || exit echo ‘Completed!‘
时间: 2024-10-10 06:15:03