免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1001 | 回复: 0
打印 上一主题 下一主题

L.A.M.P配置过程 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-22 09:16 |只看该作者 |倒序浏览
一.系统约定    软件源代码包存放位置      /root/lamp    源码包编译安装位置(prefix)   /usr/local/software_name    脚本以及维护程序存放位置   /usr/local/sbin    MySQL 数据库位置          /var/lib/mysql    Apache 网站根目录          /var/www/html    Apache 虚拟主机日志根目录  /var/www/logs    Apache 运行帐户            www:www
二、系统环境配置1、  # ntsysv   以下仅列出需要启动的服务,未列出的服务一律关闭:      atd                # 运行用户用At命令调度的任务。也在系统负荷比较低时 运行批处理任务。   crond              # Linux下的计划任务    irqbalance         #irqbalance是一个提高系统性能的服务,它可以根据CPU的压力情况,将各种IRQ重新指定到不同的CPU进行处理,这个特性主要用于x86 和 x86_64 系统。   microcode_ctl      # 可以编码以及发送新的微代码到kernel以更新Intel IA32系列处理器(Pentium Pro,PII,PIII,Pentium 4,Celeron, Xeon 等等 – 全部 P6 以及更高,不包括 pentium classics)。   network            # 在系统启动时激活所有的网络接口。   sendmail           #邮件服务器。   sshd               # Secure Shell Protocol,实现安全地远程登陆管理主机。   syslog             # 记录所有的系统行为。
2、重启系统      #  reboot
3、 使用yum程序安装所需软件包(以下为标准的RPM包名称)      # yum install ntp vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel kernel
4、定时校正服务器时钟,定时与中国国家授时中心授时服务器同步      # crontab -e      加入一行:      */30 * * * * ntpdate 210.72.145.44
5、源代码编译安装所需包(1) GD2       # cd /root/lamp       # wget http://www.libgd.org/releases/oldreleases/gd-2.0.34.tar.gz       # tar xzvf gd-2.0.34.tar.gz       # cd gd-2.0.34       # ./configure --prefix=/usr/local/gd2       # make       # make install(2) LibXML2       # cd /root/lamp       # wget ftp://xmlsoft.org/libxml2/libxml2-2.6.29.tar.gz       # tar xzvf libxml2-2.6.29.tar.gz       # cd libxml2-2.6.29       # ./configure --prefix=/usr/local/libxml2       # make       # make install(3) LibMcrypt       # cd /root/lamp       #wget http://jaist.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.bz2       # tar xjvf libmcrypt-2.5.8.tar.bz2       # cd libmcrypt-2.5.8       # ./configure --prefix=/usr/local/libmcrypt       # make       # make install       # cd libltdl       # ./configure -enable-ltdl-install        # make       # make install(4) Apache 日志截断程序       # cd /root/lamp       # wget http://cronolog.org/download/cronolog-1.6.2.tar.gz       # tar xzvf cronolog-1.6.2.tar.gz       # cd cronolog-1.6.2       # ./configure --prefix=/usr/local/cronolog       # make       # make install
6、升级OpenSSL和OpenSSH       # cd /root/lamp       # wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz       # wget http://mirror.mcs.anl.gov/openssh/portable/openssh-4.6p1.tar.gz       # tar xzvf openssl-0.9.8e.tar.gz       # cd openssl-0.9.8e       # ./config --prefix=/usr/local/openssl       # make       # make test       # make install       # cd ..       # tar xzvf openssh-4.6p1.tar.gz       # cd openssh-4.6p1       # ./configure  \"--prefix=/usr" \"--with-pam" \"--with-zlib" \"--sysconfdir=/etc/ssh" \"--with-ssl-dir=/usr/local/openssl" \"--with-md5-passwords"    # make    # make install
(1)禁用 SSH V1 协议找到:#Protocol 2,1改为:Protocol 2
(2)禁止root直接登录此处先建立一个普通系统用户:    # useradd username   # passwd username找到:#PermitRootLogin yes改为:PermitRootLogin no
(3)禁用服务器端GSSAPI找到以下两行,并将它们注释:GSSAPIAuthentication yesGSSAPICleanupCredentials yes
(4)禁用 DNS 名称解析找到:#UseDNS yeas改为:UseDNS no
(5)禁用客户端 GSSAPI# vi /etc/ssh/ssh_config找到:GSSAPIAuthentication yes将这行注释掉。
最后,确认修改正确后重新启动 SSH 服务# service sshd restart# ssh -v 确认 OpenSSH 以及 OpenSSL 版本正确。
三、编译安装L.A.M.P环境1、编译安装MySQL    # ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Comsenz --with-mysqld-user=mysql --without-debug --with-big-tables --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-isam --without-innodb --without-ndb-debug    # useradd mysql    # cd /usr/local/mysql    # bin/mysql_install_db --user=mysql    # chown -R root:mysql .    # chown -R mysql /var/lib/mysql    # cp share/mysql/my-huge.cnf /etc/my.cnf    # cp share/mysql/mysql.server /etc/init.d/mysqld    # chmod 755 /etc/init.d/mysqld    # chkconfig --add mysqld    # chkconfig --level 3 mysqld on    # /etc/rc.d/init.d/mysqld start    # bin/mysqladmin -u root password 'password_for_root'
2、编译安装Apache    # tar zxvf httpd-2.2.14.tar.gz    # cd httpd-2.2.14    #./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support --disable-userdir    # make && make install    # /usr/local/apache2/bin/apachectl start
3、编译安装php    # tar zxvf php-5.3.0.tar.gz    # cd php-5.3.0    # ./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=/usr/local/libxml2" \        "--with-gd=/usr/local/gd2" \        "--with-jpeg-dir" \        "--with-png-dir" \        "--with-bz2" \        "--with-freetype-dir" \        "--with-iconv-dir" \        "--with-zlib-dir " \        "--with-openssl=/usr/local/openssl" \        "--with-mcrypt=/usr/local/libmcrypt" \        "--enable-soap" \        "--enable-gd-native-ttf" \        "--enable-ftp" \        "--enable-mbstring" \        "--enable-exif" \        "--disable-ipv6" \        "--disable-cgi" \        "--disable-cli"   # make && make install   # mkdir /usr/local/php/etc   # cp php.ini-production /usr/local/php/etc/php.ini
4、安装Zend Optimizer   # cd /root/lamp   # tar xzvf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz   # ./ZendOptimizer-3.2.8-linux-glibc21-i386/install.sh   安装Zend Optimizer过程的最后不要选择重启Apache。
5、整合Apache与PHP    # vim /usr/local/apache2/conf/httpd.conf找到:AddType application/x-gzip .gz .tgz在该行下面添加AddType application/x-httpd-php .php
找到:    DirectoryIndex index.html将该行改为    DirectoryIndex index.html index.htm index.php
找到:#Include conf/extra/httpd-mpm.conf
去掉前面的“#”号,取消注释。这里是指虚拟机配置文件,可以自己定义
修改完成后保存退出。# /usr/local/apache2/bin/apachectl restart
6. 查看确认L.A.M.P环境信息、提升 PHP 安全性   在网站根目录放置 phpinfo.php 脚本,检查phpinfo中的各项信息是否正确。   #vi phpinfo.php      phpinfo();   ?>确认 PHP 能够正常工作后,在 php.ini 中进行设置提升 PHP 安全性。   # vim /usr/local/php/etc/php.ini        找到:        disable_functions =        设置为:        passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status,error_log,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/98137/showart_2075298.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP