Installation Steps and instructions for lamp environment configuration and installation

Source: Internet
Author: User
Pay attention to the installation steps and instructions for lamp environment configuration and installation. (1) install gcc

Gcc

Glibc-devel

Glibc-headers

Kernel-headers

Libgomp

Gcc-C ++

Libstdc ++-devel

(2) install the zlib compression library

Zlib-1.2.5.tar.gz

Shell>CD/home/Shuhua/tar

Shell>Tar-zxvf zlib-1.2.5.tar.gz

Shell>CD zlib-1.2.5

Shell>./Configure // This configuration compilation command does not add directory Parameters

Shell>Make & make install

(3) install Apache

Shell>CD/home/Shuhua/tar

Shell>Tar-jxvf httpd-2.2.19.tar.bz2

Shell>CD httpd-2.2.19

Shell>./Configure -- prefix =/usr/local/http2 \

-- Enable-modules = all \

-- Enable-Rewrite \

-- Enable-mod-shared = all \

-- Enable-so

Shell>Make & make install

# Start Apache

Shell>/Usr/local/http2/bin/apachectl start

# Test Apache

Open the browser: http: // Virtual Machine IP Address

See "It works! ", That is, success

Configure a VM

1) configure the host file

Open the C:/Windows/system32/Drivers/etc/hosts file

Add Domain Name Records

For example:

192.168.1.246 www.ec1.com

192.168.1.246 www.ec2.com

2) Add a VM

VI/usr/local/http2/CONF/httpd. conf

Cancel # include CONF/extra/httpd-vhosts.conf

# Before this line

Save and exit

VI/usr/local/http2/CONF/extra/httpd-vhosts.conf

Add VM records

<Virtualhost *: 80>

Serveradmin [email protected]

DocumentRoot "/usr/local/http2/htdocs/EC1"

Servername www.ec1.com

Serveralias www.dummy-host.example.com

Errorlog "log/dummy-host.example.com-error_log"

Customlog "logs/dummy-host.example.com-access_log" common

</Virtualhost>

<Virtualhost *: 80>

Serveradmin [email protected]

DocumentRoot "/usr/local/http2/htdocs/EC2"

Servername www.ec2.com

Errorlog "log/dummy-host2.example.com-error_log"

Customlog "logs/dummy-host2.example.com-access_log" common

</Virtualhost>

3)

Shell> Cd/usr/local/http2/htdocs

Shell> mkdir EC1 EC2

Shell> echo this is ec1.com> EC1/index.html

Shell> echo this is ec2.com> EC2/index.html

4) Restart Apache

/Usr/local/http2/bin/apachectl restart

5) Open www.ec1.com and www.ec2.com in the browser.

You can see different website content. The VM has been created!

Install the graphics library to prepare for PHP Compilation

Libxml2-2.7.2.tar.gz

Jpegsrc.v8b.tar.gz

Libpng-1.4.3.tar.gz

Freetype-2.4.1.tar.gz

Gd-2.0.35.tar.gz

(4) install libxml2

Shell>CD/home/Shuhua/tar

Shell>Tar zxvf libxml2-2.7.2.tar.gz

Shell>CD libxml2-2.7.2

Shell>./Configure -- prefix =/usr/local/libxml2

Shell>Make & make install

(5) install iis8

Shell>CD/home/Shuhua/tar

Shell>Tar-zxvf restart src.v8b.tar.gz

Shell>CD jpeg-8b

Shell>./Configure -- prefix =/usr/local/JPEG \

-- Enable-shared -- enable-static

Shell>Make & make install

(6) install libpng

Shell>CD/home/Shuhua/tar

Shell>Tar zxvf libpng-1.4.3.tar.gz

Shell>CD libpng-1.4.3

Shell>./Configure # do not include parameters like zlib, so that it is installed in the corresponding directory by default.

Shell>Make & make install

(7) install FreeType

Shell>CD/home/Shuhua/tar

Shell>Tar zxvf freetype-2.4.1.tar.gz

Shell>CD freetype-2.4.1

Shell>./Configure -- prefix =/usr/local/FreeType

Shell>Make & make install

(8) install the GD library

Shell>CD/home/Shuhua/tar

Shell>Tar-zvxf gd-2.0.35.tar.gz

Shell>Mkdir-P/usr/local/GD

Shell>CD gd-2.0.35

Shell>./Configure -- prefix =/usr/local/GD \

-- With-JPEG =/usr/local/JPEG /\

-- With-PNG -- With-zlib \

-- With-FreeType =/usr/local/FreeType

Shell>Make & make install

(9) install PhP5

Shell>CD/home/Shuhua/tar

Shell>Tar-jxvf php-5.3.6.tar.bz

