redhat as4 最小化安装配置全记录

redhat as4 linux是最小化安装,注意:我安装的时候禁用了SELinux和防火墙,安装完重启后步骤如下:

1. 关闭IPV6
   # vi /etc/modprobe.conf (修改相应配置文件,添加如下行到文尾)
   alias net-pf-10 off
   alias ipv6 off

2. 关闭一些不需要的服务进程
   # ntsysv
   推荐保留的服务:
   crond (定时监控程序)
   irqbalance (当服务器CPU为S.M.P架构或支持双核心、HT技术时,才需开启,否则关闭。)
   microcode_ctl
   network (网络服务)
   random
   sendmail (邮件)
   sshd (远程连接)
   syslog (系统日志)

3. 安装gcc编译器和其它组件安装包
   # rpm -ivh cpp-3.4.6-3.i386.rpm
   # rpm -ivh glibc-kernheaders-2.4-9.1.98.EL.i386.rpm
   # rpm -ivh glibc-headers-2.3.4-2.25.i386.rpm
   # rpm -ivh glibc-devel-2.3.4-2.25.i386.rpm
   # rpm -ivh gcc-3.4.6-3.i386.rpm
   # rpm -ivh libstdc++-devel-3.4.6-3.i386.rpm
   # rpm -ivh gcc-c++-3.4.6-3.i386.rpm
   # rpm -ivh ncurses-devel-5.4-13.i386.rpm
   # rpm -ivh zlib-devel-1.2.1.2-1.2.i386.rpm
   # rpm -ivh libidn-0.5.6-1.i386.rpm
   # rpm -ivh libidn-devel-0.5.6-1.i386.rpm
   # rpm -ivh curl-7.12.1-8.rhel4.i386.rpm
   # rpm -ivh e2fsprogs-devel-1.35-12.4.EL4.i386.rpm
   # rpm -ivh krb5-devel-1.3.4-27.i386.rpm
   # rpm -ivh openssl-devel-0.9.7a-43.10.i386.rpm
   # rpm -ivh curl-devel-7.12.1-8.rhel4.i386.rpm

4. 安装和配置ftp服务

  • 安装vsftpd
    # rpm -ivh vsftpd-2.0.1-5.EL4.5.i386.rpm
  • 设置自动启动
    # ntsysv
    然后把vsftpd选中并保存
  • 设置配置文件
    # vi /etc/vsftpd/vsftpd.conf

    1. 禁止匿名登陆: anonymous_enable=YES 更改为 anonymous_enable=NO
    2. 如果要把本地用户限制在自已的目录,就添加一行:chroot_local_user=YES
      

5. 编译安装mysql

  • 下载源码包
    http://dev.mysql.com/downloads/mysql/5.1.html#source
  • 解压并进行编译
    # tar zxvf mysql-5.1.26-rc.tar.gz
    # cd mysql-5.1.26-rc
    # ./configure /
    --prefix=/usr/local/mysql /
    --with-extra-charsets=all /
    --without-debug /
    --enable-assembler /
    --with-client-ldflags=-all-static /
    --with-mysqld-ldflags=-all-static /
    --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock

    编译参数说明(按顺序排列):

    -- 设置安装路径
    -- 加入所有字符集支持
    -- 去除debug模式
    -- 使用一些字符函数的汇编版本
    -- 以纯静态方式编译客户端
    -- 以纯静态方式编译服务端
    -- 使用unix套接字链接

    # make
    # make install
  • 拷贝配置文件
    # cp support-files/my-medium.cnf /etc/my.cnf
    # cp support-files/mysql.server /etc/init.d/mysql
  • 建立用户组并初始化数据库
    # groupadd mysql
    # useradd -g mysql mysql
    # bin/mysql_install_db --user=mysql
  • 设置权限
    # chown -R root .
    # chown -R mysql .
    # chown -R mysql var
    # /usr/local/mysql/bin/mysqld_safe --user=mysql &
  • 加入到启动项
    # vi /etc/rc.d/rc.local
    添加内容:service mysql start


6. 编译安装apache

  • 下载源码包
    http://httpd.apache.org/download.cgi
  • 解压
    # tar zxvf httpd-2.2.9.tar.gz
  • 编译apr
    # cd /usr/src/httpd-2.2.9/srclib/apr
    # ./configure --prefix=/usr/local/apr
    # make
    # make install
  • 编译apr-util
    # cd /usr/src/httpd-2.2.9/srclib/apr-util
    # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    # make
    # make install
  • 编译apache
    # cd /usr/src/httpd-2.2.9
    # ./configure /
    --prefix=/usr/local/apache /
    --with-apr=/usr/local/apr /
    --with-apr-util=/usr/local/apr-util /
    --with-mpm=worker /
    --enable-modules=all /
    --enable-so /
    --disable-cgi
    # make
    # make install
  • 复制控制脚本并建立启动项
    # cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
    # vi /etc/rc.d/rc.local
    添加内容:service httpd start


