1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
| #!/bin/bash
#!/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 '--Updating yum...'
(
yum -y install wget expect
wget -P /tmp
expect << EOF
spawn sh /tmp/atomic
expect "(yes/no)"
send "yes\n"
expect eof
exit
EOF
yum clean all
yum makecache
) &> /dev/null && echo 'Completed!' || exit
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!'
|