Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}

yum 安装依赖(很重要)

yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libxslt-devel cyrus-sasl-plain cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib m4 autoconf gcc gcc-c++ openssl openssl-devel pcre pcre-devel zlib zlib-devel wget net-tools zip unzip bzip2

下载必要安装包

wget -O nginx-1.12.1.tar.gz https://nginx.org/download/nginx-1.12.1.tar.gz  //nginx 安装包

wget -O php-7.2.tar.gz http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror  //php7.2安装包

1 安装nginx

1.1 解压编译安装nginx(安装在/server/nginx目录下)

tar zxvf nginx-1.12.1.tar.gz  //解压

cd nginx-1.12.1/   //进入解压后的目录,###下面的代码复制每行行尾会有空格,请自行复制到文本编辑中去掉

./configure \

--prefix=/server/nginx \

--pid-path=/server/var/nginx/nginx.pid \

--lock-path=/server/var/nginx/nginx.lock \

--error-log-path=/server/var/nginx/error.log \

--http-log-path=/server/var/nginx/access.log \

--with-http_gzip_static_module \

--with-http_stub_status_module \

--with-http_ssl_module

1.2安装

make && make install

1.3 安装完成后,开启nginx 服务

/server/nginx/sbin/nginx

1.3.1 可以将nginx 命令加入环境变量中,方便使用(此三步可以忽略)

vi /etc/profile

1.3.2  在文件末尾加入

export PATH="$PATH:/server/nginx/sbin"

1.3.3 保存退出后,使之立即生效

source /etc/profile

1.4 访问IP地址,如果没出现nginx欢迎页面,则开通防火墙80端口

查看防火墙状态

firewall-cmd --state

打开80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义:

--zone #作用域

--add-port=80/tcp #添加端口,格式为:端口/通讯协议

--permanent #永久生效,没有此参数重启后失效

重启防火墙

firewall-cmd --reload

防火墙常用命令介绍

firewall-cmd --state                           ##查看防火墙状态,是否是running

firewall-cmd --reload                          ##重新载入配置,比如添加规则之后,需要执行此命令

firewall-cmd --get-zones                       ##列出支持的zone

firewall-cmd --get-services                    ##列出支持的服务,在列表中的服务是放行的

firewall-cmd --query-service ftp               ##查看ftp服务是否支持,返回yes或者no

firewall-cmd --add-service=ftp                 ##临时开放ftp服务

firewall-cmd --add-service=ftp --permanent     ##永久开放ftp服务

firewall-cmd --remove-service=ftp --permanent  ##永久移除ftp服务

firewall-cmd --add-port=80/tcp --permanent     ##永久添加80端口

iptables -L -n                                 ##查看规则,这个命令是和iptables的相同的

man firewall-cmd                               ##查看帮助

firewall-cmd --list-ports  ##查看防火墙开启的端口

至此nginx安装完成

<-----------------------------------------------分割线-------------------------------------------->

2 安装PHP7

2.1 解压编译安装php7(安装目录/server/php7)

tar zxvf php-7.2.tar.gz  //解压

cd php-7.2.3   //进入安装目录 ###下面的代码复制每行行尾会有空格,请自行复制到文本编辑中去掉

./configure --prefix=/server/php7 \

--with-config-file-path=/server/php7/etc \

--with-curl \

--with-gd \

--with-gettext \

--with-iconv-dir \

--with-kerberos \

--with-libdir=lib64 \

--with-libxml-dir \

--with-openssl \

--with-pcre-regex \

--with-pdo-sqlite \

--with-pear \

--with-xmlrpc \

--with-xsl \

--with-zlib \

--enable-fpm \

--enable-bcmath \

--enable-libxml \

--enable-inline-optimization \

--enable-mbregex \

--enable-mbstring \

--enable-opcache \

--enable-pcntl \

--enable-shmop \

--enable-soap \

--enable-sockets \

--enable-sysvsem \

--enable-xml \

--enable-zip \

--enable-static \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--disable-debug \

--disable-fileinfo \

--enable-maintainer-zts

2.2 安装

make && make install

时间较长(根据机器性能决定,1G1核 大概在15分钟)

2.3 安装完成后,将php加入环境变量,添加php配置文件

cp php.ini-production /server/php7/etc/php.ini //添加配置文件

vi /etc/profile  //编辑环境变量文件

在文件中添加

