Linux installation lamp environment and configuration steps detailed

Source: Internet
Author: User
Tags mkdir mysql in set time time and date centos file permissions

-------------------the setup steps of the lamp environment create the complete steps from the virtual machine to the lamp environment------------------------

A. Prepare a virtual machine vmware-workstation

1, click New Virtual Machine, "Choose Next", "Choose Next";

2, the client operating system to choose the Linux system, version selection CentOS, "select Next";

3, location installed to your selected directory I put in the e:centos3 this directory; "Next";

4, the specified disk capacity: I gave 20G here; "Next";

5, complete; Create a good virtual machine here; make some changes to him;

6, double hit Open CD/DVD This device, select the use of ISO mirrored file radio box

, click Browse to select your CentOS system;

7, open the virtual machine power

8, CentOS system formally began to look at the installation,

9, the first time to press the ENTER key on OK;

10, to the CD detection window to choose skip does not detect;

11, this time to a graphical interface, select Next Next

12, select the language here I choose Simplified Chinese next

13, the United States English-style, next

14, pop-up a window click is

15. Select Next

16, pop-up a window click is

17, click Configure, configure IP and subnet mask, gateway

18, pop-up a window click is

19, directly select the next step

20, set the password

21, install the application software do not choose the direct next step

22, now formally install CentOS Linux system Next, it will take a little time

23, installation complete, click to reboot the system

24, entered the Welcome interface click Forward

25, set the firewall to disabled, the default is enabled, and then the Telnet remote service and WWW selection, click Forward, then pop up a window click Yes, overwrite the existing firewall configuration

26, SELinux Set choice Disable, pop-up window selection is

27, set time and date, forward

28, create a Non-administrator account, set up a good move forward

29, sound card settings, do not set the direct forward

30, click Forward, prompted to restart the Linux system this is the Linux system is formally configured to use the

31, with the root user login system


Second, the configuration to build the lamp environment before the required settings

1, the choice of CD/DVD, the equipment under the status of the connected on the hook, connect the equipment, determine

2, set Yum profile Vi/etc/yum.repos.d/centos-media.repo

Will baseurl=file:///media/centos/

file:///media/cdrom/

file:///media/cdrecorder/

Gpgcheck=1

Enabled=0

Change into Baseurl=file:///media

file:///mnt/cdrom/

file:///media/cdrecorder/

Gpgcheck=1

Enabled=1

3, umount/media/centos_5.5_final/uninstall the optical drive

4, Mkdir/mnt/cdrom in the/mnt directory to create a directory to mount the CD-ROM drive cdrom

5, Mount/dev/cdrom/mnt/cdrom the optical drive to the/mnt/cdrom directory

6, Cp/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.bak file to change the filename

Rm-r/etc/yum.repos.d/centos-base.repo Delete this file

Third, the beginning of the lamp environment to build

########## #在搭建lamp环境前需要准备要安装的文件

Installing MySQL in a CentOS system requires ncurses-devel files to be installed


Yum Install ncurses Ncurses-devel


Yum list|grep ncurses Query ncurses file


Yum-y Install Ncurses-devel installation ncurses-devel files

Yum Install Ncurses-devel


1, in the CentOS system is not installed by default GCC and qt-devel these two files.

2. Installation method

1.yum-y Install gcc-c++

2.yum-y Install Qt-devel

3.yum-y Install QT

3, installation Qt-devel can install libpng this library file


1, install MySQL

1)

Shell> CD/USR/LOCAL/SRC

shell> Groupadd MySQL

shell> useradd mysql-g MySQL

Create a MySQL user

Shell> TAR-XZVF mysql-5.0.51a.tar.gz

Shell> CD mysql-5.0.51a

shell>./configure--prefix=/usr/local/mysql--with-charset=gb2312--with-extra-charsets=gbk,gb2312

Shell> make && make install

shell> CP support-files/my-medium.cnf/etc/my.cnf

Shell> Cd/usr/local/mysql

Modify all file permissions for this directory,

Shell> chown-r Mysql.mysql.

