Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing LAMP running Environment with Source Code under CentOS6.3

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge points of this article, "CentOS6.3 source code installation of LAMP operating environment" article, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "CentOS6.3 source code installation of LAMP operating environment" article.

I. brief introduction

What is lamp?

Lamp is a kind of web network application and development environment, which is the abbreviation of linux, apache, mysql, php/perl. Each letter represents a component, and each component is a very powerful component in the aspects it represents.

The origin of the word lamp originated from the German magazine Cleart magazine, and michael kunze first combined these projects to create the acronym of lamp in 1990. These components are not designed to be used together from the beginning, but they are open source and can be easily available and used free of charge, which leads to the frequent use of these components together. The compatibility of these components is also improving. In order to improve the cooperation between different components, some extended functions have been created, and the application situation together has become very common, so it has become the most popular web application infrastructure.

Components of lamp

The platform consists of four hierarchical components, each of which provides a key part of the overall architecture:

Linux:linux is at the bottom and provides an operating system. Its flexibility and customizability mean that it can produce a highly customized platform on which other components can run. Other components run on linux, but are not necessarily limited to linux, but can also run on microsoft windows, mac os x, or unix.

Apache:apache, located at the second layer, is a web service platform that provides a mechanism for users to access web pages. Apache is a powerful, stable, mission-critical web server that is used as a web server by more than 50% of websites on internet.

Mysql:mysql is the most popular open source relational database management system and is the data storage side of lamp. In web applications, all account information, product information, customer information, business data, and other types of information are stored in a database, which can be easily queried through the sql language.

Php/perl:perl is a flexible language, especially when dealing with text elements, this flexibility makes it easy for perl to deal with data provided through the cgi interface, and flexibly uses text files and simple databases to support dynamic elements. Php is a widely used open source multi-purpose scripting language, which can be embedded in html, especially suitable for web development. You can use php to write dynamic content that can access data in an mysql database and some of the features provided by linux.

II. System environment

System platform: centos release 5.8 (final)

Apache version: httpd-2.2.9.tar.gz

Mysql version: mysql-5.0.41.tar.gz

Php version: php-5.2.6.tar.gz

Third, prepare before installation

1. Preparation of library files

Before installing php, you should install the latest version of the library files required by php5, such as libxml2, libmcrypt, and gd2 libraries. The GD2 library is installed to allow php5 to support gif, png and jpeg image formats, so install the latest zlib, libpng, freetype and jpegsrc library files before installing the gd2 library. And there will be some software installed in the middle, which readers can install in the order provided in this section.

Autoconf-2.61.tar.gz

Freetype-2.3.5.tar.gz

Gd-2.0.35.tar.gz

Jpegsrc.v6b.tar.gz

Libmcrypt-2.5.8.tar.gz

Libpng-1.2.31.tar.gz

Libxml2-2.6.30.tar.gz

Zlib-1.2.3.tar.gz

Zendoptimizer-3.2.6-linux-glibc21-i386.tar.gz

Phpmyadmin-3.0.0-rc1-all-languages.tar.gz

2. Install gcc and gcc-c++ compilers

Use the gcc-v command to check whether the compilation work used during installation exists

If the system is not installed, use yum install gcc and yum install gcc-c++ to install when the system is connected to the network

3. Uninstall the default low-version environment

Among the currently released versions of the linux operating system, if you choose to install all by default, the lamp environment will already be installed, but the versions are relatively low. We can install another lamp environment that coexists with the original, but this is not necessary because only one lamp environment can be opened at the same time. Before installing, we should check whether a lower version of the environment has been installed in the system, and if so, stop the original service, or uninstall the original environment.

a. Uninstall apache

# rpm-qa | grep httpd

Description: check if the httpd package is installed

# rpm-e httpd-2.2.3-63.el5.centos-- nodeps

Description: uninstall the software package,-- if nodeps is associated, it is also forced to uninstall.

# cd / etc/httpd/

# rm-rf *

Description: go to the original apache installation directory and delete all its installation directories and files

b. Uninstall mysql

# rpm-qa | grep mysql

# rpm-e mysql-5.0.77-4.el5_4.2-- nodeps

Description: uninstall mysql

c. Uninstall php

# rpm-qa | grep php

# rpm-e php-common-5.1.6-27.el5-- nodeps