export  PATH="$PATH:/server/php7/bin"

使改动立即生效

source /etc/profile

查看php版本

php -v

2.4 配置php-fpm

cp /server/php7/etc/php-fpm.conf.default /server/php7/etc/php-fpm.conf

cp /server/php7/etc/php-fpm.d/www.conf.default /server/php7/etc/php-fpm.d/www.conf

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm  //添加执行权限

启动php-fpm

/etc/init.d/php-fpm start

如下图

至此php7安装完成

<-----------------------------------------------分割线-------------------------------------------->

3 yum安装mariadb 10

3.1 添加仓库

vi /etc/yum.repos.d/MariaDB.repo

文件中添加代码

[mariadb]

name = MariaDB

baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64

gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB

gpgcheck=1

-----------------以上的源,如果无效,则使用下方官网的源---------

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.2/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

3.2 编辑保存退出后,安装

yum install -y MariaDB-server MariaDB-client

3.3 安装成功后启动

systemctl start mariadb  //启动程序

systemctl enable mariadb // 自启动

systemctl status mariadb //查看状态

3.4 配置mariadb

设置Root 用户的登陆密码

mysql_secure_installation

根据命令提示,主要是做以下几件事情:

>> 设置root密码

>> 是否禁止远程 root访问

>> 是否禁止 test数据库的访问

>> 是否禁用匿名用户

>> 是否重新加载privilleges-table信息

初始化完成后,登录测试

mysql -uroot -p***  //***代表你之前初始化设置的密码  exit命令可以退出

配置字符集

vi /etc/my.cnf

在[mysqld]标签下添加

init_connect='SET collation_connection = utf8_unicode_ci'

init_connect='SET NAMES utf8'

character-set-server=utf8

collation-server=utf8_unicode_ci

skip-character-set-client-handshake

vi /etc/my.cnf.d/mysql-clients.cnf

在[mysql]中添加

default-character-set=utf8

如下图

全部配置完成,重启mariadb

systemctl restart mariadb

之后进入MariaDB查看字符集

mysql -uroot -p*** //***代表密码

mysql> show variables like "%character%";show variables like "%collation%"; //显示如下图

至此mariadb 安装完成。但是如果想要外面能访问此数据库,如想使用navicat来连接到这个数据库,则还要其它的配置,您往下看。

首先开放防火墙端口,开启后要重启防火墙:

firewall-cmd --zone=public --add-port=3306/tcp --permanent

firewall-cmd --reload

mysql>create user username@localhost identified by 'password';

直接创建用户并授权的命令

mysql>grant all on *.* to username@localhost identified by 'password';

授予外网登陆权限 ,这里授权用户可以外网访问此数据库,如用数据库连接工具navicat连接

mysql>grant all privileges on *.* to username@'%' identified by 'password';

授予权限并且可以授权

mysql>grant all privileges on *.* to username@'hostname' identified by 'password' with grant option;

简单的用户和权限配置基本就这样了。

其中只授予部分权限把 其中 all privileges或者all改为select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file其中一部分。

yum 安装依赖(很重要)

yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libxslt-devel cyrus-sasl-plain cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib m4 autoconf gcc gcc-c++ openssl openssl-devel pcre pcre-devel zlib zlib-devel wget net-tools zip unzip bzip2

下载必要安装包

wget -O nginx-1.12.1.tar.gz https://nginx.org/download/nginx-1.12.1.tar.gz  //nginx 安装包

wget -O php-7.2.tar.gz http://cn2.php.net/get/php-7.2.3.tar.gz/from/this/mirror  //php7.2安装包

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.5pt;
mso-bidi-font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-font-kerning:1.0pt;}

