部署LNMP环境——Yum安装(113资讯网)
Posted 113p
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署LNMP环境——Yum安装(113资讯网)相关的知识,希望对你有一定的参考价值。
Yum安装优点:安装东西,方便快捷,特别是不用考虑包依赖
教程(Centos做演示,其他系统大同小异):
- 1.更换国内Yum源:
- [root@root xx ]# rm -rf /etc/yum.repos.d/*.repo
- [root@root xx ]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- [root@root xx ]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
- [root@root xx ]# yum makecache
- 2.磁盘挂载:
- [root@root xx ]# wget http://mirrors.linuxeye.com/scripts/auto_fdisk.sh
- [root@root xx ]# chmod +x ./auto_fdisk.sh
- [root@root xx ]# ./auto_fdisk.sh
- 3.nginx的yum仓库配置:
- [root@root xx ]# cd /etc/yum.repos.d
- vim nginx.repo
- ————————————————
- [nginx-stable]
- name=nginx stable repo
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
- gpgcheck=1
- enabled=1
- gpgkey=https://nginx.org/keys/nginx_signing.key
- module_hotfixes=true
- [nginx-mainline]
- name=nginx mainline repo
- baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
- gpgcheck=1
- enabled=0
- gpgkey=https://nginx.org/keys/nginx_signing.key
- module_hotfixes=true
- ————————————————
- [root@root xx ]# yum repolist
- 4.安装nginx,mariadb,php:
- [root@root xx ]# yum -y install mariadb mariadb-server
- [root@root xx ]# yum -y install nginx
- [root@root xx ]# yum -y install php php-cli php-curl php-fpm php-intl php-mcrypt php-mysql php-gd php-mbstring php-xml php-dom
- 5.开机启动与关闭防火墙:
- [root@root xx ]# systemctl stop firewalld //立刻关闭防火墙
- [root@root xx ]# systemctl disable firewalld //永久关闭
- [root@root xx ]# setenforce 0 //关闭selinux
- [root@root xx ]# systemctl start nginx //启动nginx
- [root@root xx ]# systemctl start mariadb //启动mariadb
- [root@root xx ]# systemctl start php-fpm //启动php
- [root@root xx ]# systemctl enable mariadb php-fpm nginx //给服务做开机自启
- 6.配置数据库:
- [root@root xx ]# mysqladmin -u root password ‘123‘ //设置mariadb的初始密码为123
- [root@root xx ]# mysql -u root -p
- >>>create database farm; //创建一个名字为farm的数据库
- >>>exit 退出
- 7.配置nginx文件:
- [root@root xx ]# cd /etc/nginx/conf.d/
- vim default.conf
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 有时候需要换成路径
- 8.配置php.ini文件:
- [root@root xx ]# vim /etc/php-fpm.d/www.conf
- user = nginx
- group = nginx
- 9.重启php,nginx:
- [root@root nginx ]# systemctl restart nginx
- [root@root nginx ]# systemctl restart php-fpm
- 10.安装程序:
- [root@root nginx ]# cd /usr/share/nginx/
- [root@root nginx ]# rm -rf *
- [root@root nginx ]# wget http://updatenew.dedecms.com/base-v57/package/DedeCMS-V5.7-UTF8-SP2.tar.gz (测试程序)
- [root@root nginx ]# mv DedeCMS-V5.7-UTF8-SP2/uploads/* /usr/share/nginx/html/
- [root@root nginx ]# chown -Rf nginx /usr/share/nginx/html
- [root@root nginx ]# chmod -Rf 755 /usr/share/nginx/html
以上是关于部署LNMP环境——Yum安装(113资讯网)的主要内容,如果未能解决你的问题,请参考以下文章
CentOS 7.4 yum方式搭建LNMP环境,部署WordPress博客,并安装XCache模块