轻松了解各种云产品、服务及动态、提供各种云服务。

Centos7搭建LNMP环境

129
文章目录
  1. centos7 上php7.0安装
  2. centos7 上nginx安装
  3. centos7 上MySQL5.7安装
  4. 更多内容请关注公众号

centos7 上php7.0安装

1. 安装源

    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2. 安装php7.0

    yum search php70
yum install -y php70w.x86_64 php70w-bcmath.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-dba.x86_64 php70w-devel.x86_64 php70w-embedded.x86_64 php70w-enchant.x86_64 php70w-fpm.x86_64 php70w-gd.x86_64 php70w-imap.x86_64 php70w-interbase.x86_64 php70w-intl.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64  php70w-mysqlnd.x86_64 php70w-odbc.x86_64 php70w-opcache.x86_64 php70w-pdo.x86_64 php70w-pdo_dblib.x86_64 php70w-pear.noarch php70w-pecl-apcu.x86_64 php70w-pecl-apcu-devel.x86_64 php70w-pecl-geoip.x86_64 php70w-pecl-igbinary.x86_64 php70w-pecl-igbinary-devel.x86_64 php70w-pecl-imagick.x86_64 php70w-pecl-imagick-devel.x86_64 php70w-pecl-libsodium.x86_64 php70w-pecl-memcached.x86_64 php70w-pecl-mongodb.x86_64 php70w-pecl-redis.x86_64 php70w-pecl-xdebug.x86_64 php70w-pgsql.x86_64 php70w-phpdbg.x86_64 php70w-process.x86_64 php70w-pspell.x86_64 php70w-recode.x86_64 php70w-snmp.x86_64 php70w-soap.x86_64 php70w-tidy.x86_64 php70w-xml.x86_64 php70w-xmlrpc.x86_64

3. 设置php-fpm的用户和用户组为nginx

    vim /etc/php-fpm.d/www.conf : user = nginx group = nginx

4. 启动php-fpm

service php-fpm start

5. 设置开机自启动

    systemctl enable php-fpm.service

centos7 上nginx安装

1. 安装源

yum install pcre pcre-devel zlib zlib-devel
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2. 安装nginx

yum search nginx
yum install nginx.x86_64

3. 启动nginx

service nginx start

4. 设置开机自启动

systemctl enable nginx.service                                        

centos7 上MySQL5.7安装

1. 删除mariadb-libs

yum remove mariadb-libs

2. 安装依赖

yum -y install yum-utils

3. 获取安装rpm源

wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm

4. 查看源中包含mysql版本

yum repolist all | grep mysql

5. 启用MySQL57源

yum-config-manager --enable mysql57-community

6. 安装MySQL57

yum install mysql-community-server

7. 启动MySQL

service mysqld start

8. 获取root初始化密码

grep tempo /var/log/mysqld.log

9. 更改root密码

mysql_secure_installation

更多内容请关注公众号


来源:本文由云小秘原创撰写,欢迎分享本文,转载请保留出处和链接!

抢沙发

昵称*

邮箱*

网址