installation configuration of lamp environment in Linux (linux+apache+mysql+php)

Source: Internet
Author: User
Tags localhost mysql readline

Install Centos6.5

First, VirtualBox virtual machine installation Centos6.5

1, the new virtual computer, select some parameters and configuration

2, into the Centos6.5 guide interface, select "Install or upgrade an existing system"

3, follow the steps step-by-step, to choose the installation method, select the URL method.


5, continue to follow the steps to set up network installation image

Http://mirrors.ustc.edu.cn/centos/6.5/os/x86_64/images/install.img

6. Receive Installation


7, the following series of steps follow the prompts step by step.

8, an important step: partition, select "Create Custom layout."


/boot Partition: 200M

/root partition: 20000M

/OPT Partition: The rest

swap:2048

9, continue to step by step and then choose to go on. Select Install package, we select "Basic Server"

10, into the installation process, waiting for installation.

11, restart complete.

installing MySQL


1, before installing MySQL, need to install CMake, because the CMake software source to compile.

Premise: by mounting the USB drive required to copy all the software to the system/root/soft

CMake Source Package Cmake-2.8.8.tar.gz,/root/soft/soft Directory

[Root@localhost ~]# Cd/root/soft/soft

[root@localhost/root/soft/soft]# TAR-XZVF cmake-2.8.8.tar.gz

[root@localhost/root/soft/soft]# CD cmake-2.8.8

[Root@localhost cmake-2.8.8]#./bootstrap

---------------------------------------------

CMake 2.8.4, Copyright 2000-2009 Kitware, Inc.

---------------------------------------------

Error when bootstrapping CMake:

Cannot find appropriate C compiler in this system.

Please specify one using environment variable CC.

Cmake_bootstrap.log for compilers attempted.

---------------------------------------------

Log of errors:/usr/local/src/cmake-2.8.4/bootstrap.cmk/cmake_bootstrap.log

---------------------------------------------

The above error prompt appears: Compiler for C is missing

Solution

Installing the GCC compiler

Simple to install with Yum

[root@localhost ~]# yum Install gcc

Continue the installation of CMake

[Root@localhost cmake-2.8.8]#./bootstrap

---------------------------------------------

CMake 2.8.4, Copyright 2000-2009 Kitware, Inc.

C compiler on this system IS:CC

---------------------------------------------

Error when bootstrapping CMake:

Cannot find appropriate C + + compiler on this system.

Please specify one of the using environment variable CXX.

Cmake_bootstrap.log for compilers attempted.

---------------------------------------------

Log of errors:/usr/local/src/cmake-2.8.4/bootstrap.cmk/cmake_bootstrap.log

---------------------------------------------

Error again: missing C + + compiler.

Installing the Gcc-c++ Compiler

Simple to install with Yum

[Root@localhost ~]# Yum Install gcc-c++

[Root@localhost cmake-2.8.8]#./bootstrap

After no error, compile the installation

[Root@localhost cmake-2.8.8]# Gmake

[Root@localhost cmake-2.8.8]# gmake Install

Check the installation which cmake see if the installation is correct

2, the official installation of MySQL

MySQL source package mysql-5.5.24.tar.gz in the/root/soft/soft directory

[Root@localhost ~]# Cd/root/soft/soft

[root@localhost/root/soft/soft]# TAR-XZVF mysql-5.5.24.tar.gz

root@localhost/root/soft/soft]# CD mysql-5.5.24

[Root@localhost mysql-5.5.24]# CMake.

Error:
--Could Curses (missing:curses_library Curses_include_path) CMake Error at cmake/readline.cmake:82 (message): C Urses Library not found. Please install appropriate package, remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package name are Libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call I): cmake/readline.cmake:126 (find_curses) cmake/readline.cmake:216 (mysql_use_bundled _libedit) cmakelists.txt:250 (mysql_check_readline)--Configuring incomplete, Errors occurred!
Solution:

[root@localhost mysql-5.5.24]# yum-y Install ncurses-devel*

[Root@localhost mysql-5.5.24]# RM CMakeCache.txt

[Root@localhost mysql-5.5.24]# CMake.

There is still a warning:

[root@localhost mysql-5.5.24]# Yum Install Bison

[Root@localhost mysql-5.5.24]# CMake.

[Root@localhost mysql-5.5.24]# make && Make install (complete compilation installation)

Add MySQL users and user groups
[Root@localhost ~]# Groupadd MySQL

[root@localhost ~]# useradd-g MySQL MySQL

Enter the installation directory, change the ownership of the program binaries to root, change the ownership of the data directory to MySQL user, update the authorization form