# rpm-e php-ldap-5.1.6-27.el5-- nodeps

# rpm-e php-cli-5.1.6-27.el5-- nodeps

# rpm-e php-5.1.6-27.el5-- nodeps

Description: uninstall php

4. Close selinux and clear the firewall rules.

5. Use ssh shell to upload 13 source code packages under windows to / usr/local/src

6. Unpack

Write a shell script tar.sh to unpack.

#! / bin/sh cd / usr/local/srcls * .tar.gz > ls.list for tar in `cat ls.list`dotar-zxvf $tardone

Execute the script tar.sh to unpack

7. Delete all source code packages * .tar.gz

Fourth, install lamp

1. Install libxml2

# cd / usr/local/src/libxml2-2.6.30

#. / configure-prefix=/usr/local/libxml2

# make & & make install

2. Install libmcrypt

# cd / usr/local/src/libmcrypt-2.5.8

#. / configure-prefix=/usr/local/libmcrypt

# make & & make install

3. Install zlib

# cd / usr/local/src/zlib-1.2.3

#. / configure

# make & & make install

4. Install libpng

# cd / usr/local/src/libpng-1.2.31

#. / configure-prefix=/usr/local/libpng

# make & & make install

5. Install jpeg6

The installation of this package is something special. if the directory of other packages does not exist, it will be created automatically, but this package needs to be created manually when it is installed.

# mkdir / usr/local/jpeg6

# mkdir / usr/local/jpeg6/bin

# mkdir / usr/local/jpeg6/lib

# mkdir / usr/local/jpeg6/include

# mkdir-p / usr/local/jpeg6/man/man1

# cd / usr/local/src/jpeg-6b

#. / configure-prefix=/usr/local/jpeg6/-enable-shared-enable-static

# make & & make install

6. Install freetype

# cd / usr/local/src/freetype-2.3.5

#. / configure-prefix=/usr/local/freetype

# make

# make install

7. Install autoconf

# cd / usr/local/src/autoconf-2.61

#. / configure

# make & & make install

8. Install the GD library

# cd / usr/local/src/gd-2.0.35

#. / configure\

-- prefix=/usr/local/gd2/\

-- enable-m4_pattern_allow\

-- with-zlib=/usr/local/zlib/\

-- with-jpeg=/usr/local/jpeg6/\

-- with-png=/usr/local/libpng/\

-- with-freetype=/usr/local/freetype/

# make

An error occurred:

Make [2]: * * [gd_png.lo] error 1

Make [2]: leaving directory `/ usr/local/src/gd-2.0.35'

Make [1]: * * [all-recursive] error 1

Make [1]: leaving directory `/ usr/local/src/gd-2.0.35'

Make: * * [all] error 2

Analysis: this problem is caused by the failure of png.h to find png.h when the source file gd_png.c in the gd library contains png.h.

Resolve:

In the compiled file

# vi gd_png.c

Change include "png.h" to include "/ usr/local/libpng/include/png.h"

Where / usr/local/libpng/ is the libpng installation path.

# make install

9. Install apache

# cd / usr/local/src/httpd-2.2.9

#. / configure\

-- prefix=/usr/local/apache2\

-- sysconfdir=/etc/httpd\

-- with-z=/usr/local/zlib\

-- with-included-apr\

-- enable-so\

-- enable-deflate=shared\

-- enable-expires=shared\

-- enable-rewrite=shared\

-- enable-static-support

# make & & make install

10. Configure apache

Start apache

# / usr/local/apache2/bin/apachectl start

Close apache

# / usr/local/apache2/bin/apachectl stop

Check to see if port 80 is open

# netstat-tnl | grep 80

Access the apache server

Add self-startup

# echo "/ usr/local/apache2/bin/apachectl start" > > / etc/rc.d/rc.local

11. Install mysql

Add a mysql standards group

# groupadd mysql

Add mysql users to the mysql group

# useradd-g mysql mysql

# cd / usr/local/src/mysql-5.0.41

#. / configure\

-- prefix=/usr/local/mysql/\

-- with-extra-charsets=all

An error occurred:

Checking for tgetent in-lncurses... No

Checking for tgetent in-lcurses... No

Checking for tgetent in-ltermcap... No

Checking for tgetent in-ltinfo... No

