CentOS 6.3 Minimum installation system to quickly build the environment step sharing _linux

Source: Internet
Author: User
Tags curl fpm install php soap openssl pear sqlite xsl

1, initialize system environment complete system root new, GCC compilation environment, PHP installation dependency, System kernel optimization

Copy Code code 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 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 NTP service

Copy Code code as follows:

Yum Install Ntp-y
Cp/etc/ntp.conf/etc/ntp.conf.original
vim/etc/ntp.conf <<vim >/dev/null 2>&1
: 22,24s/^/#/
: 25,25s/^/\rserver 210.72.145.44\rserver 133.100.11.8\r/
: Wq
Vim
Service NTPD Start
Chkconfig ntpd on

3, install Nginx

Copy Code code 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
baseurl=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: Need to modify Nginx user for WWW, default for Nginx
4, install MySQL

Copy Code code 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, install PHP in this has depending on the actual situation can choose a different version.
1>php-5.2.17

Copy Code code 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/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

2>php-5.3.10

Copy Code code 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/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 take php-5.3.10 as column

Copy Code code 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,643s/;//
:/;open_basedir =/s#^;open_basedir = #open_basedir =/www/:/tmp/#
: Wq
Vim

With a nginx configuration file that has been optimized

Copy Code code as follows:

User www www.
Worker_processes 8;
Error_log/www/log/nginx_error.log Crit;
Pid/usr/local/nginx/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 2k;
Large_client_header_buffers 4 4k;
Client_max_body_size 8m;

Sendfile on;
Tcp_nopush on;

Keepalive_timeout 60;

Fastcgi_cache_path/usr/local/nginx/fastcgi_cache Levels=1:2
keys_zone=test:10m
inactive=5m;
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
Fastcgi_buffer_size 16k;
Fastcgi_buffers 16k;
Fastcgi_busy_buffers_size 16k;
Fastcgi_temp_file_write_size 16k;
Fastcgi_cache TEST;
Fastcgi_cache_valid 302 1h;
Fastcgi_cache_valid 1d;
Fastcgi_cache_valid any 1m;
Fastcgi_cache_min_uses 1;
Fastcgi_cache_use_stale error timeout Invalid_header http_500;

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


Tcp_nodelay on;

gzip on;
Gzip_min_length 1k;
Gzip_buffers 4 16k;
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 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;
Include fcgi.conf;
}

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

Location ~. *\. (JS|CSS) $
{
Expires 1h;
}
Location ~. *\. (html|htm)
{
Expires 15m;
}
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.