[Root@localhost mysql-5.5.24]# Cd/usr/local/mysql

[Root@localhost mysql]# chown-r root.

[Root@localhost mysql]# chown-r MySQL.

[Root@localhost mysql]# chgrp-r MySQL.

[Root@localhost mysql]# scripts/mysql_install_db--user=mysql (initialization database)

[Root@localhost mysql]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir =/usr/local/mysql/data (safely boot MySQL)

[Root@localhost mysql]#./bin/mysqld_safe--user=mysql (Close MySQL)

[Root@localhost mysql]#./bin/mysqladmin-u Root Shutdown-p

Default password is empty--easy to call, set a soft link for MySQL

[Root@localhost ~]# ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql

Other Settings processing:
Set the option file to copy the profile to/etc
[Root@localhost mysql]# CP support-files/my-medium.cnf/etc/mysql.cnf set up from boot

[Root@localhost mysql]# cp support-files/mysql.server/etc/init.d/mysql [root@localhost mysql]# chmod Mysql

[Root@localhost mysql]# Chkconfig–add mysqld

[Root@localhost mysql]# chkconfg mysqld on

The MySQL server can now be started and closed by service

[root@localhost ~]# service MySQL start

[root@localhost ~]# service MySQL shutdown

Connecting to a server

[Root@localhost ~]# mysql-u root-p

Install Apache


[root@localhost ~] #cd/root/soft/soft

[Root@localhost soft] #tar-ZXVF httpd-2.0.64.tar.gz//unzip the Apache compression pack

[Root@localhost Soft] #cd httpd-2.0.64//Navigate to httpd-2.0.64 folder

[Root@localhost Httpd-2.0.64#ls

[Root@localhost httpd-2.0.64]#./configure--prefix=/opt/ws/apache--enable-so//Configure Apache Path

[Root@localhost httpd-2.0.64] #make//Compiling Apache

[root@localhost httpd-2.0.64] #make Install//install Apache

[Root@localhost httpd-2.0.64] #cd/opt/ws/apache//into Apache directory

[Root@localhost apache]# CD conf/

[Root@localhost conf] #cp-a httpd.conf httpd.conf-//backup Apache configuration file

[Root@localhost conf] #chkconfig--list httpd//See if the HTTPD service already exists

[Root@localhost conf] #chkconfig httpd off//Shut down system with httpd service, if there is httpd service

[Root@localhost conf] #service httpd status//view httpd service status

[root@localhost conf]#/opt/ws/apache/bin/apachectl-k start//linux launch Apache command

[Root@localhost conf] #netstat-an | GREP:80//View linux80 port is open

[Root@localhost conf] #ps-aux | grep httpd//linux View the Apache process

[Root@localhost conf] #cd. /..

[Root@localhost Local] #cp/opt/ws/apache/bin/apachectl/etc/rc.d/init.d/apache//Copy Apache startup script

[Root@localhost Local] #vi/etc/rc.d/init.d/apache//Here is the edit Apache startup script

At the beginning of the #! /bin/sh, add www.111cn.net below.

#chkconfig: 2345 85 15

[Root@localhost Local] #chkconfig--add Apache//Add Apache Service

[Root@localhost Local] #chkconfig--list Apache//list Apache Service

[Root@localhost Local] #service Apache stop//stops Apache service

[Root@localhost Local] #netstat-an | GREP:80//View Linux 80 port is off

[Root@localhost Local] #ps-aux | grep httpd//See if the HTTPD service exists, if the previous launch with the HTTPD service will cause the newly added Apache service to fail to start

[Root@localhost Local] #service Apache start//Launch Apache Service


Installing PHP


(You must install LIBXML2 before installing PHP, so you can download LIBXML2 installation package)

[root@localhost ~] #cd/root/soft/soft

[Root@localhost soft] #tar-zxvf p.h.p.5.4.3tar.gz

[Root@localhost soft] #cd p.h.p.5.4.3

[Root@localhost p.h.p.5.4.3]#./configure--prefix=/opt/ws/php--with-apxs2=/usr/local/apache/bin/apxs--with-mysql =/usr/local/mysql--with-config-file-path=/usr/local/php--enable-mbstring=all


[Root@localhost p.h.p.5.4.3] #make

[root@localhost p.h.p.5.4.3] #make Install


configuration parameters of lamp environment


Configure HTTPD.CONF to have Apache support PHP:

Vim/usr/local/apache/conf/httpd.conf

Add the following:

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source. Phps

Modify php.ini file Register_globals = On

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.