7. 编译安装php

  1. 安装GD
    • 下载源码包
      GD: http://www.libgd.org/releases/
      Zlib: http://zlib.net/
      LibXML2: ftp://xmlsoft.org/libxml2/
      JpegSrc: ftp://ftp.uu.net/graphics/jpeg/
      LibPNG: http://www.libpng.org/pub/png/libpng.html
      Freetype: http://download.savannah.gnu.org/releases/freetype/
      XPM: http://koala.ilog.fr/ftp/pub/xpm/
    • 安装XPM
      安装xmkmf命令
      # rpm -ivh freetype-devel-2.1.9-1.i386.rpm
      # rpm -ivh fontconfig-devel-2.2.3-7.i386.rpm
      # rpm -ivh pkgconfig-0.15.0-3.i386.rpm
      # rpm -ivh xorg-x11-devel-6.8.2-1.EL.13.36.i386.rpm

      # tar zxvf xpm-3.4k.tar.gz
      # cd xpm-3.4k
      # xmkmf -a
      # make
      # make install
    • 安装libxml2
      # tar zxvf libxml2-2.6.32.tar.gz
      # cd libxml2-2.6.32
      # ./configure
      # make
      # make install
    • 安装jpegsrc
      # tar zxvf jpegsrc.v6b.tar.gz
      # mkdir -p /usr/local/man/man1
      # cd jpeg-6b
      # ./configure --enable-shared
      # make
      # make install
    • 安装libpng
      # tar zxvf libpng-1.2.29.tar.gz
      # cd libpng-1.2.29
      # ./configure
      # make
      # make install
    • 安装freetype
      # tar zxvf freetype-2.1.10.tar.gz
      # cd freetype-2.1.10
      # ./configure --prefix=/usr/local/freetype2
      # make
      # make install
    • 安装zlib
      # tar zxvf zlib-1.2.3.tar.gz
      # cd zlib-1.2.3
      # ./configure --prefix=/usr/local/zlib
      # make
      # make install
    • 安装GD
      # tar zxvf gd-2.0.35.tar.gz
      # cd gd-2.0.35
      # ./configure --prefix=/usr/local/gd /
      --with-png /
      --with-freetype=/usr/local/freetype2 /
      --with-fontconfig /
      --with-jpeg /
      --with-xpm
  2. 编译PHP
    • 下载源码包
      http://www.php.net/downloads.php
    • 编译
      # tar zxvf php-5.2.6.tar.gz
      # cd php-5.2.6
      # ./configure --prefix=/usr/local/php /
      --with-gd=/usr/local/gd /
      --with-freetype-dir=/usr/local/freetype2 /
      --with-zlib=/usr/local/zlib /
      --with-curl /
      --with-mysql=/usr/local/mysql /
      --with-mysql-sock=/usr/local/mysql/tmp/mysql.sock /
      --with-pdo-mysql=/usr/local/mysql /
      --with-apxs2=/usr/local/apache/bin/apxs /
      --enable-mbstring /
      --disable-ipv6 /
      --disable-posix /
      --disable-spl /
      --disable-tokenizer /
      --without-sqlite /
      --without-pear /
      --without-pdo-sqlite
      # make
      # make install
    • 复制php.ini
      # cp php.ini-recommended /usr/local/php/lib/php.ini
    • 与apache集成
      # vi /usr/local/apache/conf/httpd.conf
      添加:AddType application/x-httpd-php .php
      在DirectoryIndex中添加: index.php
    • 安装eAccelerator
      1. 下载:http://www.eaccelerator.net
      2. 编译
        # tar jxvf eaccelerator-0.9.5.3.tar.bz2
        # cd eaccelerator-0.9.5.3
        # ./configure --enable-shared --with-php-config=/usr/local/php/bin/php-config
        # make
        # make install
        记住最后生成的地址备用。
      3. 建立缓存目录
        # mkdir /tmp/eaccelerator
        # chmod 777 /tmp/eaccelerator
      4. 配置php.ini,添加如下配置:
        [eaccelarator]
        extension_dir="/usr/local/php/lib/php/extensions"
        extension="/no-debug-zts-20060613/eaccelerator.so"
        eaccelerator.shm_size="32"
        eaccelerator.cache_dir="/tmp/eaccelerator"
        eaccelerator.enable="1"
        eaccelerator.optimizer="1"
        eaccelerator.check_mtime="1"
        eaccelerator.debug="0"
        eaccelerator.filter=""
        eaccelerator.shm_max="0"
        eaccelerator.shm_ttl="0"
        eaccelerator.shm_prune_period="0"
        eaccelerator.shm_only="0"
        eaccelerator.compress="1"
        eaccelerator.compress_level="9"

截止到这里,一个服务器的基本结构就完成了,剩下的工作也就是进行一些细节设置和优化配置。全过程我花费了两天时间,主要是在解决一些程序的依赖性问题上。另外就是权限问题。参考了网上大量文献,的确不容易。看来linux还是得多多动手才能熟练掌握。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值