lnmp环境搭建
来源:互联网 发布:wifi限制网速软件 编辑:程序博客网 时间:2024/05/20 04:48
一,运行环境
阿里云ecs,Centos7.0 64位,单核2G内存,40G系统盘,1M带宽。
二,安装软件及版本
nginx-1.10.1稳定版,mysql-5.7.13,php-7.0.7稳定版,redis-3.2.1稳定版。
软件连接地址:
http://nginx.org/download/nginx-1.10.1.tar.gz
http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
http://cn2.php.net/get/php-7.0.8.tar.gz/from/this/mirror
http://download.redis.io/releases/redis-3.2.1.tar.gz
三,开始安装
1)安装mysql
由于Mysql的某些版本在未来可能会收费,所以有些linux会默认安装mysql的一个开源分支mariadb,我们要自定义安装mysql就需要先把它删除掉。
先查出所有软件
rpm -qa|grep mariadb
然后依次卸载以及依赖包
rpm -e --nodeps mariadb-libs-5.5.40-1.el7_0.x86_64
解压mysql安装包
tar -xf mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
官方文档说安装mysql-community-client-5.7.9-1.el7.x86_64.rpm和mysql-community-server-5.7.9-1.el7.x86_64.rpm就可以获得标准功能的MySQL。但是由于RPM包的依赖关系,所以实际上我们还要多装2个RPM包:mysql-community-common-5.7.9-1.el7.x86_64.rpm和mysql-community-libs-5.7.9-1.el7.x86_64.rpm。
以下为安装,由于依赖关系,顺序不要出错:
rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.13-1.el7.x86_64.rpm
如果遇到类似‘头V3 DSA/SHA1 Signature’的错误,下面正常安装则忽略,否则在安装语句后面加上--force --nodeps强制安装
指定用mysql用户来运行mysqld初始化
mysqld --initialize --user=mysql
5.7版本的mysql密码默认会在/var/log/mysqld.log下,如下,localhost:后面显示的就是密码。
A temporary password is generated for root@localhost: DO:w=<i:;3uw< span="">
启动mysqld
systemctl start mysqld
检测是否启动成功
systemctl status mysqld
登陆mysql客户端
mysql -u root -p
输入刚才log中的密码即可登录
修改mysql登录密码(在后续其他操作之前必须修改mysql的登录密码)
set password = password('‘);引号中输入新的密码
flush privileges;(使新密码生效)
退出,重启mysqld
systemctl restart mysqld
yum -y install openssl*
InnoDB: Unable to lock ./ibdata1, error: 11 的报错解决方法
通过ps aux |grep mysql 找到mysqld进程,用kill加进程号杀掉
Please read "Security" section of the manual to find out how to run mysqld as root错误的解决方法,在/etc/my.cnf的mysqld下面添加user=mysql让程序以mysql运行
TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option错误的解决方法,在/etc/my.cnf的mysqld下面添加explicit_defaults_for_timestamp=true
2)安装nginx
解压nginx
tar zxf nginx-1.10.1.tar.gz
编译nginx
./configure --prefix=/usr/local/nginx
安装nginx
make && make install
启动nginx
/usr/local/nginx/sbin/nginx
3)安装php
先安装需要的扩展
yum install gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre-devel libxslt-devel curl curl-devel php-mcrypt libmcrypt libmcrypt-devel
编译php
./configure \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/lib \ //php.ini默认存放位置
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql=mysqlnd \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-zlib-dir \
--with-mhash \
--with-mcrypt \
--with-openssl-dir \
--with-jpeg-dir \
--enable-gd-jis-conv \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
安装php
make && make install
运行php
/usr/local/php/sbin/php-fpm
如果出现找不到php-fpm.conf错误,则去./php/etc/下面找,如果里面有一个php-fpm.conf.default文件则 mv php-fpm.conf.default php-fpm.conf
打开php-fpm.conf把最后一行修改为如下:include=/usr/local/php7/etc/php-fpm.d/www.conf
如果./php/etc/php-fpm.d文件夹下没有www.conf文件就mv www.conf.default www.conf
打开www.conf文件修改其中的:
user = aa
group = bb
把php安装包中的php.ini-production(开发版)复制到配置文件指定目录下(./php/etc)
- LNMP环境搭建
- LNMP环境搭建
- LNMP环境搭建
- LNMP环境的搭建
- LNMP环境搭建
- 树莓派搭建LNMP环境
- LNMP环境搭建
- LNMP环境搭建
- lnmp---环境搭建
- lnmp环境搭建
- LNMP环境搭建
- LNMP环境的搭建
- lnmp---环境搭建
- LNMP 环境搭建
- 搭建LNMP+memcached环境
- LNMP环境搭建
- LNMP环境搭建
- CentOS LNMP环境搭建
- UNABLE_TO_VERIFY_LEAF_SIGNATURE
- IceWarp 集成 LDAP 服务 同步管理用户,实现客户端地址簿查找
- Oracle 导入dmp文件代码
- ES6新特性【介绍比较常用的部分】
- 聊聊JAVA String类
- lnmp环境搭建
- (二)ArcGIS Server之发布切片地图服务
- RabbitMQ (三) 发布/订阅
- android listview每个item定义动画呈现
- 如何建立一个建立一个网站
- python中的修饰符(@)
- OC和Swift中动画的暂停和恢复
- TcxComboBoxProperties下拉框填充
- linux 下动态库函数调用--反汇编知识(arm)。