码迷,mamicode.com
首页 > Web开发 > 详细

centos6.5 x86_64下yum安装lnmp+phpmyadmin(2)

时间:2015-07-27 00:42:27      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

平台:centos6.5 x86_64最小化安装

上篇是安装的php、mysql版本有点老,安装个版本新一点的,尝尝鲜。^_^


1,关闭SElinux

vi /etc/selinux/config

将SELINUX=enforcing改为SELINUX=disabled

reboot


2,添加yum源

vi nginx.repo                   nginx的源

[nginx]

name=nginx repo

baseurl=http://nginx.org/packages/centos/$releasever/$basearch/

gpgcheck=0

enabled=1


rpm -Uvh http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm

EPEL,即Extra Packages for Enterprise Linux,企业版linux附加包。这个软件仓库里有很多非常常用的软件,而且是专门针对RHEL设计的,对RHEL标准yum源是一个很好的补充,完全免费使用,由Fedora项目维护,所以如果你使用的是RHEL,或者CentOS,Scientific等RHEL系的linux,可以非常放心的使用EPEL的yum源。

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

remi依赖于EPEL源,有最新版本的PHP、MYSQL等软件。


3,安装基本库

yum  --enablerepo=remi -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl–devel pcre pcre-devel


4,安装nginx和mysql

yum install -y nginx

yum --enablerepo=remi  mysql mysql-server mysql-devel


5,安装php及其相关函数库

yum --enablerepo=remi install -y php  php-fpm php-mysql php-common php-devel php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel


6,配置mysql

chkconfig mysqld on

service mysqld start


为root账户设置密码

mysql_secure_installation

默认root密码为空,回车,按提示设置密码之类的


/usr/bin/mysql -u root -p 输入密码

GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘password‘;

FLUSH PRIVILEGES;


7,配置PHP

chkconfig php-fpm on

cp /etc/php.ini /etc/php.ini.bk

sed -i ‘s/;date.timezone =/date.timezone = PRC/g‘ /etc/php.ini

sed -i ‘s/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g‘ /etc/php.ini

sed -i ‘s/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g‘ /etc/php.ini

sed -i ‘s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g‘ /etc/php.ini

sed -i ‘s/max_execution_time = 30/max_execution_time = 300/g‘ /etc/php.ini

sed -i ‘s/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g‘ /etc/php.ini


cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.bk

vi /etc/php-fpm.d/www.conf

#修改用户为nginx

user = nginx

#修改组为nginx

group = nginx


service php-fpm start


8,配置nginx

chkconfig nginx on


cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bk

vi /etc/nginx/conf.d/default.conf

#location / {

root   /usr/share/nginx/html;

index  index.php index.html index.htm;

#}

修改以下代码

# location ~ \.php$ {

#    root       html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

去掉除root行外的#,/scripts 改成$document_root


service nginx start


9,测试

为便于看到效果,service iptables stop

vi /usr/share/nginx/html/index.php

<?php

$link=mysql_connect("localhost","root","password","mysql");

echo ‘<br/>‘;

if($link){

      echo ‘connection is ok‘;

      mysql_close($link);

}

else

    echo ‘try config again‘;

?>

chown -R nginx.nginx /usr/share/nginx/html

http://YOURSERVERIP/

显示connection is ok,说明php和mysql已整合。


10,安装phpmyadmin

安装完个版本:php是5.4.43,nginx是1.8.0,mysql 5.5.45,下载最新的phpmyadmin

wget https://files.phpmyadmin.net/phpMyAdmin/4.4.12/phpMyAdmin-4.4.12-all-languages.zip

unzip phpMyAdmin-4.4.12-all-languages.zip

mv phpMyAdmin-4.4.12-all-languages phpmyadmin

mv phpmyadmin /usr/share/nginx/html/


chown -R nginx.nginx /var/lib/php/session


OK,http://yourserverip/phpmyadmin,输入MySQL用户名和密码,enjoy it!


centos6.5 x86_64下yum安装lnmp+phpmyadmin(2)

标签:

原文地址:http://my.oschina.net/u/2404183/blog/483968

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!