阿里云服务器纯净版centos7.4 LNMP安装的更多相关文章

  1. 在阿里云服务器上(centos 8) 安装自己的MQTT服务器 (mosquitto)

    layout: post title: 在阿里云服务器上(centos 8) 安装自己的MQTT服务器 (mosquitto) subtitle: date: 2020-3-2 author: Dap ...

  2. 阿里云服务器建站——centos7部署apache+mysql+php

    自己也是忙活了半天,才完成了阿里云服务器的建站,这里就来分享一下. 首先如果是要自己搭建一个网站的话,除了服务器以外还要购买域名,并且要去备案,一般在哪买的域名都有备案的系统,备案的话一般要两到三个星 ...

  3. 阿里云服务器CentOS 5.7(64位)安装配置LAMP服务器(Apache+PHP5+MySQL)

    一.快速安装Apache+PHP5+MySql ----------------------------------------------------- 补充:由于163的yum源上只有php5.1 ...

  4. 阿里云服务器(windows server2008)下安装SVN----杜恩德

    我想说的是如何在阿里云上建立SVN版本,供外网访问,上传代码 在阿里云服务器上安装svn与在本地安装是一样的, ----参考 http://blog.csdn.net/m0_37027631/arti ...

  5. 阿里云服务器ECS的环境部署和安装

    1.进入产品 云服务 ECS 和 云空间选择, 我购买的是ECS,那么环境搭建都是需要自己动手实现的. 2. 选择创建一个实例 记得网络一定要选择 公用网络,主机地址选择选择国内. 3. 购买的时候 ...

  6. 阿里云服务器Centos7.4开放80端口的记录

    问题: 阿里云服务器安装的是centos7, 搭建网站安装lnmp1.5后发现访问不了, 不明所以, 在一论坛找到关于80端口未开放的原因. 需求: 开放80端口.于是有了下面第一,二,三部分关于开放 ...

  7. 阿里云服务器搭建vulhub靶场

    阿里云服务器搭建vulhub靶场 环境 服务器:阿里云服务器 系统:centos7 应用:vulhub 步骤 vulhub需要依赖docker搭建,首先安装docker. 使用以下方法之一: # cu ...

  8. 阿里云服务器centos5.10安装lamp环境

    ==相关命令== 查看linux版本:cat /etc/redhat-release ==配置修改== 一.Apache配置 ------------------------------------- ...

  9. 阿里云服务器Windows Server 2008/2012部署Office Web Server 2013

    以前成功将Office Web Server 2013部署在了本地服务器上,此次是将Office Web Server 2013部署在阿里云服务器Windows Server 2008和2012上,中 ...

随机推荐

  1. Asp.NET的目的是学习

    一.概观 二.具体介绍 1.Request对象 Request对象是用来获取client在请求一个页面或传送一个Form时提供的全部信息.这包含可以标识浏览器和用户的HTTP变量.存储在client的 ...

  2. 关于JSP

    JSP的本质 JSP本质上就是Servlet, 正常情况下, 它会在第一次被访问的时候被容器转化成Java代码, 然后再从Java代码编译成.class文件, 之后实际就和Servlet没区别了, 也 ...

  3. WPF编游戏系列 之四 用户控件

    原文:WPF编游戏系列 之四 用户控件        在上一篇<WPF编游戏系列 之三 物品清单>中,对物品清单进行了演示,其中反复用到了同一组控件(如下图),而且 颜昌钢也指出在3.2. ...

  4. 读BeautifulSoup官方文档之html树的搜索(2)

    除了find()和find_all(), 这里还提供了许多类似的方法我就细讲了, 参数和用法都差不多, 最后四个是next, previous是以.next/previous_element()来说的 ...

  5. MEF 插件式开发 - WPF 初体验

    原文:MEF 插件式开发 - WPF 初体验 目录 MEF 在 WPF 中的简单应用 加载插件 获取元数据 依赖注入 总结 MEF 在 WPF 中的简单应用 MEF 的开发模式主要适用于插件化的业务场 ...

  6. js 评分

    <!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...

  7. WPF滚动条嵌套,响应鼠标滑轮事件的处理

    在C# 中,两个ScrollViewer嵌套在一起或者ScrollViewer里面嵌套一个ListBox.Listview(控件本身有scrollviewer)的时候,我们本想要的效果是鼠标滚动整个S ...

  8. Qt 5.9对Mac的图形显示有许多改进

    We have some platform specific improvements as well as support for new platforms and compilers comin ...

  9. GIS基础软件及操作(七)

    原文 GIS基础软件及操作(七) 练习七.地形分析 地形分析:TIN及DEM的生成及应用 加深对TIN建立过程的原理.方法的认识: 熟练掌握ArcGIS中建立DEM.TIN的技术方法: 结合实际,掌握 ...

  10. DataTable,DataView 排序和使用

    我们都知道在Sql Server可以用order by来排序,所以很多朋友在DataTable中排序也想到了用order by关键字.但这样实现是比较困难的,下面,我们讲解一种比较简单的方法: 控制台 ...