DELL R420 Real machine built lamp environment

Source: Internet
Author: User
Tags mcrypt

has always been in the virtual machine to do experiments, the first time in the real machine installed CentOS6.6 x86_64 bit system, and install lamp environment. Install prerequisite packages in advance, no errors during installation, and can be executed with one-click installation lamp script.

DELL R420 Configuration e5-2403 dual cpu,4 core 8 threads;

[[email protected] ~]# grep "model name"/proc/cpuinfo |uniqmodel Name:intel (R) Xeon (r) CPU e5-2403 v2 @ 1.80ghz[[email p Rotected] ~]# grep-c "Processor"/proc/cpuinfo8[[email protected] ~]# grep "core id"/proc/cpuinfo |sort |uniq|wc-l4



Linux version and kernel version

[Email protected] ~]# Cat/etc/issuecentos release 6.6 (Final) Kernel \ r on an \m[[email protected] ~]# uname-r2.6.32-504 . el6.x86_64

Install the required packages before installing the lamp environment

Yum install wget gcc gcc-c++ make re2c curl curl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel Lib MCrypt libmcrypt-devel zlib zlib-devel OpenSSL openssl-devel freetype freetype-devel gd gd-devel perl perl-devel ncurses N Curses-devel Bison bison-devel libtool gettext gettext-devel cmake bzip2 bzip2-devel pcre pcre-devel

Software version:

Apache 2.4.12 version download http://mirrors.sohu.com/apache/httpd-2.4.12.tar.gz

mysql 5.6.24 version download http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.24.tar.gz

php5.6.8 version download http://mirrors.sohu.com/php/php-5.6.8.tar.gz

Apr apr-util:http://mirrors.cnnic.cn/apache

libmcrypt:ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt


Compiling and installing MySQL 5.6.24

#cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dmysql_unix_addr=/usr/local/mysql/ Mysql.sock-dsysconfdir=/etc-dwith_myisam_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_ Storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_tcp_ Port=3306-denabled_local_infile=1-dwith_partition_storage_engine=1-dextra_charsets=all-ddefault_charset=utf8- ddefault_collation=utf8_general_ci# make && make install # echo $?# 0

Create MySQL user, database directory, change permissions

# useradd-m-s/sbin/nologin mysql# mkdir-p/data/mysql # chown-r mysql:mysql/data/mysql/# chown-r mysql:mysql/usr/l ocal/mysql/

Initializing the database

# cd/usr/local/mysql/scripts/#/mysql_install_db--basedir=/usr/local/mysql/--datadir=/data/mysql/--user=mysql

Copy config file, modify my.cnf

# cp/usr/local/mysql/my.cnf/etc/my.cnf # Vi/etc/my.cnf[mysqld]user=mysql Datadir=/data/mysqldefault-storage-engine =myisam

Copy Startup scripts

# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

Add Iptables rule, allow Port 3306, and save firewall settings.

# iptables-a input-m State--state new-m tcp-p TCP--dport 3306-j accept#/etc/init.d/iptables Save

Start the MYSQLD service and join the boot start;

# service Mysqld start# chkconfig--add mysqld# chkconfig mysqld on

Set the environment variable, the last line to add the following, save exit, the source takes effect;

# vi/etc/profilepath= $PATH:/usr/local/mysql/binexport path# source/etc/profile

Edit the Mysqld startup script to find the Basedir and datadir add paths;

#vi/etc/init.d/mysqldbasedir=/usr/local/mysqldatadir=/data/mysql


Compiling and installing apache2.4.12

The APR version installed by CENTOS6 Yum is no longer available for the httpd-2.4 version. Therefore, source code is required to install APR and Apr-util

#cd/usr/local/src/#wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz#wget http://mirrors.cnnic.cn/apache/ Apr/apr-util-1.5.4.tar.gz

Compile and install Apr

[Email protected] src]# tar zxf apr-1.5.2.tar.gz [[email protected] src]# CD Apr-1.5.2[[email protected] apr-1.5.2]#./co nfigure--prefix=/usr/local/apr[[email protected] apr-1.5.2]# make && make Install[[email protected] apr-1.5.2] # echo $?0

Compiling and installing Apr-util

