centos7 installed lamp

LAMP, Linux Apache Mysql / MariaDB PHP / Perl / Python is a very decade ago set fire station architecture, simple configuration can quickly build websites, although for high concurrency business powerless, but after all, a very good small projects solution.

The months contact several open source projects is also based lamp to do, therefore I am finishing a LAMP deployment and tutorials based on the information found in some of their own habits.

According to my contact with the project, this time finishing installing Apache, Mysql, Php, users install the full selection of root in a centos in.

 


First, the preparatory work

1.1 Environment

OS: centos7 (CentOS-7-x86_64-Minimal-1708)

:( The hardware configuration recommendations based on project operations and settings, I usually first with a 1-core 1G)

 

1.2 Close selinux

# Modify the selinux profile

vim /etc/selinux/config

 

The content SELINUX = enforcing modify disabled as SELINUX =, wq save.

 

# This does not restart closed selinux

setenforce 0

 

1.3 Update

yum update -y

 

1.4 install vim, wget

yum install -y vim wget

 

 


Second, deploy apache

 2.1 Installation

yum install -y httpd

 

 2.2 Start Service

 # Start apache

systemctl start httpd

 

 # boot

systemctl enable httpd

 

View apache version 2.3

httpd -v

 You can see the apache installation is 2.4.6, you can also know apache installed successfully.

 

2.4 open port 80

 # Add 80 permanent port open 

firewall-cmd --add-port=80/tcp --permanent

 

 # Firewall changes take effect immediately 

firewall-cmd --reload

  

 


Third, the deployment mysql

3.1 Installation

 # Get rpm package

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

 

 # Install the rpm package

rpm -ivh mysql-community-release-el7-5.noarch.rpm

 

 # Install mysql 

yum install -y mysql-community-server

 

 3.2 start

 # start up 

systemctl start mysql

 

 # boot

systemctl enable mysql

 

 3.3 Changing the root password and allow remote connections provided

 # Enter mysql  

mysql -uroot

 

 Set the root password is 123456 #

mysql> set password for 'root'@'localhost' =password('123456');

 

 # Set to allow remote connections using the root account, and set the password is 123456

mysql> grant all privileges on *.* to root@'%'identified by '123456';

 

 # Modified configuration take effect immediately

mysql> flush privileges;

 

 # drop out

mysql> exit;

 

Check mysql version 3.4

mysql -V

  


Fourth, deploy php

4.1 Installation

yum install -y php

 

4.2 components are installed php mysql support 

phpv5.4

yum install -y php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash

 phpv5.6 command if you need to install this version, to run the following

yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-MySQL php56w-intl php56w-mbstring -- --skip-broken

 

 View version 4.3 php 

php --version

 

 4.4 View Details

 # New file phpmess.php 

vim /var/www/html/phpmess.php

 

 Add the following content, wq save.

<?php
    phpinfo();
?>

 

Browser access ip / phpmess.php view, the emergence of something like this shows php installation is successful.

 

 

If PHP 5.4 is already installed, upgrade please do so

1: After entering the terminal to view the version of PHP: php -v
output may be as follows:

PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

2:执行下面的命令升级软件仓库

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3:执行下面的命令删除php

yum remove php-common

然后像安装那样问你是否继续的,输入yes即可
4:安装php 5.6版本(php56w-devel这个不是必需的)

yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-MySQL php56w-intl php56w-mbstring  --skip-broken

5:重启httpd:service httpd restart
查看最新的版本:php -v
现在应该是5.6了

Guess you like

Origin www.cnblogs.com/dshvv/p/11345039.html