准备工作
1
2
3
4
5
6
7
8
9
10
11
|
cd /usr/local/src
wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
tar zxf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
tar zxf apr-1.5.2.tar.gz
tar zxf apr-util-1.5.4.tar.gz
tar zxf httpd-2.4.27.tar.gz
tar zxf php-5.6.30.tar.gz
|
软件安装
MySQL
1
2
3
4
5
6
7
8
9
10
11
12
13
|
mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
cd ../mysql/
useradd mysql
mkdir /data/
yum install -y perl perl-Data-Dumper libaio libaio-devel
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
vi /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
chkconfig --add mysqld
service mysqld start
|
Apache
1
2
3
4
5
6
7
8
9
10
11
12
13
|
wget http://vault.centos.org/5.7/os/x86_64/CentOS/kernel-headers-2.6.18-274.el5.x86_64.rpm
rpm -ivh kernel-headers-2.6.18-274.el5.x86_64.rpm
yum install -y gcc pcre-devel
cd /usr/local/src/apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install
cd /usr/local/src/apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
cd /usr/local/src/httpd-2.4.27
./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
make && make install
/usr/local/apache2.4/bin/httpd -k start
|
PHP
1
2
3
4
5
|
yum install -y libxml2-devel openssl-devel bzip2-devel libjpeg-turbo-devel libpng-devel freetype-devel libmcrypt-devel
cd /usr/local/src/php-5.6.30
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
make &&make install
cp php.ini-production /usr/local/php/etc/php.ini
|
配置LAMP
1
2
3
4
5
6
7
8
9
10
11
|
vi /usr/local/apache2.4/conf/httpd.conf
ServerName www.example.com:80
<Directory />
AllowOverride none
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
AddType application/x-httpd-php .php
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
|
配置华为云主机
效果测试
1
2
3
4
5
|
vi /usr/local/apache2.4/htdocs/index.php
<?php
phpinfo();
?>
/usr/local/apache2.4/bin/apachectl graceful
|
本文转自Grodd51CTO博客,原文链接:http://blog.51cto.com/juispan/1953771,如需转载请自行联系原作者