The method of installing linux+apache+mysql+php environment under CentOS Yum _linux

Source: Internet
Author: User
Tags install php centos phpmyadmin aliyun

First, script yum source installation:

1.yum install wget                           #安装下载工具wget
2.wget http://www.atomicorp.com/installers/atomic    #下载atomic Yum Source, Configure CentOS 6.5 Third party yum source
3 sh  ./atomic                             #脚本执行
4. Yum check-update                        #更新yum软件包

Second, 163yum source installation

1. Enter the Yum Source configuration directory

Cd/etc/yum.repos.d

2. Backup system with the Yum source

MV Centos-base.repo CENTOS-BASE.REPO.BK

3. Download the Yum source of 163 NetEase:

centos7.x:
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
centos6.x:
wget http:// Mirrors.163.com/.help/centos6-base-163.repo

4. After updating play Yum Source, perform the following command to update the Yum configuration so that the operation takes effect immediately

Yum Makecache

Third, add Ali Yum Update Source:

1. Install wget:

Yum Install Wget-y

2. Back up your original image file, so that you can recover after an error.

Mv/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.backup

3. Download the new Centos-base.repo to/etc/yum.repos.d/

CentOS 5:
wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6 :
wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7:
Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-7.repo

4. Then rebuild the cache:

Yum Clean all
yum Makecache

Four, install and configure MySQL

1. Perform yum command installation MYSQ

Yum-y install MySQL Mysql-server

2. Add MySQL to boot and start MySQL immediately

Chkconfig--levels 235 mysqld on  #重启自动启动服务
service mysqld start          #重新启动mysql服务

3. Set the MySQL root account password

Mysql_secure_installation

Carriage return, enter y according to the prompt

Enter 2 times password, return

Follow the prompts to enter Y

Last seen: the for using mysql!

MySQL Password setup complete, restart MySQL

Service mysqld start 
[root@localhost ~]# netstat-tulpn | grep-i mysql
TCP    0   0 0.0.0.0:3306     0.0.0.0 :*     LISTEN   1723/mysqld

V. Installation of Apache

1. Install Apache using the Yum command

Yum–y Install httpd

2. Set boot up Apache

Chkconfig--levels 235 httpd on

3. Start Apache

Service httpd Start

4. Now type http://localhost or http://native IP directly in the browser, you should see the Apache test page

### install Apache some extensions ###
root@localhost ~]# yum-y install httpd-manual mod_ssl mod_perl mod_auth_mysql

Vi. Installing and configuring PHP

1. Install PHP using the Yum command

[root@localhost ~]# yum-y install php php-mysql
[root@localhost ~]# yum-y install gd php-gd gd-devel php-xml php-com Mon php-mbstring php-ldap php-pear php-xmlrpc php-imap
 #安装php常用扩展

2. Restart the Apache server

[root@localhost ~]# Service httpd restart

Ps:apache Default Web Site Directory/var/www/html

We then provide a PHP page that tests

[Root@localhost ~]# cd/var/www/html/
[root@localhost html]# vi index.php
<?php
  ();
>

Vii. Installation and Configuration phpMyAdmin

After installing Mysql,apache and PHP, we can install phpMyAdmin to visualize the management of MySQL database.

Download the latest version to its official website: http://www.phpmyadmin.net/home_page/

In fact, Navicat is also a very handy MySQL visualization tool, recommended for use in Windows.

[Root@localhost ~]# unzip Phpmyadmin-4.2.6-all-languages.zip
[root@localhost ~]# MV Phpmyadmin-4.2.6-all-languages/var/www/html/phpmyadmin
[root@localhost ~]# cd/var/www/html/phpmyadmin
[ Root@localhost ~]# CP libraries/config.default.php config.inc.php
[root@localhost ~]# VI cnfig.inc.php
$cfg [' Pmaabsoluteuri '] = '; here fill in the phpMyAdmin visit URL.
$cfg [' Servers '] [$i] [' host '] = ' localhost ';//MySQL hostname or IP address
$cfg [' Servers '] [$i] [' port '] = ';//M Ysql Port-leave blank for default port
$cfg [' Servers '] [$i] [' user '] = ' root ';//fill in the MySQL username used by MySQL access phpMyAdmin , and the default is root.
fg[' Servers ' [$i] [' password '] = ';//fill in the password corresponding to the MySQL username above.
# then reboot, httpd service
[root@localhost ~]# Service httpd restart

You can access it by typing http://localhost/phpmyadmin in the browser.

If you experience problems with access rights, check the SELinux.

The above is a small set to introduce the CentOS under the Yum to set up the installation of linux+apache+mysql+php environment method, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

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.