Compiling and installing lamp on CentOS 7

Source: Internet
Author: User

1. Compile and install httpd-2.4.10

(1) First install "Developmenttools" and "Server Platform development"

~]# Yum groupinstall-y "Development Tools" "Serverplatform development"

(2) Install the enhanced Regular Expression Analyzer pcre-devel, and Openssl-devel,apr-devel,apr-util-devel,libevent-devel

~]# Yum install-y pcre-devel openssl-devel apr-develapr-util-devel libevent-devel

(3) Download the httpd-2.4.10 source package and expand it.

~]# Tar xvf httpd-2.4.10.tar.bz2

(4) Making makefile file

./configure--prefix=/usr/local/apache24--sysconfdir=/etc/httpd24--enable-so--enable-ssl--enable-cgi-- Enable-rewrite--enable-modules=most--enable-mpms-shared=all--with-mpm=prefork--with-pcre--with-zlib--with-apr= /usr--with-apr-util=/usr

(5) Compile and install httpd-2.4.10

~]# make && make install

(6) Import httpd related executable file search path to environment variable

~]# vim/etc/profile.d/http24.sh

Exportpath=/user/local/apache24/bin: $PATH

~]# source/etc/profile.d/http24.sh

(7) Make the library file soft link to/usr/incloud/httpd

~]# ln-sv/usr/local/apache24/incloud/use/incloud/httpd

(8) Start httpd service

~]# Apachectl Start

2. Installing mariadb-5.5.46

(1) Unzip the mariadb-5.5.46-tar.gz into the/usr/local directory

~] #tar xvf mariadb-5.5.46-tar.gz-c/usr/local

(2) Create a data Catalog for MARIADB

~] #mkdir-pv/data/mydata

~] #chown-R mysql:mysql/data/mydata

(3) Link the extracted directory to the/usr/local/mysql directory for later scrolling

~] #ln-sv/usr/local/mariadb-5.5.46/usr/local/mysql

(4) Change all the files in the/usr/local/mysql directory to root and the group to MySQL

~] #cd/usr/local/mysql

~] #chown-R root:mysql./*

(5) Initialize MARIADB

~] #cd/usr/local/mysql

~] #scripts/mysql_install_db--user=mysql--datadir=/data/mydata

(6) Editing the configuration file

~] #cp support-files/my-large.cnf/etc/my.cnf

~] #vim/etc/my.cnf

Datadir=/data/mydata

Innodb_file_per_table= on

Skip_name_resolve= on

(7) Startup script

~] #cp Support-files/mysql.server/etc/rc.d/init.d/mysqld

~] #chmod +x/etc/rc.d/init.d/mysqld

(8) Import mariadb related executable file search path to environment variable

~] #vim/etc/profile.d/mysql.sh

Exportpath=/usr/local/mysql/bin: $PATH

~] #source/etc/profile.d/mysql.sh

(9) Start mariadb

~] #service mysqld Start

3. Compile and install php-5.5.40

(1) Install PHP-dependent packages, Libxml2-devel,gd-devel,freetype-devel,libmcrypt-devel

~] #yum install-y libxml2-devel gd-devel freetype-devel libmcrypt-devel

(2) Download php-5.4.40 and expand

~] #tar XVF php-5.4.40.tar.bz2

(3) Making makefile files with configure scripts

~] #cd php-5.4.40

~]#./configure--prefix=/usr/local/php54--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/local/ Mysql/bin/mysql_config--enable-mbstring--enable-xml--enable-sockets--with-freetype-dir-- WITH-GD--WITH-LIBXML-DIR=/USR--with-zlib--with-jpeg-dir--with-png-dir--with-mcrypt--with-apxs2=/usr/local/ Apache24/bin/apxs--with-config-file-path=/etc/php54.ini--with-config-file-scan-dir=/etc/php54.d

(4) Compile and install

~] #make && make install

(5) Making configuration files

~] #cp Php.ini-production/etc/php.ini

(6) Add MIME type

~] #vim/etc/httpd24/httpd.conf

addtypeapplication/x-httpd-php. php

(7) indicates that the default page type is index.php

~] #vim/etc/httpd24/httpd.conf

directoryindexindex.php index.html

4. Make a test page to test

~] #mv/usr/local/apache24/htdocs/index. {html,php}

~] #vim/usr/local/apache24/htdocs/index.php

<?php

Phpinfo ();

?>

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/84/6D/wKiom1eQfFeQ09h4AAB2xiIpPUg586.png-wh_500x0-wm_3 -wmp_4-s_3747940894.png "title=" 1.png "alt=" Wkiom1eqffeq09h4aab2xiippug586.png-wh_50 "/>

5. Test the database connection

(1) Create a database TestDB in mariadb, create a user testuser, and authorize the user:

~]# MySQL

mariadb[(none)]>createdatabase TestDB;

mariadb[(none)]>createuser ' testuser ' @ ' 127.0.0.1 ' identified by ' testpasswd ';

mariadb[(None)]>grantall on testdb.* to ' testuser ' @ ' 127.0.0.1 ';

mariadb[(None)]>flushprivileges;

(2) Edit the default home page file/var/www/html/index.php, and write the following script to test:

<?php

$conn = mysql_connect (' 127.0.0.1 ', ' testuesr ', ' testpasswd ');

If ($conn)

echo "OK";

Else

echo "Falure";

?>

(3) test on the browser

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/84/6D/wKioL1eQfJTzevmXAABIblWapYY676.png-wh_500x0-wm_3 -wmp_4-s_449882540.png "title=" 2.png "alt=" Wkiol1eqfjtzevmxaabiblwapyy676.png-wh_50 "/>

6. Install WordPress and phpMyAdmin

(1) Comment out #documentroot "/usr/local/apache24/htdocs" in httpd master configuration file

Uncomment the include/etc/httpd24/extra/httpd-vhosts.conf.

(2) Creation of two virtual hosts www1.magedu.com and www2.mage.com

~] #mkdir-pv/vhost/www{1,2}

~] #vim/etc/httpd24/extra/httpd-vhosts.conf

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/84/6D/wKiom1eQfMKwdb2nAABmCumO2Nw241.png "title=" 3.png " alt= "Wkiom1eqfmkwdb2naabmcumo2nw241.png"/>

(3) Download worepress and unzip to the/vhost/www1/directory, modify the configuration file:

~] #mv wp-config-sample.php wp-config.php

~] #vim wp-config.php

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/84/6D/wKioL1eQfOrBhHJCAAAtdNggsMM879.png "title=" 4.png " alt= "Wkiol1eqforbhhjcaaatdnggsmm879.png"/>

(4) test www1.magedu.com domain name

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/84/6D/wKiom1eQfRbzNyehAACyL9c_J5s064.png "title=" 5.png " alt= "Wkiom1eqfrbznyehaacyl9c_j5s064.png"/>

(5) Download the phpMyAdmin and unzip to the/VHOST/WWW2 directory and rename the config file:

~] #mv config.sample.inc.php config.inc.php

(6) Generate a random string with OpenSSL and fill in the corresponding location of the configuration file and modify the MySQL server IP:

~] #openssl rand-base64 10

~]# Vim config.inc.php

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/84/6D/wKioL1eQfU-yIM2xAAALwOyr0-0540.png "title=" 6.png " alt= "Wkiol1eqfu-yim2xaaalwoyr0-0540.png"/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/84/6D/wKiom1eQfVvBdbyYAAAJdEajVxA114.png "title=" 7.png " alt= "Wkiom1eqfvvbdbyyaaajdeajvxa114.png"/>

(7) Open the www2.magedu.com test phpMyAdmin in the browser:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/84/6D/wKiom1eQfXCxXGCUAADRABRQz_8456.png "title=" 8.png " alt= "Wkiom1eqfxcxxgcuaadrabrqz_8456.png"/>

Compiling and installing lamp on CentOS 7

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.