首页 > 代码库 > 华为云主机CentOS 7.3安装LAMP
华为云主机CentOS 7.3安装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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。