How to quickly build an environment under centos 6.3 minimal installation system

Source: Internet
Author: User
Tags mcrypt xsl

1. initialize the system environment to complete the system root, gcc compiling environment, php installation dependency, and system kernel optimization.

Copy codeThe Code is as follows: lokkit -- disabled -- selinux = disabled
Yum update-y
Yum install-y telnet wget rsync subversion patch
Yum install-y system-config-network-tui
Yum install-y bind-utils
Yum install-y vim-enhanced
Yum install gcc-c ++ make automake autoconf-y
Yum install curl-devel libmcrypt-devel gd-devel libjpeg-devel libpng-devel libXpm-devel libxml2-devel libxslt-devel mhash-devel openssl-devel-y
Cat>/etc/sysctl. conf <EOF

Net. ipv4.ip _ local_port_range = 1024 65500
Net. core. netdev_max_backlog = 262144
Net. ipv4.tcp _ syncookies = 1
Net. ipv4.tcp _ tw_reuse = 1
Net. ipv4.tcp _ tw_recycle = 1
Net. ipv4.tcp _ synack_retries = 1
Net. ipv4.tcp _ syn_retries = 1
Net. ipv4.tcp _ fin_timeout = 60
Net. ipv4.tcp _ keepalive_time = 30
Net. ipv4.tcp _ max_syn_backlog = 8192
Net. ipv4.tcp _ max_tw_buckets = 4096
EOF

2. Configure the ntp service

Copy codeThe Code is as follows: yum install ntp-y
Cp/etc/ntp. conf/etc/ntp. conf. original
Vim/etc/ntp. conf <VIM>/dev/null 2> & 1
: 22, 24 s/^ /#/
: 25, 25 s/^/\ rserver 210.72.145.44 \ rserver 133.100.11.8 \ r/
: Wq
VIM
Service ntpd start
Chkconfig ntpd on

3. Install nginx

Copy codeThe Code is as follows: groupadd-r www
Useradd-r-g www-s/bin/false-M www

Cat>/etc/yum. repos. d/nginx. repo <EOF
[Nginx]
Name = nginx repo
Base url = http://nginx.org/packages/centos/6/x86_64/
Gpgcheck = 0
Enabled = 1
EOF

Yum search nginx
Yum install nginx
Chkconfig nginx on
Service nginx start

Ps: You need to change the nginx user to www. The default value is nginx.
4. Install mysql

Copy codeThe Code is as follows: wget http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.5/MySQL-devel-5.5.25a-1.el6.x86_64.rpm
Wget http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.5/MySQL-client-5.5.25a-1.linux2.6.x86_64.rpm
Wget http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.5/MySQL-server-5.5.25a-1.el6.x86_64.rpm
Wget http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.5/MySQL-shared-5.5.25a-1.el6.x86_64.rpm
Wget http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.5/MySQL-shared-compat-5.5.25a-1.el6.x86_64.rpm
Yum-y localinstall MySQL -*

5. You can select a different version based on the actual situation when installing php.
Php-5.2.17

Copy codeThe Code is as follows: wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
Wget http://museum.php.net/php5/php-5.2.17.tar.gz

Tar zxvf php-5.2.17.tar.gz
Gzip-cd php-5.2.17-fpm-0.5.14.diff.gz | patch-d php-5.2.17-p1

Cd php-5.2.17

./Configure -- prefix =/srv/php-5.2.17 \
-- With-config-file-path =/srv/php-5.2.17/etc \
-- With-config-file-scan-dir =/srv/php-5.2.17/etc/conf. d \
-- With-libdir = lib64 \
-- Enable-fastcgi \
-- Enable-fpm \
-- With-pear \
-- With-curl \
-- With-gd \
-- With-jpeg-dir \
-- With-png-dir \
-- With-freetype-dir \
-- With-zlib-dir \
-- With-iconv \
-- With-mcrypt \
-- With-mysql \
-- With-pdo-mysql \
-- With-mysql-sock =/var/lib/mysql. sock \
-- With-openssl = shared \
-- With-mhash = shared \
-- With-sqlite = shared \
-- With-pdo-sqlite = shared \
-- With-xsl = shared \
-- With-pear \
-- Enable-sockets \
-- Enable-soap \
-- Enable-mbstring \
-- Enable-magic-quotes \
-- Enable-inline-optimization \
-- Enable-gd-native-ttf \
-- Enable-zip \
-- Enable-xml \
-- Enable-ftp \
-- Enable-bcmath \
-- Enable-calendar \
Enable-sqlite-utf8 \
-- Enable-shmop \
-- Enable-dba \
-- Enable-wddx \
-- Enable-sysvsem \
-- Enable-sysvshm \
-- Enable-sysvmsg \
-- Disable-debug

Make & make install

