Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> 電腦軟件教程 >> 服務器技術 >> 關於服務器 >> Apache+SSL+PHP+JSP+MySQL+IMAP+GD安裝全攻略

Apache+SSL+PHP+JSP+MySQL+IMAP+GD安裝全攻略

日期:2017/2/8 10:29:45      編輯:關於服務器

在RedHat 7.2上,假設所有安裝程序包都下在/pub下面,源碼包都用紅色表示,假設在telnet或ssh文本界面下進行如下所有操作。

  1、Install J2SDK 1.4

  下載 J2SDK1.4 的 Linux RPM版本 j2sdk-1_4_0-linux-i386-rpm.bin,然後執行下面的操作:

  cd /pub
  chmod +x j2sdk-1_4_0-linux-i386-rpm.bin
  ./j2sdk-1_4_0-linux-i386-rpm.bin
  rpm -ivh j2sdk-1_4_0-fcs-linux-i386.rpm
  vi /etc/profile 增加如下內容:
  JAVA_HOME=/usr/java/j2sdk1.4.0
  export JAVA_HOME
  CLASSPATH=/usr/java/j2sdk1.4.0/lib:/usr/java/j2sdk1.4.0/jre/lib
  export CLASSPATH
  PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
  export PATH

  重新登錄讓環境變量生效

  2、Install Tomcat 4.0

  下載Tomcat的linux binary版本,以及 mod_webapp.so,然後執行下列操作:

  tar zxvf jakarta-tomcat-4.0.3.tar.gz
  做 /pub/jakarta-tomcat-4.0.3/conf 目錄下面server.xml中的其他相關配置(暫時不做也可以)。
  /pub/jakarta-tomcat-4.0.3/bin/startup.sh
  啟動 Tomcat 服務,並且將它加到系統的啟動程序中/etc/rc.d/rc.local
  (用/pub/jakarta-tomcat-4.0.3/bin/shutdown.sh
  停止Tomcat )

3、Install MySQL

  groupadd mysql
  useradd -g mysql mysql
  tar zxvf mysql-3.23.49.tar.gz
  (or, gunzip < mysql-3.23.49.tar.gz │ tar xvf -)
  cd mysql-3.23.49
  ./configure --prefix=/usr/local/mysql
  make
  make install
  scripts/mysql_install_db
  chown -R root /usr/local/mysql
  chown -R mysql /usr/local/mysql/var
  chgrp -R mysql /usr/local/mysql
  cp support-files/my-medium.cnf /etc/my.cnf
  cp scripts /usr/local/mysql -R
  cp support-files /usr/local/mysql -R
  cd /usr/local/mysql
  chmod +x support-files/mysql.server
  cp support-files/mysql.server /etc/rc.d/init.d/mysqld
  同時要設置 /etc/rc.d/init.d/mysqld 開機自動運行:
  ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/S99mysqld
  /etc/rc.d/init.d/mysqld start
  啟動 MySQL
  /usr/local/mysql/bin/mysqladmin -u root password
  ew-password
  設置 MySQL root 口令

  4、Install OpenSSL

  cd /pub
  tar zxvf openssl-0.9.6b.tar.gz
  cd openssl-0.9.6b
  ./config
  make
  make test
  make install

  5、Install mod_ssl

  cd /pub
  tar zxvf mod_ssl-2.8.8-1.3.24.tar.gz
  tar zxvf apache_1.3.24.tar.gz
  (from www.apache.org)
  cd mod_ssl-2.8.8-1.3.24
  ./configure --with-apache=../apache_1.3.24
  cd ../apache_1.3.24
  ./configure --prefix=/www
  Install
  href="ftp://ftp.cac.washington.edu/imap/" target=_blank>IMAP support
  cd /pub
  tar zxvf imap-2001a.tar.Z
  cd imap-2001a
  make slx (for Linux)
  修改 /etc/services 注冊端口,修改 /etc/inetd.conf 開啟服務
  cp c-client/c-client.a /usr/local/lib/libc-client.a
  cp c-client/rfc822.h /usr/local/include
  cp c-client/mail.h /usr/local/include
  cp c-client/linkage.h /usr/local/include

  6、Install CURL support

  cd /pub
  tar zxvf curl-7.9.6.tar.gz
  cd curl-7.9.6
  ./configure --with-ssl --with-prefix=/usr/local/curl
  make
  make test
  make install
7、Install zlib support

  cd /pub
  tar zxvf zlib-1.1.3.tar.gz
  cd zlib-1.1.3
  ./configure
  make
  make test
  make install

  8、Install libpng support

  cd /pub
  tar zxvf libpng-1.0.10.tar.gz
  cd libpng-1.0.10
  cp scripts/makefile.linux makefile
  vi makefile

  修改其中

  ZLIBLIB=/usr/local/lib

  ZLIBINC=/usr/local/include

  參數
  make test
  make install

  Install jpeg-6b
  support

  cd /pub
  tar zxvf jpegsrc.v6b.tar.gz
  cd jpeg-6b
  ./configure
  make
  make test
  make install
  make install-lib

  9、Install FreeType 2.0.1 support

  cd /pub
  tar zxvf freetype-2.0.1.tar.gz
  cd freetype-2.0.1
  make setup
  make
  make install

