Lamp Environment Construction

Source: Internet
Author: User

linux+apache+mssql+php builds Dynamic Web sites and Web servers, which are independent open source software, and are often used together to build Web application platforms.

This article refers to two articles on the network http://zzstudy.offcn.com/archives/9213 and http://www.jb51.net/article/39589.htm.

1. Linux system

Minimized installation CentOS6.5, so installing Apache,MySQL, and PHP to resolve dependencies on some packages, using yum–y install To install the required packages.

2. Check that the compilation tool used during installation is present:gcc–v. If not,yum–y install gcc-c++ the GCC tool, or you can use yum install make gcc gcc-c++ zlib-devel libaio–y Install all the tools you need.

3. View httpd,MySQL, and PHP:rpm-qhttpd because the installation LAMPis compiled MySQL php. Because I am minimizing the installation of CentOS, there is no such software. If there is a need to uninstall, command:rpm–e * * * * *.

[ start to build lamp environment ]

LAMP environment, according to the Apache->mysql->php order. Before installing php Php5 The latest repository files needed, such as libxml2 Libmcrypt gd2< Span style= "font-family: ' The song Body '; > libraries and other files. Install gd2 library is to let php5 support Gif and jpeg picture format, so install gd2< Span style= "font-family: ' The song Body '; > Before the library, install the latest Zlib " libpng, Freetype jpegsrc etc library file. And the middle will be interspersed with some software installed.

Decompression package software for tar.gz suffix

source code files are. tar.gz file types that unpack the package through the tar zxvf ***.tar.gz command.

Source code Package installation process

after decompression, because the software required for the LAMP environment is developed in the C language, so the installation of source code files requires configure ( config ), make ( compile ), and make install ( install ) three steps.

[ Install Apache Server ]

wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.29.tar.gz, can go to http// httpd.apache.org/download.cgi website Download Apache Source code package.

Tar zxvf httpd-2.2.29.tar.gz

CD httpd-2.2.29

./configure–prefix=/usr/local/apache/--enable-so--enable-rewrite–with-mpm=worker

Make && make install

Check the installation situation:

/usr/local/apache/bin/apachectl–l Verify that enable-rewriteandwith-mpm=worker are compiled correctly.

/usr/local/apache/bin/apachectl–t, the output "Syntax OK" indicates the normal start of Apache.

Enter the/usr/local/apache/ directory to check for the following files:bin build cgi-bin conf error htdocs icons include lib logs man Manual Modules.

start the Apache server and check if the port is on, and start the Apache Server command as follows:/usr/local/apache243/bin/apachectl start, If it does not start properly, remove the #ServerNamewww.example.com:80 comment from the/usr/local/apache/conf/httpd.conf file .

View Port command:NETSTAT-TNL | grep, you can see the corresponding information.

shutdown iptables:after service iptables stop , enter 192.168.85.128 in the browser address bar , the browser appears It works ! Apache Browser can be used.

Apache server boot automatically, as long as the "/etc/rc.d/rc.local" file, plus the Apache server Start command. You can open the "/etc/rc.d/rc.local" file directly, write the Apache boot command in the last line, or append it with the echo command, as shown in the following command line:echo " /usr/local/apache243/bin/apachectl start" >>/etc/rc.d/rc.local.

[ Install MySQL database management system ]

1. Add user name and user group

#groupadd MySQL

#useradd-G MySQL MySQL

2.Enter the source package using configure to check and configure the system environment required for installation and to generate the installation configuration file

Tar zxvf mysql-5.0.70.tar.gz

CD mysql-5.0.70

./configure--prefix=/usr/local/mysql--enable-thread-safe-client--with-extra-charsets=all

I encountered an error message :

Checking for tgetent in-lncurses ... no

Checking for tgetent in-lcurses ... no

Checking for tgetent in-ltermcap ... no

Checking for termcap functions library... configure:error:No curses/termcap Library found

cause : missing ncurses installation package

Solution :

Yum-y Install Ncurses-devel

re ./configure(config)

Make && make install

3, create the MySQL database server configuration file, you can use the source package support-files directory in the my-medium.cnf file as a template, copy it to /etc / directory, name the my.cnf file.

[email protected] mysql-5.0.70]# CP support-files/my-medium.cnf/etc/my.cnf

4. If you havenot installed MySQL, you must create a MySQL authorization form. Go to the installation directory /usr/local/mysql , execute the mysql_install_db script under the bin directory to initialize the MySQL The authorization table for the database, which stores the server access allowed.

[[email protected] mysql-5.0.70] #cd/usr/local/mysql

[[email protected] mysql]# bin/mysql_install_db--user=mysql// Create authorization Form

If you use the root user to run the above command, you should use the--user option, which should be the same as the login account (MySQL user ) you created to run the server in the first step . If you are logged in with a MySQL user to run the above command, you can omit the --user option. after you create the MySQL authorization table with mysql_install_db, you need to restart the server manually .

5. Change the ownership of theprogram binaries to the root user, and the ownership of the data directory to the MySQL user running the MYSQLD program . If you are now in the installation directory (/usr/local/mysql) , the command line is as follows:

[Email protected] mysql]# chown-r root. ( note a bit )// Change all properties of the file to the root user

[[email protected] mysql]# chown-r mysql var// Change all properties of data directory to MySQL user

[[email protected] mysql]# chgrp-r MySQL. Change group properties to MySQL group

6, after the necessary things are installed, you should use the following command to start the MySQL service, the command line is as follows:/usr/local/mysql/bin/mysqld_safe--user=mysql &

7,after the MySQL database server started, check if its port 3306 is open, if you see the following results indicate that the MySQL service started successfully. The command line is as follows : Netstat-tnl|grep 3306.

8.use mysqladmin to verify that the server is running. The following command provides a simple test that checks to see if the server is turned on and responds to the connection. The command line is as follows:bin/mysqladmin version.


This article is from the "Black Ice" blog, please be sure to keep this source http://5740675.blog.51cto.com/5730675/1584855

Lamp Environment Construction

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.