Under centos yum builds the method to install the linux+apache+mysql+php environment

  • 2020-05-12 06:40:42
  • OfStack

1. Script YUM source installation:


1.yum install wget                           # Install download tool wget
2.wget http://www.atomicorp.com/installers/atomic    # download atomic yum The source, CentOS 6.5 The first 3 party yum The source 
3. sh  ./atomic                             # Script execution 
4. yum check-update                        # update yum The software package 

2. Installation of 163yum source

1. Enter the yum source configuration directory


cd /etc/yum.repos.d

2. Backup the system's own 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 playing the yum source, execute the following command to update the yum configuration to take effect immediately


yum makecache

3. Add ali yum update source code:

1. Install wget:


yum install wget -y

2. Back up your original image files so you can restore them if something goes wrong.


mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

3. Download 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

4. Install and configure MySQL

1. Execute yum to install MySQ


yum -y install mysql mysql-server

2. Add MySQL into startup and start MySQL immediately


cd /etc/yum.repos.d
0

3. Set the password of MySQL root account


cd /etc/yum.repos.d
1

Press enter and enter Y as prompted

Enter the password twice and press enter

Enter Y as indicated on channel 1

Last: Thanks for using MySQL!

The MySql password is set. Restart MySQL


cd /etc/yum.repos.d
2

5. Install Apache

1. Install Apache using the yum command


yum  � y install httpd

2. Set to boot Apache


cd /etc/yum.repos.d
4

3. Start Apache


cd /etc/yum.repos.d
5

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


cd /etc/yum.repos.d
6

6. Install configuration PHP

1. Install PHP using the yum command


cd /etc/yum.repos.d
7

2. Restart the Apache server


[root@localhost ~]# service httpd restart

ps:apache default website directory /var/www/html

Then we provide php page for testing


cd /etc/yum.repos.d
9

7. Install configuration phpMyAdmin

After installing MySQL, Apache and PHP, we can install phpMyAdmin for visual management of MySQL database.

To its website to download the latest version: http: / / www phpmyadmin. net/home_page /

Under Windows, Navicat is also a very useful visualization tool for MySQL, which is recommended.


[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 to fill out  phpMyAdmin  Visit the website. 
$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  access  phpMyAdmin  The use of  MySQL  User name, by default  root . 
fg['Servers'][$i]['password'] = ''; //  Fill in corresponding to the above  MySQL  Password for the user name. 
#  And then restart ,httpd service 
[root@localhost ~]# service httpd restart

In the browser type http: / / localhost phpmyadmin can access.

If you have access problems, check SElinux.


Related articles: