码迷,mamicode.com
首页 > 其他好文 > 详细

华为云主机CentOS 7.3安装LAMP

时间:2017-08-05 14:11:04      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:lamp

准备工作

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

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

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

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

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

配置华为云主机

技术分享

效果测试

vi /usr/local/apache2.4/htdocs/index.php
    <?php
    phpinfo();
    ?>
/usr/local/apache2.4/bin/apachectl graceful

技术分享


本文出自 “Gorilla Grodd” 博客,请务必保留此出处http://juispan.blog.51cto.com/943137/1953771

华为云主机CentOS 7.3安装LAMP

标签:lamp

原文地址:http://juispan.blog.51cto.com/943137/1953771

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!