CentOS 6.3 Installation Configuration Lnmp server, custom Php,mysql version

Source: Internet
Author: User
Tags fpm gpg install php mysql version iptables metalink

    • Prepare the article
1. Configure the firewall to turn on 80 ports, 3306 ports
1 vim /etc/sysconfig/iptables2 -J ACCEPT   #允许80端口通过防火墙 3 3306 -j ACCEPT #允许3306端口通过防火墙
Service iptables Restart    #重启防火墙 to make configuration effective

2. Turn off SELinux(This is related to server security and is closed first.) Related information: https://wiki.centos.org/zh/HowTos/SELinux)
vim /etc/selinux/config#selinux=enforcing      #注释掉 #selinuxtype=targeted   # Comment out SELinux=disabled        #增加: Wq                     #保存退出    
Shutdown-r now         #重启系统
3. Install a third-party source 1) Install the Epel warehouse
Yum Install -y epel-release
if the above command does not work:
    • Centos/rhel 7
RPM-UVH http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
    • Centos/rhel 6
RPM-UVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

2) Install IUS warehouse
    • CentOS 6
RPM-UVH https://centos6.iuscommunity.org/ius-release.rpm
    • CentOS 7
RPM-UVH https://centos7.iuscommunity.org/ius-release.rpm

Error handling:

1. Error installing IUS warehouse: Curl: (+) SSL connect error. This issue should occur in Rhel 6.1, Rhel 6.4, because Curl uses the rest API. Solve:

Yum Update NSS

2. The result of question 1 is not resolved, another problem: Error:cannot retrieve Metalink for Repository:epel. Verify its path and try again. Solve:

Vim/etc/yum.repos.d/centos-base.repo

Comment out all the mirrorlist, baseurl the comments, then proceed to step 1, then install the IUS warehouse. Modify the following:

[Epel]name=extra Packages forEnterprise Linux6-$basearchbaseurl=http://download.fedoraproject.org/pub/epel/6/$basearch#mirrorlist =https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch= $basearchFailovermethod=priorityenabled=1Gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-epel-6[Epel-Debuginfo]name=extra Packages forEnterprise Linux6-$basearch-Debugbaseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug#mirrorlist =https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch= $basearchFailovermethod=priorityenabled=0Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-epel-6gpgcheck=1[Epel-Source]name=extra Packages forEnterprise Linux6-$basearch-Sourcebaseurl=http://Download.fedoraproject.org/pub/epel/6/srpms#mirrorlist =https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch= $basearchFailovermethod=priorityenabled=0Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-epel-6gpgcheck=1
View Code

Check the list of warehouses to see if the installation was successful:

Yum repolist
Ius |2.3Kbxx:xxIus/primary_db |183Kbxx:xxRepoIDRepo Name Statusbase Cent OS-6-Base5,062Epel Extra Packages for Enterprise Linux 6-i386                                                                 9,992Extras CentOS-6-Extras theius ius Community Packages for Enterprise Linux 6-i386
                                                               329Updates CentOS-6-Updates382repolist: the,804

The installation warehouse was successful. Next, install nginx,mysql,php.

    • Installation article

To view the version of the software that will be installed:

yum list nginx mysql PHP

Results:

[[email protected] ~]# yum list nginx mysql PHP
Loaded Plugins:fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras:mirrors.163.com
* ius:hkg.mirror.rackspace.com
* updates:mirrors.163.com
Available Packages
mysql.i686 5.1.73-7.el6 Base
nginx.i686 1.10.1-1.el6 Epel
php.i686 5.3.3-48.el6_8 Updates

Both MySQL and PHP versions are somewhat old, and they all originate from the source of mirrors.163.com. The software versions of Epel and IUS sources are generally relatively new.

Use the following command to list all versions of MySQL and PHP:

yum list mysql* php*

This will list a whole bunch of results like this, and then just select the version of the software you want to install:

Software name software version #软件所在仓库
php56u.i686 5.6. -1. ius.centos6
mysql55.i686 5.5.52-1.IUS.CENTOS6 Ius
Installing Nginx
Yum remove httpd* php* #删除系统自带的软件包 yuminstall  nginx #安装nginx Follow the prompts to enter Y to install the chkconfig nginx on #设置nginx开机启动service nginx start    #启动nginx
Install MySQL
Yum remove mysql* #删除系统已经安装的mysqlyum list mysql*    #列出mysql所有版本, find the name of the version to install C5>yumInstall mysql57u*  #我安装的是mysql5.  7.15. Enter Y to install automatically until the installation is complete service mysqld start   #启动MySQLchkconfig mysqld on #设为开机启动
Install PHP
Yum Install php56u-fpm php56u-mbstring php56u-bcmath php56u-mcrypt php56u-xmlrpc php56u-pdo php56u-xml Php56u-xmlrpc php56u-mysqlnd php56u-gd php56u-opcache #安装php5.6 and extension chkconfig php-fpm on    #设置php-  FPM Boot service php-fpm start #启动php-fpm
    • Configuration Chapter
    1. The Nginx configuration file is the nginx.conf under/etc/nginx. In the last line of the nginx.conf file you can see: include/etc/nginx/conf.d/*.conf; It contains files with the suffix. conf in the/ETC/NGINX/CONF.D directory, so just configure a. conf file in the/etc/nginx/conf.d/directory. Here is my configuration:
# # The default Server#server {Listen the;    server_name n.com; Root/usr/share/nginx/html;    Index index.php index.html; # Load configuration Files forThe default server block. Location/{try_files $uri $uri//index.php?$args; } Location~ .*\. (PHP)?$ {Expires-1s; Try_files $uri=404; Fastcgi_split_path_info^ (. +\.php) (/.+)$;        Include Fastcgi_params;        Fastcgi_param path_info $fastcgi _path_info;        Fastcgi_index index.php;        Fastcgi_param script_filename $document _root$fastcgi_script_name; Fastcgi_pass127.0.0.1:9000; } error_page404/404. html; Location= /40x.html {} error_page - 502 503 504/50x.html; Location= /50x.html {}}
View Code

Restart Nginx:

Service Nginx Restart

Create a new index.php in the/usr/share/nginx/html/directory

cd/usr/share/nginx/HTML #进入html目录vim index.php #新建index. php, plus phpinfo ();

Browser access: CentOS IP address/index.php. Complete!

Resources
    1. 1190000005902945
    2. http://ohroot.com/2014/11/03/CentOS-6-5-%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AELNMP%E6%9C%8D%E5%8A%A1%E5%99% a8-nginx-php-mysql/

CentOS 6.3 Installation Configuration Lnmp server, custom Php,mysql version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.