您现在的位置: 首页 > 服务器 > Web服务器 > 正文

Centos7 用yum命令安装LAMP环境(php+Apache+Mysql)以及php扩展

作者:admin来源:网络浏览:时间:2017-03-20 22:33:49我要评论
分享到
1、yum -y update    // 更新系统

 

2、安装mysql

    2.1)yum -y install mariadb-client mariadb-server mariadb-devel

    2.2)启动:systemctl start mariadb.service

    2.3)设置开机自启:systemctl enable mariadb

    2.4)设置root密码:mysqladmin -u root password "123456"

    2.5)设置root远程访问:登录mysql => use mysql; => update user set host='%' where user='root' and host='localhost'; => flush privileges; => exit; => systemctl restart mariadb.service

 

3、安装apache

    3.1)yum -y install httpd

    3.2)启动:systemctl start httpd.service

    3.3)设置开机自启:systemctl enable httpd

    3.4)配置虚拟主机:在/etc/httpd/conf.d/目录下建新vhost.conf,新增内容:

        <VirtualHost *:80>
            DocumentRoot "/var/www/html/CodeIgniter-3.1.2/"
            ServerName www.100ci.com
            ErrorLog "/var/log/httpd/100ci-error.log"
            CustomLog "/var/log/httpd/100ci-access.log" common
       </VirtualHost>

 

4、安装php7

    4.1)请参考 https://webtatic.com/packages/php70/

    4.2)rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

    4.3)rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 

    4.4) yum -y install php70w php70w-opcache php70w-common php70w-fpm php70w-mbstring php70w-mysql

    4.5)安装完php,重启httpd,systemctl restart httpd

 

5、安装phpredis扩展

    5.1)yum -y install redis php-redis

    5.2)重启httpd,systemctl restart httpd

 

6、部署成功

    Centos7 用yum命令安装LAMP环境(php+Apache+Mysql)以及php扩展

相关热词搜索: