华为云主机CentOS 7.3安装LAMP

前端之家收集整理的这篇文章主要介绍了华为云主机CentOS 7.3安装LAMP前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

准备工作

cd/usr/local/src
wgethttp://mirrors.sohu.com/MysqL/MysqL-5.6/MysqL-5.6.35-linux-glibc2.5-x86_64.tar.gz
wgethttp://mirrors.cnnic.cn/apache/httpd/httpd-2.4.27.tar.gz
wgethttp://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
wgethttp://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.gz
wgethttp://cn2.PHP.net/distributions/PHP-5.6.30.tar.gz
tarzxfMysqL-5.6.35-linux-glibc2.5-x86_64.tar.gz
tarzxfapr-1.5.2.tar.gz
tarzxfapr-util-1.5.4.tar.gz
tarzxfhttpd-2.4.27.tar.gz
tarzxfPHP-5.6.30.tar.gz

软件安装

MysqL

mvMysqL-5.6.35-linux-glibc2.5-x86_64/usr/local/MysqL
cd../MysqL/
useraddMysqL
mkdir/data/
yuminstall-yperlperl-Data-Dumperlibaiolibaio-devel
./scripts/MysqL_install_db--user=MysqL--datadir=/data/MysqL
cpsupport-files/my-default.cnf/etc/my.cnf
cpsupport-files/MysqL.server/etc/init.d/MysqLd
vi/etc/init.d/MysqLd
basedir=/usr/local/MysqL
datadir=/data/MysqL
chkconfig--addMysqLd
serviceMysqLdstart

Apache

wgethttp://vault.centos.org/5.7/os/x86_64/CentOS/kernel-headers-2.6.18-274.el5.x86_64.rpm
rpm-ivhkernel-headers-2.6.18-274.el5.x86_64.rpm
yuminstall-ygccpcre-devel
cd/usr/local/src/apr-1.5.2
./configure--prefix=/usr/local/apr
make&&makeinstall
cd/usr/local/src/apr-util-1.5.4
./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr
make&&makeinstall
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&&makeinstall
/usr/local/apache2.4/bin/httpd-kstart

PHP

yuminstall-ylibxml2-developenssl-develbzip2-devellibjpeg-turbo-devellibpng-develfreetype-devellibmcrypt-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&&makeinstall
cpPHP.ini-production/usr/local/PHP/etc/PHP.ini

配置LAMP

vi/usr/local/apache2.4/conf/httpd.conf
ServerNamewww.example.com:80
<Directory/>
AllowOverridenone
Requireallgranted
</Directory>
<IfModuledir_module>
DirectoryIndexindex.htmlindex.PHP
</IfModule>
AddTypeapplication/x-httpd-PHP.PHP
iptables-IINPUT-ptcp--dport80-jACCEPT

配置华为云主机

wKiom1mFNPXjbYowAADiuk7Lm-k180.png

效果测试

vi/usr/local/apache2.4/htdocs/index.PHP
<?PHP
PHPinfo();
?>
/usr/local/apache2.4/bin/apachectlgraceful

wKiom1mFNkPh23tdAADN2xfNXZg664.png-wh_50

原文链接:https://www.f2er.com/centos/376466.html

猜你在找的CentOS相关文章