CentOS 6.x 7.x yum安装nginx1.12-php7-mysql5.7环境
2018-02-08 10:46
621 查看
1.安装nginx
修改yum源vim /etc/yum.repos.d/nginx.repo
##################写入如下源内容#######################
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
查看yum源中的nginx版本
安装nginx
打开80端口
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
#################### CenOS 7
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 入报以下错误
请键入如下代码############################ CentOS 7
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
############################ CentOS 6
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -ivh epel-release-6-8.noarch.rpm
rpm -ivh remi-release-6.rpm再进行第一步操作修改yum源vim /etc/yum.repos.d/remi.repo将 [remi] 段中的 enabled=0 改为 enabled=1
/etc/yum.repos.d下面有php54/php70/php71/php72安装哪个就修改哪个我这里安装php71
vim /etc/yum.repos.d/remi-php71.repo将 [remi-php71] 段中的 enabled=0 改为 enabled=1
查看将要yum安装的php版本yum list php
安装php及一些常用扩展
######################## CenOS 6## 下载yum源
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm[code]## rpm安装yum源
rpm -Uvh mysql57-community-release-el6-7.noarch.rpm
##安装 mysql
yum -y install mysql-community-server######################## CentOS 7## 下载yum源
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm rpm -ivh mysql57-community-release-el7-11.noarch.rpm
## 安装mysql
yum -y install mysql-community-server启动mysqlservice mysqld start查看自动生成的密码grep "password" /var/log/mysqld.log
root@localhost:后面即为随机的密码 delsqxooB5>g
修改初始密码mysql_secure_installation
先输入随机密码,然后进行新密码的修改
新密码必须含有 大小写字母数字和字符
登录看是否修改成功
设置mysql开机自启chkconfig mysqld on
mysql的配置文件默认在 /etc/my.cnf
修改yum源vim /etc/yum.repos.d/nginx.repo
##################写入如下源内容#######################
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
查看yum源中的nginx版本
yum list nginx
安装nginx
yum -y install nginx查看安装的版本是否为1.12
nginx -v
打开80端口
################################ CentOS7 ############## 查看防火墙状态 running为运行 firewall-cmd --state ############## 查看已经开放的端口 firewall-cmd --list-ports ############## 永久开启80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent ############## 重启firewall防火墙 firewall-cmd --reload ############## 停止firewall防火墙 systemctl stop firewalld.service ############## 禁止firewall防火墙开机启动 systemctl disable firewalld.service ########################## CentOS6 ### 查看防火墙状态 service iptables status ### 开启80端口 /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT ### 保存修改 /etc/rc.d/init.d/iptables save ### 重启防火墙 service iptables restart ### 停止防火墙 service iptables stop ### 永久关闭防火墙 chkconfig iptables off启动nginx
service nginx start #重启 service nginx restart #停止 service nginx stop设置开机启动nginx配置文件在 /etc/nginx/conf.d 里面chkconfig nginx on2.安装php安装php yum源#################### CentOS 6
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
#################### CenOS 7
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 入报以下错误
请键入如下代码############################ CentOS 7
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
############################ CentOS 6
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -ivh epel-release-6-8.noarch.rpm
rpm -ivh remi-release-6.rpm再进行第一步操作修改yum源vim /etc/yum.repos.d/remi.repo将 [remi] 段中的 enabled=0 改为 enabled=1
/etc/yum.repos.d下面有php54/php70/php71/php72安装哪个就修改哪个我这里安装php71
vim /etc/yum.repos.d/remi-php71.repo将 [remi-php71] 段中的 enabled=0 改为 enabled=1
查看将要yum安装的php版本yum list php
安装php及一些常用扩展
yum -y install php php-fpm php-cli php-pdo php-mysql php-gd php-bcmath php-xml php-mbstring php-mcrypt php-redis查看php版本及扩展
# 版本 php -v # 扩展 php -m修改php配置
vim /etc/php.ini
# 时区修改 date.timezone = PRC # 上传文件大小修改 upload_max_filesize = 20M # 提交文件大小 post_max_size = 20M # 隐藏 HTTP Header 中的php信息 expose_php = Off # 打开php错误提示
display_errors = On启动php-fpm
# 启动 service php-fpm start # 重启 service php-fpm restart # 停止 service php-fpm stop设置开机启动chkconfig php-fpm on3.安装mysql
######################## CenOS 6## 下载yum源
wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm[code]## rpm安装yum源
rpm -Uvh mysql57-community-release-el6-7.noarch.rpm
## 编辑yum源文件 vim /etc/yum.repos.d/mysql-community.repo确认 [mysql57-community] 下面的 enable 为 1
##安装 mysql
yum -y install mysql-community-server######################## CentOS 7## 下载yum源
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm rpm -ivh mysql57-community-release-el7-11.noarch.rpm
## 安装mysql
yum -y install mysql-community-server启动mysqlservice mysqld start查看自动生成的密码grep "password" /var/log/mysqld.log
root@localhost:后面即为随机的密码 delsqxooB5>g
修改初始密码mysql_secure_installation
先输入随机密码,然后进行新密码的修改
新密码必须含有 大小写字母数字和字符
登录看是否修改成功
设置mysql开机自启chkconfig mysqld on
mysql的配置文件默认在 /etc/my.cnf
相关文章推荐
- CentOS下安装和配置MySQL-JDK-Tomcat-Nginx(个人官网环境搭建手册)
- CentOS下安装LNMP(LINUX+NGINX+MYSQL+PHP)环境
- centos 6.8 安装LNMP环境(linux+nginx+mysql+php)---2
- CentOS 5.5安装Nginx、PHP(FastCGI)、MySQL --搭建LNMP环境安装Wordpress
- CentOS系统安装配置Nginx+tomcat+jdk+MySQL服务器环境
- Centos7下编译安装配置Nginx+PHP+MySql环境
- CentOS使用YUM安装php运行环境,包含php,php-fpm,nginx,mysql
- (一)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - FTP安装
- 阿里云CENTOS系统安装PHP+MYSQL+NGINX环境配置
- CentOS下nginx+mysql+php环境安装,小结
- CentOS使用YUM安装php运行环境,包含php,php-fpm,nginx,mysql
- Centos 6.9 通过yum安装NGINX 1.12.2 + 直接解压安装TOMCAT 8.5 + 通过yum安装Mysql 5.7
- centos安装lnmp环境(nginx+mysql+php)
- Centos7.4 安装java开发环境(lnmt)Linux + Nginx+ MySQL+ Tomcat
- CentOS5.5安装Nginx、PHP(FastCGI)、MySQL --搭建LNMP环境安装wordpress
- Mysql 5.7 Centos7 环境安装
- centos 5.5 安装mysql、nginx环境初始化脚本
- CentOS 6.X 安装Nginx 1.12
- 基于CentOS 6.8平台最新源代码包编译安装LNMP环境搭建(Nginx+MySQL+PHP)
- 在CentOS 7下编译安装Nginx+PHP+MySQL环境