10、Install GD support

  cd /pub
  tar zxvf gd-1.8.4.tar.gz
  cd gd-1.8.4
  vi Makefile

  修改其中

  CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE

  LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm

  INCLUDEDIRS=-I. -I/usr/local/include/freetype2 -I/usr/include/X11
  -I/usr/X11R6/include/X11 -I/usr/local/include
  make
  make install

  11、Install PHP

  cd /pub
  tar zxvf php-4.2.0.tar.gz
  cd php-4.2.0
  CFLAGS=-O2 -I/usr/local/ssl/include
  ./configure --with-apache=../apache_1.3.24
  --enable-memory-limit=yes
  --with-config-file-path=/usr/local/lib --with-imap --enable-ftp
  --with-mysql=/usr/local/mysql
  --enable-sockets --enable-debug=no --enable-track-vars
  --with-gd=/usr/local
  --with-jpeg-dir=/usr/local --with-png-dir=/usr/local
  --with-curl=/usr/local/curl
  --with-zlib --with-ttf --with-java
  make
  make install
  cp php.ini-dist /usr/local/lib/php.ini
  修改 /usr/local/lib/php.ini

  12、Install Zend Optimizer

  cd /pub
  tar zxvf ZendOptimizer-1[1].2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz
  cd ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386
  mkdir /usr/local/Zend
  mkdir /usr/local/Zend/lib
  ./install.sh

  13、Install Zend Cache

  cd /pub
  tar zxvf ZendCache-1[1].1.0b-PHP_4.0.5-Linux_glibc2.1-i386.tar.gz
  cd ZendCache-1.1.0b-PHP_4.0.5-Linux_glibc2.1-i386
  cp data/ZendCache.so /usr/local/Zend/lib
  ( cp zend_cache.dat /usr/local/Zend ) // to register
  license
  Add the following lines to your php.ini file;
  do not add any extra spaces or tabs; must after Zend Optimizer configuration:
  zend_cache.use_cwd=1
  zend_cache.memory_consumption=16 ; 16MB
  zend_cache.validate_timestamps=1
  zend_extension="/usr/local/Zend/lib/ZendCache.so"

  14、Install Zend Accelerator

  cd /pub
  tar xvf ZendAccelerator-2.0.0-PHP_4.0.5-Linux_glibc21-i386.tar
  cd ZendAccelerator-2.0.0-PHP_4.0.5-Linux_glibc21-i386
  ./install.sh

 15、Install Apache

  cd ../apache_1.3.24
  SSL_BASE=/usr/local/ssl ./configure
  --prefix=/www --enable-module=ssl --enable-module=so
  --activate-module=src/modules/php4/libphp4.a
  --enable-rule=SSL_SDBM --enable-module=rewrite
  make
  make certificate
  make install
  修改 /www/conf/httpd.conf,
  Options Indexes FollowSymLinks MultiViews -> Options FollowSymLinks MultiViews
  DirectoryIndex index.html -> DirectoryIndex index.html index.php3 index.php
增加
  LoadModule webapp_module libexec/mod_webapp.so
  WebAppConnection warpConnection warp localhost:8008
  WebAppDeploy examples warpConnection /examples/
  vi /www/conf/mime.types 增加
  application/x-httpd-php php php3
  拷貝下載的 mod_webapp.so 到 /www/libexec
  啟動Apache
  /www/bin/apachectl startssl
  vi /etc/rc.d/init.d/httpd (可選)
  #!/bin/sh
  . /etc/rc.d/init.d/functions
  case "" in
  start)
  echo -n "Starting httpd with SSL : "
  /www/bin/apachectl startssl
  ;;
  stop)
  echo -n "Shutting down httpd: "
  /www/bin/apachectl stop
  ;;
  restart)
  echo -n "Restarting httpd: "
  /www/bin/apachectl restart
  ;;
  status)
  echo -n "Show httpd status: "
  /www/bin/apachectl status
  ;;
  *)
  echo "Usage: "
  exit 1
  esac
  exit 0
  ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S99httpd (開機自動運行)

  16、最後測試

  在/www/htdocs/下寫個test.php,內容:,
http://localhost/test.php,看看有沒有很多php信息出來,如果有,說明php/mysql等都沒有問題了。如果有"with Zend Optimizer v1.2.0, Copyright (c) 1998-2001, by Zend Technologies",說明Zend Optimizer裝好了。如果有"with Zend Cache v1.1.0, Copyright (c) 1999-2001, by Zend Technologies",說明Zend Cache裝好了。同理,看Zend Accelerator裝好沒有。

Copyright © Windows教程網 All Rights Reserved