Checking for termcap functions library... Configure: error: no curses/termcap library found

Analysis: missing ncurses installation package

Resolve:

# yum install ncurses-devel

# make & & make install

12. Configure mysql

Create a configuration file for the mysql database server

# cp support-files/my-medium.cnf / etc/my.cnf

Create the authorization table with the mysql user. After the creation is successful, a var directory is generated under the / usr/local/mysql directory.

# / usr/local/mysql/bin/mysql_install_db-user=mysql

Change all attributes of the file to root users

# chown-r root / usr/local/mysql

Change all attributes of the data directory to mysql users

# chown-r mysql/ usr/local/mysql/var

Change group properties to mysql group

# chgrp-r mysql / usr/local/mysql

Start the database

# / usr/local/mysql/bin/mysqld_safe-- user=mysql &

Check to see if port 3306 is open

# netstat-tnl | grep 3306

A simple test

# / usr/local/mysql/bin/mysqladmin version

View all mysql parameters

# / usr/local/mysql/bin/mysqladmin variables

Set mysql Boot self-boot

# cp / usr/local/src/mysql-5.0.41/support-files/mysql.server / etc/rc.d/init.d/mysqld

# chown root.root / etc/rc.d/init.d/mysqld

# chmod 755 / etc/rc.d/init.d/mysqld

# chkconfig-add mysqld

# chkconfig-list mysqld

# chkconfig-- levels 245 mysqld off

13. Mysql security settings

You can log in to the local server directly without a password.

# / usr/local/mysql/bin/mysql-u root

View mysql user rights information

Mysql > select * from mysql.user

Delete non-localhost hosts

Mysql > delete from mysql.user where host='localhost' and user=''

Refresh authorization table

Mysql > flush privileges

Add a password for the root user

Mysql > set password for 'root'@'localhost' = password (' abc123')

Re-enter the mysql client

# / usr/local/mysql/bin/mysql-u root-h localhost-p

Shut down the mysql database

# / usr/local/mysql/bin/mysqladmin-u root-p shutdown

14. Install php

# cd / usr/local/src/php-5.2.6

#. / configure\

-- prefix=/usr/local/php\

-- with-config-file-path=/usr/local/php/etc\

-- with-apxs2=/usr/local/apache2/bin/apxs\

-- with-mysql=/usr/local/mysql/\

-- with-libxml-dir=/usr/local/libxml2/\

-- with-png-dir=/usr/local/libpng/\

-- with-jpeg-dir=/usr/local/jpeg6/\

-- with-freetype-dir=/usr/local/freetype/\

-- with-gd=/usr/local/gd2/\

-- with-zlib-dir=/usr/local/zlib/\

-- with-mcrypt=/usr/local/libmcrypt/\

-- with-mysqli=/usr/local/mysql/bin/mysql_config\

-- enable-soap\

-- enable-mbstring=all\

-- enable-sockets

# make & & make install

15. Configure php

Create a profile

# cp php.ini-dist / usr/local/php/etc/php.ini

Use vi to edit apache configuration files

# vi / etc/httpd/httpd.conf

Add this code

Addtype application/x-httpd-php .php .phtml

Restart apache

# / usr/local/apache2/bin/apachectl restart

The above installation steps can be written as a shell script, please refer to

16. Install the zend accelerator

# cd / usr/local/src/zendoptimizer-3.2.6-linux-glibc21-i386/

#. / install.sh

17. Install phpmyadmin

Copy the directory to the specified location and rename it to phpmyadmin

# cp-a phpmyadmin-3.0.0-rc1-all-languages / usr/local/apache2/htdocs/phpmyadmin

# cd / usr/local/apache2/htdocs/phpmyadmin/

# cp config.sample.inc.php config.inc.php

18. Configure phpmyadmin

# vi / usr/local/apache2/htdocs/phpmyadmin/config.inc.php

Change auth_type to http

$cfg ['servers'] [$I] [' auth_type'] = 'http'

5. Testing

1. Write an info.php file to view the php configuration details

# vi / usr/local/apache2/htdocs/info.php

Visit http://10.0.0.154/info.php through the browser to get the detailed configuration information of php

2. Zend accelerator information

3. Visit phpmyadmin

The above is about the content of this article on "how to install LAMP running environment with source code under CentOS6.3". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report