Build a LAMP environment under CentOS6.0 (source code installation)

Source: Internet
Author: User
After two days, we finally set up a complete LAMP Development Environment on CentOS6.0. There was a lot of trouble in the process, but we had to solve it a little bit. You have written this installation document for yourself and those who encounter problems during later installation. Give roses to others and leave remaining fragrance in your hands. I. Build the environment: 1. CentOS6.0 Virtual Machine (minimum installation) 2. putty3 and sshshe

After two days, we finally set up a complete LAMP Development Environment on CentOS 6.0. There was a lot of trouble in the process, but we had to solve it a little bit. You have written this installation document for yourself and those who encounter problems during later installation. Give roses to others and leave remaining fragrance in your hands.

1. Set up the environment:

1. CentOS 6.0 Virtual Machine (minimum installation)

2. putty

3. ssh shell

Ii. preparations:

1. source code package


2. Install the gcc and gcc-c ++ Compiler (yum installation)

EnterCommandYum install gccAndYum install gcc-c ++If the network cannot be connected, mount the centos CD image and modify the local source of yum so that the machine can be installed in yum mode.

3. Check whether mysql,Php, Apache, use the commandRpm-qa mysql. If yes, run the command rpm-e package's full name-nodeps Uninstall.

4. Disable selinux and clear firewall rules.

5. open ports 80, 3306, and 22

By default, ports 80, 3306, and 22 of the firewall are disabled. In this way, access to the web on the virtual machine from the client may fail. So enable it.

Service iptables stop

#/Sbin/iptables-I INPUT-p tCp-- Dport 80-j ACCEPT// It is an uppercase English letter I, not a number 1
#/Sbin/iptables-I INPUT-p tcp -- dport 22-j ACCEPT
#/Sbin/iptables-I INPUT-p tcp -- dport 3306-j ACCEPT

Then save:
#/Etc/rc. d/init. d/iptables save

Restart Firewall

Service iptables restart

6. Create a directory named lamp in linux to store the uploaded source code.

7. Use ssh shell to upload the 14 source code packages downloaded in windows to/lamp

8. Unpack

Because there are many packages, write a shell script/lamp/tar. sh to unpackage.

Tar. sh

  1. #! /Bin/sh
  2. Cd/Lamp
  3. Ls* .Tar.gz> ls. list
  4. For TAR in'CatLs. list'
  5. Do
  6. Tar-zxvf $ YAR
  7. Done
Run the script tar. sh to unpack the package.

9. Delete all source code packages * .tar.gz
Iii. Installation Process:

1. For ease of operation, write the installation script/lamp. sh for installation.

Lamp. sh

  1. Cd/lamp/libxml2-2.6.30
  2. ./Configure -- prefix =/usr/local/libxml2/
  3. Make
  4. Make install
  5. Cd/lamp/libMcRypt-2.5.8
  6. ./Configure -- prefix =/usr/local/libmcrypt/
  7. Make
  8. Make install
  9. Cd/lamp/libmcrypt-2.5.8/libltdl
  10. ./Configure --Enable-Ltdl-install
  11. Make
  12. Make install
  13. Cd/lamp/zlib-1.2.3
  14. ./Configure
  15. Make
  16. Make install
  17. Cd/lamp/libpng-1.2.31
  18. ./Configure -- prefix =/usr/local/libpng/
  19. Make
  20. Make install
  21. Mkdir/Usr/local/limit 6
  22. Mkdir/usr/local/partition 6/bin
  23. Mkdir/usr/local/IPv6/lib
  24. Mkdir/usr/local/IPv6/INcLude
  25. Mkdir-p/usr/local/users 6/man/man1
  26. Cd/lamp/jpeg-6b
  27. ./Configure -- prefix =/usr/local/defaults 6/-- enable-sharEd-- Enable-StatIc
  28. Make
  29. Make install
  30. Cd/lamp/FreeType-2.3.5
  31. ./Configure -- prefix =/usr/local/freetype/
  32. Make
  33. Make install
  34. Cd/lamp/autoconf-2.61
  35. ./Configure
  36. Make
  37. Make install
  38. Cd/lamp/gd-2.0.35
  39. ./Configure -- prefix =/usr/local/gd2/-- with-jpeg =/usr/local/versions 6/-- with-freetype =/usr/local/freetype/
  40. Make
  41. Make install
  42. Cd/lamp/Httpd-2.2.9
  43. . /Configure -- prefix =/usr/local/apache2/-- sysconfdir =/etc/httpd/-- with-included-apr -- disable-userdir -- enable-so -- enable-deflate = shared -- enable-ExPires = shared -- enable-reWrite= Shared -- enable-static-SuPport
  44. Make
  45. Make install
  46. /Usr/local/apache2/bin/ApachectlStart
  47. Echo "/usr/local/apache2/bin/apachectl start">/etc/rc. d/rc. sysinit
  48. Cd/lamp/ncurses-5.6
  49. ./Configure -- with-shared -- without-debug -- without-ada -- enable-overwrite
  50. Make
  51. Make install
  52. GroupaDdMysql
  53. Useradd-G mysql
  54. Cd/lamp/mysql-5.0.41
  55. ./Configure -- prefix =/usr/local/mysql/-- with-exTrA-charSetS = all
  56. Make
  57. Make install
  58. Cp support-FileMy-medium.cnf/etc/my. cnf
  59. /Usr/local/mysql/bin/mysql_install_db -- user = mysql
  60. Chown-R root/usr/local/mysql
  61. Chown-R mysql/usr/local/mysql/var
  62. Chgrp-R mysql/usr/local/mysql
  63. /Usr/local/mysql/bin/mysqld_safe -- user = mysql &
  64. Cp/lamp/mysql-5.0.41/support-files/mysql. server/etc/rc. d/init. d/mysqld
  65. Chown root. root/etc/rc. d/init. d/mysqld
  66. Chmod755/etc/rc. d/init. d/mysqld
  67. Chkconfig-- Add mysqld
  68. Chkconfig -- list mysqld
  69. Chkconfig -- levels 245 mysqld off
  70. Cd/lamp/php-5.2.6
  71. . /Configure -- prefix =/usr/local/php/-- with-config-file-path =/usr/local/php/etc/-- with-apxs2 =/usr/local/apache2/ bin/retrial -- with-mysql =/usr/local/mysql/-- with-libxml-dir =/usr/local/libxml2/-- with-jpeg-dir =/usr/local /versions 6/-- with-freetype-dir =/usr/local/freetype/-- with-gd =/usr/local/gd2/-- with-mcrypt =/usr/local/libmcrypt /-- with-mysqli =/usr/local/mysql/bin/mysql_config -- enable-soap -- enable-mbstring = all -- enable-sockets
  72. Make
  73. Make install
  74. Cp php. ini-dist/usr/local/php/etc/php. ini
  75. Echo "Addtype application/x-httpd-php. php. phtml">/etc/httpd. conf
  76. /Usr/local/apache2/bin/apachectl restart
Execute the script and install it (for a long time, you can go to bed)
Related Article

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.