Cp php. ini-recommended/srv/php-5.2.17/etc/php. ini
Cp/srv/php-5.2.17/etc/php-fpm.conf/srv/php-5.2.17/etc/php-fpm.conf.original

Php-5.3.10 2>

Copy codeThe Code is as follows: wget http://cn.php.net/distributions/php-5.3.10.tar.gz
Tar xf php-5.3.10.tar.gz
Cd php-5.3.10
./Configure -- prefix =/srv/php-5.3.10 \
-- With-config-file-path =/srv/php-5.3.10/etc \
-- With-config-file-scan-dir =/srv/php-5.3.10/etc/conf. d \
-- With-libdir = lib64 \
-- Enable-fastcgi \
-- Enable-fpm \
-- With-pear \
-- With-curl \
-- With-gd \
-- With-jpeg-dir \
-- With-png-dir \
-- With-freetype-dir \
-- With-zlib-dir \
-- With-iconv \
-- With-mcrypt \
-- With-mysql \
-- With-pdo-mysql \
-- With-mysql-sock =/var/lib/mysql. sock \
-- With-openssl = shared \
-- With-mhash = shared \
-- With-sqlite = shared \
-- With-pdo-sqlite = shared \
-- With-xsl = shared \
-- Without-pear \
-- Enable-sockets \
-- Enable-soap \
-- Enable-mbstring \
-- Enable-magic-quotes \
-- Enable-inline-optimization \
-- Enable-gd-native-ttf \
-- Enable-zip \
-- Enable-xml \
-- Enable-ftp \
-- Enable-bcmath \
-- Enable-calendar \
Enable-sqlite-utf8 \
-- Enable-shmop \
-- Enable-dba \
-- Enable-wddx \
-- Enable-sysvsem \
-- Enable-sysvshm \
-- Enable-sysvmsg \
-- Disable-debug

Make & make install

Php optimization column with php-5.3.10

Copy codeThe Code is as follows: cp php. ini-production/srv/php-5.3.10/etc/php. ini
Cp/srv/php-5.3.10/etc/php-fpm.conf.default/srv/php-5.3.10/etc/php-fpm.conf
Vim/srv/php-5.3.10/etc/php. ini <VIM
: % S/expose_php = On/expose_php = Off/
: 643,643 s /;//
:/; Open_basedir =/s # ^; open_basedir = # open_basedir =/www/:/tmp /#
: Wq
VIM

Attaches an optimized nginx configuration file.

Copy codeThe Code is as follows: user www;
Worker_processes 8;
Error_log/www/log/nginx_error.log crit;
Pid/usr/local/nginx. pid;
Worker_rlimit_nofile 204800;

Events
{
Use epoll;
Worker_connections 204800;
}

Http
{
Include mime. types;
Default_type application/octet-stream;

Server_tokens off;

Charset UTF-8;

Server_names_hash_bucket_size 128;
Client_header_buffer_size 2 k;
Large_client_header_buffers 4 4 k;
Client_max_body_size 8 m;

Sendfile on;
Tcp_nopush on;

Keepalive_timeout 60;

Fastcgi_cache_path/usr/local/nginx/fastcgi_cache levels =
Keys_zone = TEST: 10 m
Inactive = 5 m;
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
Fastcgi_buffer_size 16 k;
Fastcgi_buffers 16 16 k;
Fastcgi_busy_buffers_size 16 k;
Fastcgi_temp_file_write_size 16 k;
Fastcgi_cache TEST;
Fastcgi_cache_valid 200 302 1 h;
Fastcgi_cache_valid 301 1d;
Fastcgi_cache_valid any 1 m;
Fastcgi_cache_min_uses 1;
Fastcgi_cache_use_stale error timeout invalid_header http_500;

Open_file_cache max = 204800 inactive = 20 s;
Open_file_cache_min_uses 1;
Open_file_cache_valid 30 s;

Tcp_nodelay on;

Gzip on;
Gzip_min_length 1 k;
Gzip_buffers 4 16 k;
Gzip_http_version 1.0;
Gzip_comp_level 2;
Gzip_types text/plain application/x-javascript text/css application/xml;
Gzip_vary on;

Server
{
Listen 80;
Server_name www.myhack58.com;
Index. php index.htm;
Root/www/html /;

Location/status
{
Stub_status on;
}

Location ~ . * \. (Php | php5 )? $
{
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fcinclude gi. conf;
}

Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf | ico) $
{
Expires 7d;
}

Location ~ . * \. (Js | css) $
{
Expires 1 h;
}
Location ~ . * \. (Html | htm)
{
Expires 15 m;
}
Location ~ . * \. Log $
{
Deny all;
}

Log_format access' $ remote_addr-$ remote_user [$ time_local] "$ request "'
'$ Status $ body_bytes_sent "$ http_referer "'
'"$ Http_user_agent" $ http_x_forwarded_for ';
Access_log/www/log/access. log access;
}
}

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.