CentOS under Yum installation linux+apache+mysql+php Environment Tutorial _linux

Source: Internet
Author: User
Tags install php centos phpmyadmin

We use the Linux system Yum installation apache+mysql+php is very simple oh, only a few steps can be completed, specifically as follows:

First, script yum source installation:

1.yum Install wget #安装下载工具wget
2.wget http://www.atomicorp.com/installers/atomic #下载atomic Yum Source, configuration 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 Yum source with the backup system

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-common php-mbstring php-ldap php-pear php-xmlrpc P
#安装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 phpMyAdmin's visit URL.

$cfg [' Servers '] [$i] [' host '] = ' localhost '; MySQL hostname or IP address

$cfg [' Servers '] [$i] [' port '] = '; MySQL Port-leave blank for default port

$cfg [' Servers '] [$i] [' user '] = ' root '; Fill in the MySQL username used by MySQL access phpMyAdmin, default to 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 the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.