在CentOS中快速安装PHP,MySQL,Nginx和phpMyAdmin
yum install -y autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel vim
安装php
yum install -y php php-fpm php-mysql php-devel php-mbstring php-gd
启动php-fpm
service php-fpm start
将php-fpm加入启动项
chkconfig --levels 2345 php-fpm on
查看
chkconfig --list | grep php-fpm
安装mysql
- yum安装
yum install -y mysql-server mysql mysql-devel
开启MySQL Server daemon (mysqld)
service mysqld start
用root帐号登录MySQL Server
mysql -u root
修改 root 帐号的密码: (注: 这一步完成之后,下次使用mysql -p -u root登录)
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
删除除root外的其它用户
select user,host from mysql.user; delete from mysql.user where not (user="root"); mysql> FLUSH PRIVILEGES; select user,host from mysql.user;
mysql> quit;
设置mysqld开机启动
chkconfig --level 2345 mysqld on && service mysqld restart && chkconfig --list | grep mysqld
======================================================
Centos7中用MariaDB代替了mysql数据库。
CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm # yum install mysql-community-server
附:
rpm -e 需要卸载的安装包在卸载之前,通常需要使用rpm -q …命令查出需要卸载的安装包名称。ruby-1.8.7.352-7.el6_2.x86_64 is a duplicate with ruby-1.8.7-1.el6.x86_64yum erase ruby
成功安装之后重启mysql服务
# service mysqld restart
如果仍不能下载,把原来的yum源里自定义的源删除。
=====================================
安装web服务器nginx
下载链接:http://pan.baidu.com/s/1sjqknO5 密码:7q59
yum install -y pcre-devel zlib-devel 可选 openssl openssl-devel
tar -zxf nginx-1.5.3.tar.gz cd nginx-1.5.3 ./configure --prefix=/opt/nginx make && make install
查看配置信息是否正确(可以一起复制)
cd /opt/nginx/sbin/ ./nginx -t
启动Nginx
/opt/nginx/sbin/nginx
开机启动
echo /opt/nginx/sbin/nginx >> /etc/rc.local
开放80端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT /etc/init.d/iptables save service iptables restart
或直接关闭防火墙(可选)
service iptables stop
开机关闭防火墙(可选)
chkconfig --level 0123456 iptables off
配置Nginx
vim /opt/nginx/conf/nginx.conf
安装vim
yum install -y vim
去掉注释并修改脚本路径为/opt/nginx/html
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000# location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /opt/nginx/html$fastcgi_script_name; include fastcgi_params; }
重新加载
cd /opt/nginx/sbin ./nginx -s reload service php-fpm restart
启停nginx的脚本
参见:编写Nginx启停服务脚本
安装phpmyadmin
链接:http://pan.baidu.com/s/1i3pKD3f 密码:et1z
tar -jxf phpMyAdmin-4.0.6-all-languages.tar.bz2 mv phpMyAdmin-4.0.6-all-languages phpmyadmin mv phpmyadmin/ /opt/nginx/html/ cd /opt/nginx/html/phpmyadmin/ cp config.sample.inc.php config.inc.php
修改用户名和密码
vim config.inc.php
修改下面2行:
$cfg['Servers'][$i]['controluser'] = 'root';// MySQL用户 $cfg['Servers'][$i]['controlpass'] = 'password'; // MySQL用户密码
重新加载
cd /opt/nginx/sbin ./nginx -s reload service php-fpm restart
问题:
Call to undefined function PMA_DBI_num_rows() in /opt/nginx/html/phpmyadmin/libraries/navigation/Nodes/Node.class.php
yum install php-mysql
在CentOS中快速安装PHP,MySQL,Nginx和phpMyAdmin的更多相关文章
- CentOS全自动一键安装PHP,MySQL,phpmyadmin与Nginx
运行install_nginx.sh即可 1,需要修改install_nginx.sh中的相应路径: #存放源代码和本脚本的目录 compile_dir=/root/nginx_compile,需要修 ...
- CentOS 7 下安装 LEMP 服务(nginx、MariaDB/MySQL 和 php)
原文 CentOS 7 下安装 LEMP 服务(nginx.MariaDB/MySQL 和 php) LEMP 组合包是一款日益流行的网站服务组合软件包,在许多生产环境中的核心网站服务上起着强有力的作 ...
- 在Centos中yum安装和卸载软件的使用方法(转)
在Centos中yum安装和卸载软件的使用方法 安装方法 安装一个软件时 yum -y install httpd 安装多个相类似的软件时 yum -y install httpd* 安装多个非类似软 ...
- Linux中如何安装配置Mysql和SVN服务端
目标Linux系统为centOS 一.安装登陆mysql 1.直接以root用户运行:yum install mysql 和yum install mysql-server等带安装完成. 2.安装 ...
- 在Centos中yum安装和卸载软件的使用方法(转载)
转自: http://gzmaster.blog.51cto.com/299556/72278 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任. ...
- <亲测>CentOS中yum安装ffmpeg
CentOS中yum安装ffmpeg 1.升级系统 sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now 2 ...
- centos中简易安装docker
centos中简易安装docker准备环境要求:请确保自己的centos的内核版本大于3.10,使用如下linux命令: uname -r1显示如下类似信息: 3.10.0-862.3.3.el7.x ...
- CentOS 6.4安装Apache+MySQL+PHP的图文教程
LAMP 实际上就是 Linux.Apache.MySQL.PHP 四个名称的缩写,当然最后一个 “P” 还有其他说法是 Perl 或者 Python.不用多说了,本文讲解的就是 Linux.Apac ...
- Ubuntu/CentOS 系统上安装与配置Nginx
一.在线安装: Ubuntu:sudo apt-get install nginx CentOS: sudo yum install nginx 二.安装后的位置: 1.服务地址:/etc/init. ...
随机推荐
- 【leetcode】Integer to Roman & Roman to Integer(easy)
Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within t ...
- 【leetcode】Valid Sudoku (easy)
题目:就是判断已有的数字是否冲突无效,若无效返回flase 有效返回true 不要求sudo可解 用了char型的数字,并且空格用‘.'来表示的. 思路:只要分别判断横向 竖向 3*3小块中的数字是否 ...
- IOS- 自定义 UIButton
#pragma mark init方法内部默认会调用initWithFrame: - (id)initWithFrame:(CGRect)frame { self = [super initWithF ...
- UICollectionView cellForItemAtIndexPath 方法不走
在storyboard 中 UICollectionView cellForItemAtIndexPath not called 被坑了好久,各种问题点查找,终于解决了 解决办法: self.auto ...
- xmpp即时通讯的笔记(摘抄)
xmpp的使用: 即时通讯 instant messaging(IM) : -->实时收发信息! 即时通讯相关软件: **QQ,MSN,GoogleTalk,AIM,Jabber(XMPP别名 ...
- ios滑动手势全屏(这段代码实现了下一级控制器滑到上一级控制器)
在自定义导航控制器里面加以下代码就增加全屏滑动手势 >推向前一个控制器 // HBNavigationController.m // #import "HBNavigationCon ...
- [Android Pro] Android 性能分析工具dumpsys的使用
reference to : http://www.open-open.com/lib/view/open1405061994872.html Android提供的dumpsys工具可以用于查看感兴趣 ...
- August 23rd 2016 Week 35th Tuesday
The very essence of romance is uncertainty. 浪漫的精髓就在于它充满种种可能. And the uncertainty of life may be also ...
- javascript void运算符
参考链接:http://www.cnblogs.com/ziyunfei/archive/2012/09/23/2698607.html语法: void expr 作用:计算表达式expr,并返回un ...
- 通过btn获取所在cell
[cell.btn addTarget:self action:@selector(cellBtnClicked:event:) forControlEvents:UIControlEventTouc ...