centos 6.3 最小安装系统下快速搭建环境步骤分享

这篇文章主要介绍了centos6.3 最小安装系统下快速搭建环境,

1,初始化系统环境  完成系统根新,gcc编译环境,php安装依赖,系统内核优化


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,配置ntp服务


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,安装nginx


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:需要修改nginx使用用户为www,默认为nginx
4,安装mysql


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,安装php  在这有根据实际情况可以选择不同的版本。
1>php-5.2.17


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


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优化拿php-5.3.10为列


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

附一个进过优化的nginx配置文件


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 16 16k;
    fastcgi_busy_buffers_size 16k;
    fastcgi_temp_file_write_size 16k;
    fastcgi_cache TEST;
    fastcgi_cache_valid 200 302 1h;
    fastcgi_cache_valid 301 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;
            }
}

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

什么是tesseract-ocr OCR(Optical Character Recognition):光学字符识别,是指对图片文件中的文字进行分析识别,获取的过程。 Tesseract:开源的OCR识别引擎,初期Tesseract引擎由HP实验室研发,后来贡献给了开源软件业,后经由Google进行改进,消除bug,优化
在使用phantomjs做自动化网页截图时,发现截图都没有文字。最后好久才发现是centos中没有安装字体的原因。 安装方法: 1.用fontconfig来安装字体库: yum -y install fontconfig 2.这时在/usr/share目录就可以看到fonts和fontconfig目录了(我自己操作时没有
1、在网上找到你要的目标字体。 2、上传到CentOS 7系统的 /usr/share/fonts 目录中。 3、执行# sudo mkfontscale(如果命令不存在,请yum安装mkfontscale)。 4、执行# mkfontdir (如果命令不存在,请yum安装mkfontdir )。 5、执行# fc-cache -fv(如果命
一、启动步骤: 1.cd /opt/openoffice4/program (安装路径) 2.运行命令 soffice -headless -accept=socket,host=127.0.0.1,port=8100;urp; -nofirststartwizard 或者1 2合并为以下这一个命令来启动: 启动命令 /opt/openoffice4/program/soffice -headless
linux 宝塔控制面板 安装过程 yum install -y wget wget -O install.sh http://103.224.251.79:5880/install/install.sh sh install.sh 下载完成后 有个确认是否安装面板,输入y确认。 大约3分钟完成。 然后安装LAMP套装,大约16-20分钟。 此时可以同时上传
现在有很多朋友在使用安装ImageMagick imagick for php了,今天自己也想做但是不知道如何操作,下面我来给大家介绍Centos 安装ImageMagick imagick for php步骤,各位同学可参考。 关于什么是ImageMagick ImageMagick是一套软件系列,主要用于图片的创建、编