笔记本安装centos7 php7.1.7 nginx1.13.2 mysql5.7 iptables

一、安装准备

首先由于nginx的一些模块依赖一些lib库,所以在安装nginx之前,必须先安装这些lib库,这些依赖库主要有g++、gcc、openssl-devel、pcre-devel和zlib-devel 所以执行如下命令安装

[html] view plaincopy
$ yum install gcc-c++
$ yum install pcre pcre-devel
$ yum install zlib zlib-devel
$ yum install openssl openssl--devel

二、安装Nginx

安装之前,最好检查一下是否已经安装有nginx
[html] view plaincopy
$ find -name nginx
如果系统已经安装了nginx,那么就先卸载
[html] view plaincopy
$ yum remove nginx
首先进入/usr/local目录
[html] view plaincopy
$ cd /usr/local
从官网下载最新版的nginx
[html] view plaincopy
$ wget http://nginx.org/download/nginx-1.13.2.tar.gz
解压nginx压缩包
[html] view plaincopy
$ tar -zxvf nginx-1.13.2.tar.gz
会产生一个nginx-1.13.2 目录,这时进入nginx-1.13.2目录
[html] view plaincopy
$ cd nginx-1.13.2 
接下来安装,使用--prefix参数指定nginx安装的目录,make、make install安装
[html] view plaincopy
$ ./configure $默认安装在/usr/local/nginx
$ make
$ make install

如果没有报错,顺利完成后,最好看一下nginx的安装目录
[html] view plaincopy
$ whereis nginx

三、安装PHP7

下载php7
wget -O php7.tar.gz http://cn2.php.net/get/php-7.1.7.tar.gz/from/this/mirror
解压php7
tar -xvf php7.tar.gz
进入php目录
cd php-7.1.7
安装依赖包
# 直接复制下面一行(不包括本行)
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel
编译配置(如果出现错误,基本都是上一步的依赖文件没有安装所致)

错误描述:
#yum install libmcrypt libmcrypt-devel mcrypt mhash
Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do
我们会看到centos yum从仓库中根本找不到这几个包。但我不想使用源码编译就想使用yum安装,怎么办?

解决方法:

yum install epel-release //扩展包更新包
yum update //更新yum源
yum install libmcrypt libmcrypt-devel mcrypt mhash 就ok了

嫌麻烦的可以从这一步起参考PHP官方安装说明:http://php.net/manual/zh/install.unix.nginx.php
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
正式安装
make && make install
配置环境变量
vi /etc/profile
在末尾追加
PATH=$PATH:/usr/local/php/bin
export PATH
执行命令使得改动立即生效
source /etc/profile
配置php-fpm
cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/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

提示 cannot get uid for user ‘nginx’
解决 adduser nginx 就ok

安装mysql5.7

# 下载mysql源安装包
shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# 安装mysql源
shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm

shell> yum install mysql-community-server

启动服务
shell> systemctl start mysqld
重启 restart
查看启动状态
systemctl status mysqld

设置开机启动
shell> systemctl enable mysqld
shell> systemctl daemon-reload

修改root默认密码

mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:

shell> grep ‘temporary password‘ /var/log/mysqld.log

mysql> set password for ‘root‘@‘localhost‘=password(‘MyNewPass4!‘);
mysql> FLUSH PRIVILEGES;
—————
mysqld_safe --skip-grant-tables --skip-networking &

合盖子不休眠
vim /etc/systemd/logind.conf

HandleLidSwitch= suspend 改为lock
重启服务systemctl restart systemd-logind生效

查看默认的target,执行:
systemctl get-default

开机以命令模式启动,执行:
systemctl set-default multi-user.target
开机以图形界面启动,执行:
systemctl set-default graphical.target

iptables
重启
systemctl restart iptables
or
/etc/rc.d/init.d/iptables restart
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off

2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop

2. 即使安装了iptables也需要开放80端口。
----如下去装iptables-servie
yum install iptables-services
vi /etc/sysconfig/iptables
添加如下一行
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

时间: 2024-08-27 05:34:19

笔记本安装centos7 php7.1.7 nginx1.13.2 mysql5.7 iptables的相关文章

LNMP架构--linux7.4+nginx1.13.9+mysql5.7.20+php7.1.10

一. 环境安装包下载地址:http://nginx.org/en/download.htmlservice firewalld stopsystemctl disable firewalld将安装包通过WinSCP传到虚拟机二. nginx安装yum -y install \gcc \gcc-c++ \make \pcre-devel \zlib-devel[[email protected] ~]# useradd -M -s /sbin/nologin nginx //创建程序用户nginx

FastDFS安装和配置,整合Nginx-1.13.3

目录: 一:下载FastDFS  二:安装FastDFS 三:配置 四:整合Nginx和FastDFS FastDFS is an open source high performance distributed file system (DFS). It's major functions include: file storing, file syncing and file accessing, and design for high capacity and load balance.

安装Centos7 随手记

1.老笔记本安装Centos7 配置:酷睿I3  内存8G 2.原有系统Win7 将原来的硬盘空间,调整出60G 给Centos7 用. 3.安装Centos7 图形介面的,和windows安装过程类似,只是在安装时,分区方式不一样以及安装模式(可以选择生产开发模式) 4.安装极点五笔输入法 1 yum install ibus ibus-table-wubi* 5.添加打开终端(命令窗口)的快捷键 步骤:1) 应用程序---系统工具---设置---键盘 2)快捷键--- 自定义快捷键--- 名

亲测完美centos7部署Nginx1.6.3(附一键安装nginx1.13.8脚本)

1. 创建预备环境 [[email protected] ~]# test -f /services/current_apps || mkdir /services/current_apps 2&> /dev/null[[email protected] ~]# test -f /services/download_soft_v || mkdir /services/download_soft_v 2&> /dev/null[[email protected] ~]# yum

CentOS 7.2.1511 编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11

这篇文章主要介绍了CentOS 7.2.1511 编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11,需要的朋友可以参考下准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动 2.安装ipta

CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13

CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.132013-10-24 15:31:12标签:服务器 防火墙 file 配置文件 written 一.配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 二.配置防火墙,开启80端口.3306端口1    vi/etc/sysconfig/iptables #编辑防火墙配置文件1    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80

Nextcloud 安装与优化 centos7 php7 nginx MariaDB

Nextcloud 安装与优化 (环境: centos7 php7 nginx MariaDB)前期玩了一段时间这个,但当时都是基于宝塔面板的,很多东西都不知道是为了什么,现在根据前期各位大神的作品,从头到尾做了一次.发现对于我们小白来说问题不在于安装,而在于优化,而大神们将优化说的比较少,所以我将自己的过程记录下:一.准备工作:1.查看系统版本并升级cat /etc/redhat-releaseyum update -y 2.将自带的epel.nginx.php全部卸载rpm -qa|grep

centos7编译安装的php7怎么卸载 解决cenos 编译安装软件后怎么卸载问题

之前有个疑问  编译安装的软件 不是yum 安装 怎么卸载 遇到个问题, centos7编译安装的php7怎么卸载 解决: 关于卸载如果没有配置--prefix选项,源码包也没有提供make uninstall,则可以通过以下方式可以完整卸载: 一个临时目录重新安装一遍,如: ./configure --prefix=/tmp/to_remove && make install1然后遍历/tmp/to_remove的文件,删除对应安装位置的文件即可(因为/tmp/to_remove里的目录

CentOS 7.x编译安装Nginx1.10.3+MySQL5.7.16+PHP5.2 5.3 5.4 5.5 5.6 7.0 7.1多版本全能环境

准备篇 一.防火墙配置 CentOS 7.x默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptables防火墙 yum install iptables-services #安装 vi /etc/sysconfig/iptables #编辑