|
Redhat AS 4(安装系统时添加了所有的编译工具)
apache2.05+openssl0.97e+php4.0+mysql4.1+tomcat2.5+jdk1.42+jk2
1)安装 openssl http://www.openssl.org/source/
# tar -zxvf openssl-0.9.7e.tar.gz
# cd openssl-0.9.7e
# ./config
# make
# make install
我的这一过程未出现任何错误。
此时生成的openssl 库是静态的。Openssl 的安装路径是/usr/local/ssl
注:使用openssl-0.9.8.tar.gz时apache编译时会出现如下错误
ssl_engine_pphrase.c:684: error: `PEM_F_DEF_CALLBACK' undeclared (first use in this function)
ssl_engine_pphrase.c:684: error: (Each undeclared identifier is reported only once
ssl_engine_pphrase.c:684: error: for each function it appears in.)
make[3]: *** [ssl_engine_pphrase.lo] Error 1
make[3]: Leaving directory `/soft/httpd-2.0.54/modules/ssl'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/soft/httpd-2.0.54/modules/ssl'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/soft/httpd-2.0.54/modules'
make: *** [all-recursive] Error 1
如果有知道原因的请告知解决办法,万分感谢
2)安装apache(httpd-2.0.54.tar.gz) http://www.apache.org
# tar -zxvf httpd-2.0.54.tar.gz
# ./configure --prefix=/usr/local/httpd --enable-so --enable-ssl=static --enable-mods-shared=all --with-ssl=/usr/local/ssl
make
make install
在apache安装的根目录下的/bin下运行 ./apachectl startssl
注:不知道为什么此时用./apachectl start apache能以启动,但是不能访问,浏览器总是显示该业无法显示!!!
如果有知道原因的请告知解决办法,万分感谢!!!
如果你启动时出现 httpd: Could not determine the server's fully qualified domain name, using
127.0.0.1 for ServerName
只需要编辑 httpd.conf,找到 ServerName xxxx 这一行,去掉前面的注释,并把里面改成你的域名或 IP 即可。
3)证书生成
cd /usr/local/ssl/bin
openssl req -new -x509 -days 365 -nodes -out ssl.key -keyout ssl.key
这将会创建一个自己给自己签名
参数的含义:
-days 365
使这个证书的有效期是 1 年,之
-new
创建一个新的证书
-x509
创建一个 X509 证书(自己签名
-nodes
这个证书没有密码
-out ssl.key
把 SSL 证书公钥写到哪里
-keyout ssl.key
把 SSL 私钥放到这个文件中
# cd /usr/local/httpd/conf/
# mkdir ssl.crt
# mkdir ssl.key
# touch ssl.crt/server.crt
# touch ssl.key/server.key
分别把 ssl.key 中的公钥、私钥拷贝到这两个文件中,server.crt 拷公钥,server.key 拷私钥
到此,证书建立完毕。
注意此时生成的只有ssl.key
将
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
之间的内容拷贝到server.key
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
之间的内容拷贝到server.crt
修改/usr/local/httpd/conf/ssl.conf
在最后一行加入
RewriteEngine on
RewriteCond % !^443$
RewriteRule ^(.*)?$ https://%/ [L,R]
含义我也不太清楚,请高手能否说明一下其中的含义,谢谢
4)安装mysql 我用的是mysql.4.14.tar.gz http://www.mysql.com
我用的是tar包安装的
安装法详细地可以看INSTALL-BINARY
以下是我的安装步骤:
groupadd mysql useradd -g mysql mysql tar –zxvf mysql.4.14.tar.gz cd mysql.4.14.tar.gz ./configure --prefix=/usr/local/mysql make make install cp support-files/my-medium.cnf /etc/my.cnf cd /usr/local/mysql bin/mysql_install_db --user=mysql chown -R root . chown -R mysql var chgrp -R mysql . bin/mysqld_safe --user=mysql & 启动mysql /usr/local/mysql/share/mysql/mysql.server start
5)安装php4.40 tar zxvf php-4.4.0.tar.gz cd php-4.4.0 ./configure --prefix=/usr/local/php --with-config-filepath=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-openssl=/usr/local/ssl --with-mysql=/usr/local/mysql (这是tar包模式) rpm模式 ./configure --prefix=/usr/local/php --with-config-filepath=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-openssl=/usr/local/ssl --with-apxs2=/usr/local/httpd/bin/apxs --with-openssl=/usr/local/ssl
make make install
更改apache的配制文件:得加几行,目的是让apache能解释php程序。 查找AddType application/x-tar .tgz 行,在下面添加 AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AddType application/x-httpd-php .phtml AddType application/x-httpd-php-source .phps 找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php DirectoryIndex index.html index.html.var index.php 5)安装jdk ./j2sdk-1_4_2-linux-i586.bin 移动jdk1.5.0_03到/usr/local/下 mv jdk1.5.0_03 /usr/local 建立/usr/local/下的jdk连接 # ln -s /usr/local/jdk1.5.0_03 /usr/local/jdk
设置环境变量在/etc/profile文件的最后添加
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
6)安装tomcat (我的版本是jakarta-tomcat-5.0.30.tar.gz)
tar –zxvf jakarta-tomcat-5.0.30.tar.gz –C /www/ (我的是www你可以确定自己的目录)
|