[Email protected] src]# tar zxf apr-util-1.5.4.tar.gz [[email protected] src]# CD Apr-util-1.5.4[[email protected] Apr-ut il-1.5.4]#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr[[email protected] apr-util-1.5.4]# Make && make Install[[email protected] apr-util-1.5.4]# echo $?0

Check development environment, install using Yum without installation;

[Email protected] ~]# rpm-qa gcc cmake pcre-devel libmcryptlibmcrypt-2.5.8-9.el6.x86_64gcc-4.4.7-11.el6.x86_ 64cmake-2.8.12.2-4.el6.x86_64pcre-devel-7.8-6.el6.x86_64

Compile and install Apache

[Email protected] src]# tar zxf httpd-2.4.12.tar.gz [[email protected] src]# CD Httpd-2.4.12[[email protected] httpd-2.4. 12]#./configure--prefix=/usr/local/apache2--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/-- With-pcre--enable-mods-shared=most--enable-so[[email protected] httpd-2.4.12]# echo $?0

Apache execute command directory to join the configuration file, take effect;

[Email protected] ~]# vi/etc/profilepath= $PATH:/usr/local/apache2/bin[[email protected] ~]#. /etc/profile

Add Iptables rule, allow port 80, and save firewall settings.

# iptables-a input-m State--state new-m tcp-p TCP--dport 80-j accept#/etc/init.d/iptables Save

Edit startup script, change permissions, and add system service, set boot start;

[Email protected] apache2]# vi/etc/init.d/httpd[[email protected] apache2]# chmod 755/etc/init.d/httpd[[email Protected] apache2]# chkconfig--add httpd[[email protected] apache2]# chkconfig httpd on

Check the Apache configuration parameters;-l lists the loaded static modules-m lists all loaded modules;

[[email protected] ~]# apachectl-tsyntax ok[[email protected] ~]# apachectl-l[[email protected] ~]# apachectl-m


Compiling and installing PHP 5.6.8

[[email protected] src]# tar zxvf php-5.6.8.tar.gz [[email protected]  src]# cd php-5.6.8[[email protected] php-5.6.8]# ./configure   -- prefix=/usr/local/php   --with-apxs2=/usr/local/apache2/bin/apxs   -- with-config-file-path=/usr/local/php/etc   --with-mysql=/usr/local/mysql   -- With-libxml-dir   --with-gd   --with-jpeg-dir   --with-png-dir    --with-freetype-dir   --with-iconv-dir   --with-zlib-dir    --with-bz2   --with-openssl   --with-mcrypt   -- enable-soap   --enable-gd-native-ttf   --enable-mbstring   -- Enable-sockets   --enable-exif   --disable-ipv6 [[email protected]  php-5.6.8]# make &&&nBsp;make install[[email protected] php-5.6.8]# echo $?0 

Copy PHP configuration file

[Email protected] php-5.6.8]# Cp/usr/local/src/php-5.6.8/php.ini-production/usr/local/php/etc/php.ini

Modify Time Zone

[Email protected] php-5.6.8]# Vi/usr/local/php/etc/php.ini date.timezone =asia/shanghai


Configure PHP with Apache

1, modify the AddType parameter, red for the new add

[Email protected] php-5.6.8]# vi/usr/local/apache2/conf/httpd.conf

# AddType allows you to add to or override the MIME configuration

#AddType Application/x-gzip. tgz

AddType application/x-compress. Z

AddType application/x-gzip. gz. tgz

addtype application/x-httpd-php. PHP

#AddType text/html. shtml

2, modify index.html, red for new add

<ifmodule dir_module>

DirectoryIndex index.html index.php

</IfModule>

3, modify Severname, red for new add

#ServerName www.example.com:80

ServerName localhost:80

4, Test parsing PHP, in the/usr/local/apache2/htdocs/directory, write a test php file

[[email protected] php-5.6.8]# Cat/usr/local/apache2/htdocs/test.php<?phpecho "php parse normal \ n";? >[[email protected] htdocs]#/etc/init.d/httpd restart[[email protected] htdocs]# Curl localhost/test.phpphp Parse Normal


or write a phpinfo ();

The lamp environment is now complete.


This article is from the "Model Student's Learning blog" blog, please be sure to keep this source http://mofansheng.blog.51cto.com/8792265/1671419

DELL R420 Real machine built lamp environment

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.