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

How Redhat Linux compiles and installs the LAMP environment

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how Redhat Linux compiles and installs the LAMP environment. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

One: prepare the software package

Store it in / home/xiutuo/software/ directory.

Main software packages:

1. Httpd-2.2.6.tar.gz

2. Mysql-5.0.45-linux-i686-glibc23.tar.gz (this version is a compiled compressed package that can be used with a little configuration after decompression)

3. Php-5.2.5.tar.gz

Install the software packages required for php (where libxml2 is necessary to install php5.)

1. Libxml2- (version). Tar.gz-> http://ftp.gnome.org/pub/GNOME/sources/libxm2

2. Libxslt- (version). Tar.gz-> http://ftp.gnome.org/pub/GNOME/sources/libxslt

3. Curl- (version). Tar.gz-> http://curl.haxx.se/download

Software packages required for the GD library (some people say that GD2.0.28 and zlib are included in the PHP source package, as long as you install GD's three support packages: jpg,png and freetype, but we still download)

1. Gd- (version) .tar.gz-> http://www.libgd.org/Main_Page or http://www.libgd.org/releases/

2. Freetype- (version). Tar.gz-> http://sourceforge.net/projects/freetype

3. Jpegsrc.v6b.tar.gz-> http://ijg.org/files/jpegsrc.v6b.tar.gz

4. Libpng- (version). Tar.gz-> http://www.libpng.org/pub/png/libpng.html

5. Zlib-1.2.3.tar.gz-> http://www.zlib.net

Download all the above packages to: / root/Software/ directory.

Two: install mysql

# tar-zvxf mysql-5.0.45-linux-i686-glibc23.tar.gz

# mkdir-p / usr/local/mysql

# cp-r mysql-5.0.45 / usr/local/mysql

# cp / usr/local/mysql/support-files/mysql.server / etc/rc.d/init.d/mysql / / boot mysql

# cp / usr/local/mysql/support-files/my-medium.cnf / etc/my.cnf

Add mysql users and user groups

# groupadd mysql

# useradd-g mysql mysql

Modify mysql directory permissions

# chown-R root / usr/local/mysql

# chgrp-R mysql / usr/local/mysql

# chown-R mysql/ usr/local/mysql/data

Generate mysql system database

# / usr/local/mysql/scripts/mysql_install_db-- user=mysql& / / start the mysql service

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

If Starting mysqld daemon with databases from / usr/local/mysql/data appears, the mysql service will be started normally.

Press Ctrl + C to jump out and change the root password of mysql

# / usr/local/mysql/bin/mysqladmin-u root-p password "123456"

Third: install the GD library (let PHP support GIF,PNG,JPEG)

a. Install jpeg6 to create a directory:

# mkdir-p / usr/local/jpeg6

# mkdir-p / usr/local/jpeg6/bin

# mkdir-p / usr/local/jpeg6/lib

# mkdir-p / usr/local/jpeg6/include

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

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

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

# cd / root/Software/

# tar-zvxf jpegsrc.v6b.tar.gz

# cd jpeg6

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

# make

# make install

B.libpng package (supports PNG)

# cd / root/Software/

# tar-zvxf libpng- (version). Tar.gz

# cd libpng- (version)

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

# make

# > make install

c. Install freetype

# cd / root/Software/

# tar-zvxf freetype- (version). Tar.gz

# cd freetype- (version)

# mkdir-p / usr/local/freetype

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

# make

# make install

d. Install zlib

# cd / root/Software/

# tar-zxvf zlib-1.2.3.tar.gz

# cd zlib.1.2.3

# mkdir / usr/local/zlib

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

# make

# make install

e. Install the GD library

# cd / root/Software/

# tar-zvxf gd- (version). Tar.gz

# mkdir-p / usr/local/gd2

# cd gd- (version)

#. / configure-prefix=/usr/local/gd2-with-jpeg=/usr/local/jpeg6-with-zlib-dir=/usr/local/zlib-with-png=/usr/local/libpng-with-freetype=/usr/local/freetype

# make

# make install

e. Install Curl library

# cd / root/Software/

# tar-zxf curl- (version). Tar.gz

# mkdir-p / usr/local/curl

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

# make

# make install

Four: install apache2

# cd / roo/Software/

# tar-zvxf httpd-2.2.6.tar.gz

# cd httpd-2.2.6

# mkdir-p / usr/local/apache2

#. / configure-prefix=/usr/local/apache-enable-modules=so-enable-rewrite

# make

# make install

# / usr/local/apache2/bin/apachectl-k start / / launch apahce

Use the browser to view http://localhost, to get it works, indicating that apache has been configured successfully.

# / usr/local/apache2/bin/apachectl-k stop / / stop apache

Five: install php5

Php5 must have libxml2 support!

a. Install libxml2

# cd / root/Software/

# tar-zvxf libxml2- (version). Tar.gz

# cd libxml2- (version)

# mkdir-p / usr/local/libxml2

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

# make

# make install

b. Install libxslt (optional installation, you do not have to install)

# cd / root/Software/

# tar-zvxf libxslt- (version). Tar.gz

# mkdir-p / usr/local/libxslt

# cd libxslt- (version)

#. / configure-prefix=/usr/local/libxslt-with-libxml-prefix=/usr/local/libxml2

# make

# make install

c. Install php5

# cd / root/Software/

# tar-zvxf php- (version). Tar.gz

# mkdir-p / usr/local/ php5

# cd php- (version)

#. / configure-prefix=/usr/local/ php5-with-apxs2=/usr/local/apache2/bin/apxs\

>-with-gd=/usr/local/gd2-with-jpeg-dir=/usr/local/jpeg6\

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

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

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

>-enable-trace-vars-with-mysql=/usr/local/mysql\

>-enable-mbstring=all-with-curl=/usr/local/curl-enable-mbregex\

>-with-config-file-path=/usr/local/ php5-enable-ftp\

>-enable-soap-with-xsl=/usr/local/libxslt

# make

# make install

# cp php.ini-dist / usr/local/ php5/ php.ini (don't forget hehe)

Six: reconfigure apache2 to support php

# cd / usr/local/apache2/conf

# vim httpd.conf

In LoadModule php5_module modules/lib php5.so

Add AddType application/x-httpd- php. Php

OK, the basic installation has been completed. Restart APACHE:

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

If the restart APACHE appears:

Syntax error on line 232 of / usr/local/apache2/conf/httpd.conf: Cannot load / usr/local/apache2/modules/lib php5.so into server:

/ usr/local/apache2/modules/lib php4.so: cannot restore segment prot after reloc: Permission denied

Then it should be solved in the following way:

1.chcon-t texrel_shlib_t / usr/local/apache2/modules/*.so

two。 Edit / etc/selinux/config, find this paragraph:

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing-SELinux security policy is enforced.

# permissive-SELinux prints warnings instead of enforcing.

# disabled-SELinux is fully disabled.

SELINUX=enforcing

Comment out the SELINUX=enforcing: # SELINUX=enforcing, and then add a new line:

SELINUX=disabled

Save, close.

Edit / etc/sysconfig/selinux, find:

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing-SELinux security policy is enforced.

# permissive-SELinux prints warnings instead of enforcing.

# disabled-SELinux is fully disabled.

SELINUX=enforcing

If SELINUX is already SELINUX=disabled, you don't need to change it, otherwise comment out SELINUX=enforcing and add a new line:

SELINUX=disabled

Save, exit.

So much for the introduction of the ok,web environment apache2+mysql5+ php5. For more detailed configuration of apache2 and mysql and php.ini, refer to the corresponding documentation.

The above is how Redhat Linux compiles and installs the LAMP environment. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow 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

Servers

Wechat

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

12
Report