Shell>CD php-5.3.6

Shell>./Configure -- prefix =/usr/local/PHP \

-- With-apxs2 =/usr/local/http2/bin/apxs \

-- With-mysql = mysqlnd \

-- With-PDO-mysql = mysqlnd \

-- With-mysqli = mysqlnd \

-- With-FreeType-Dir =/usr/local/FreeType \

-- With-Gd =/usr/local/GD \

-- With-zlib -- With-libxml-Dir =/usr/local/libxml2 \

-- With-JPEG-Dir =/usr/local/JPEG \

-- With-PNG-Dir \

-- Enable-mbstring = all \

-- Enable-mbregex \

-- Enable-shared

Shell>Make & make install

Shell>Cp php. ini-development/usr/local/PHP/lib/PHP. ini

Configure Apache to support PHP

VI/usr/local/http2/CONF/httpd. conf

1) Add the following in httpd. conf (Apache main configuration file:

Addtype application/X-httpd-PHP. php

2) Find the following paragraph:

<Ifmodule dir_module>

Directoryindex index.html

</Ifmodule>

Add index. php before index.html

3) create a PHP test webpage

VI/usr/local/apache2/htdocs/index. php

Enter the following content:

<? PHP

Phpinfo ();

?>

4) Restart Apache

Shell>/usr/local/http2/bin/apachectl restart

5) view the http: // Virtual Machine IP address in the browser again

If you see the PHP information, the work is complete!

(10) install MySQL

1) Compile and install MySQL

Shell>CD/home/Shuhua/tar

Shell>Tar-xzvf mysql-5.1.58.tar.gz

Shell>CD mysql-5.1.58

Shell>./Configure -- prefix =/usr/local/MySQL \

-- With-charset = utf8 \

-- With-extra-charsets = GBK, gb2312, binary

Shell> mount... mount the disc
Shell>Rpm-IVH libtermcap-devel-2.0.8-46 ....

Shell>Make & make install

2) configure and initialize MySQL

Shell>Groupadd MySQL

Shell>Useradd-G MySQL

Shell>CP support-files/my-medium.cnf/etc/My. CNF

Shell>CD/usr/local/MySQL

Shell>Chown-r mysql. MySQL.

Shell>Bin/mysql_install_db -- user = MySQL \

-- Datadir =/usr/local/MySQL/var

Create MySQL test database and System Database

Shell>Chown-r root.

Change the owner of the current directory file to root to avoid restoring the database to factory settings.

Shell>Chown-r MySQL VaR

Shell>Bin/mysqld_safe -- user = MySQL &

Start MySQL and run MySQL service in the background

3) Test the database

Shell> bin/MySQL-uroot

Mysql> showdatabases;

4) Next, modify the MySQL password (no password by default)

Mysql> updateuser set

Password = PASSWORD ('new _ password ')

Whereuser = 'root ';

Mysql> flushprivileges;

Installation troubleshooting

1) Restart Apache after the PHP module is installed. If the following message is displayed (APACHE restart failed ):

[[Email protected] php-5.3.6] #/usr/local/http2/bin/apachectl restart

Httpd: syntax error online 105 of/usr/local/http2/CONF/httpd. conf: cannot load/usr/local/http2/modules/libphp5.so into server:/usr/local/libxml2/lib/libxml2.so. 2: Symbol gzopen64, version zlib_1.2.3.3not defined in file libz. so.1 with link time reference

Solution:

[[Email protected] sbin] # echo "/usr/local/lib">/etc/lD. So. conf

[[Email protected] sbin] # ldconfig

2) An error occurred while restarting Apache.

[[Email protected] httpd-2.2.19] #/usr/local/htt2/bin/apachectl restart

Httpd not running, trying to start

(98) address already inuse: make_sock: cocould not bind to address [:]: 80

(98) address already inuse: make_sock: cocould not bind to address 0.0.0.0: 80

No listening socketsavailable, shutting down

Unable to open logs

The reason is that port 80 is occupied.

Solution:

View port 80 usage

[[Email protected] httpd-2.2.19] # netstat-LNP | grep 80

TCP 0 0: 80: * Listen 28195/httpd

UNIX 2 [ACC] stream listening 6580 1957/GPM/dev/gpmctl

UNIX 2 [ACC] stream listening 5422 1800/pcscd/var/run/pcscd. Comm

View who is using port 80

[[Email protected] httpd-2.2.19] # ps 28195

Pidtty stat Time Command

28195? SS 0: 00/usr/local/http2/bin/httpd-K restart

After analysis, we know that port 80 is occupied by a system process, which is the old apache service.

Kill this process

[[Email protected] httpd-2.2.19] # Kill-928195

[[Email protected] httpd-2.2.19] #

 

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.