Generating databases for MySQL users

Shell> bin/mysql_install_db--user=mysql

Change the original directory permissions back to root for security reasons

Shell> chown-r Root.

Change the newly generated repository directory back to MySQL for proper startup.

shell> Chown-r mysql var

Set up MySQL boot automatically

CP Support-files/mysql.server/etc/rc.d/init.d/mysqld

chmod +x/etc/rc.d/init.d/mysqld

Chkconfig--add mysqld

Service mysqld Start

Chkconfig mysqld on

2, Installation support graphics library

Zlib-1.2.3.tar.gz

Jpegsrc.v6b.tar.gz

Libpng-1.2.12.tar.gz

Freetype-2.3.4.tar.gz

Gd-2.0.34.tar.gz

1) libxml2

Shell> CD/USR/LOCAL/SRC

Shell> TAR-XJVF libxml2-2.6.27.tar.bz2

Shell> CD libxml2-2.6.27

Shell>./configure--PREFIX=/USR/LOCAL/LIBXML2

Shell> make && make install

2) zlib

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZXVF zlib-1.2.3.tar.gz

Shell> CD zlib-1.2.3

Shell>./configure//This configuration compile command do not add directory parameters

Shell> make && make install

3) Jpeg6

Shell> mkdir-p/usr/local/jpeg6

Shell> mkdir-p/usr/local/jpeg6/bin

Shell> mkdir-p/usr/local/jpeg6/lib

Shell> mkdir-p/usr/local/jpeg6/include

Shell> mkdir-p/usr/local/jpeg6/man

Shell> mkdir-p/usr/local/jpeg6/man1

Shell> mkdir-p/usr/local/jpeg6/man/man1

Installation error prompted no critical directory to continue

Manually build as above directory

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZVXF jpegsrc.v6b.tar.gz

Shell> CD jpeg-6b

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

Shell> make && make install


4) libpng

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZVXF libpng-1.2.12.tar.gz

Shell> CD libpng-1.2.12

Shell>./configure///zlib with no parameters, let it install to the appropriate directory by default

Shell> make && make install


5) FreeType

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZVXF freetype-2.3.4.tar.gz

Shell> CD freetype-2.3.4

Shell> mkdir-p/usr/local/freetype

Shell>./configure--prefix=/usr/local/freetype

Shell> make && make install


6) GD Library

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZVXF gd-2.0.34.tar.gz

Shell> mkdir-p/USR/LOCAL/GD

Shell> CD gd-2.0.34

Shell>./configure--PREFIX=/USR/LOCAL/GD

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

--with-png--with-zlib

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

Shell> make && make install

3. Installation Apache2

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZXVF httpd-2.2.4.tar.gz

Shell> CD httpd-2.2.4

Shell>./configure--prefix=/usr/local/apache2

--enable-module=most

--enable-rewrite

--enable-shared=max

--enable-so--enable-ssl

Shell> make && make install


4. Installation PHP5

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZXVF php-5.2.2.tar.gz

Shell> CD php-5.2.2

Shell>./configure--prefix=/usr/local/php

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

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

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

--with-gd=/usr/local/gd

--with-zlib--WITH-LIBXML-DIR=/USR/LOCAL/LIBXML2

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

--with-png-dir

--enable-mbstring=all

--enable-mbregex

--enable-shared

Shell> make && make install

shell> CP Php.ini-dist/usr/local/php/lib/php.ini


V. Installation of Zend

Shell> CD/USR/LOCAL/SRC

Shell> TAR-ZXVF zendoptimizer-3.2.8-linux-glibc21-i386.tar.gz

Shell> CD zendoptimizer-3.2.8-linux-glibc21-i386

./install

Note: The php.ini path is in the/usr/local/php/lib/directory


Six, configure and start Apache

In the Apache main configuration file, add:

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

Find index.php add index.php in front

Start Apache

/usr/local/apache2/bin/apachectl start

Set MySQL and Apache to start automatically

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


Set up PHP test Web page

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

<?php

Phpinfo ();

?>

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.