时间:2021-07-01 10:21:17 帮助过:40人阅读
# CentOS-Base.repo [base] name=CentOS-4.7 - Base - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/os/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #released updates [updates] name=CentOS-4.7 - Updates - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/updates/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #additional packages that may be useful [extras] name=CentOS-4.7 - Extras - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/extras/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #packages used/produced in the build but not released [addons] name=CentOS-4.7 - Addons - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/addons/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-4.7 - Plus - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #contrib - packages by Centos Users [contrib] name=CentOS-4.7 - Contrib - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4
yum makecache
yum安装完成,以后就可以用yum -y install <包名> 命令来安装软件,这还是非常方便的。
2、安装apache,php,mysql
yum -y install httpd httpd-devel php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
用一个命令安装所有,php-mcrypt这个包没有装,在phpMyAdmin中会有警告,还是装上吧。
在http://rpm.pbone.net/上查找以下包:
libmcrypt-2.5.7-5.el4.i386.rpm
php-common-5.3.10-2.el4.remi.i386.rpm
php-mcrypt-4.3.9-1.el4.i386.rpm
安装以上包。
apache 配置文件安装在/etc/httpd/conf,WEB目录安装了/var/www/
启动: service httpd start
停止: service httpd stop
mysql 启动 service mysqld start 停止 service mysql stop
设置mysql 帐号和密码(略)
3、编译安装tomcat connectors
wget tomcat-connectors-1.2.37-src.tar.gz
cd tomcat-connectors-1.2.37-src
cd native
仔细阅读BUILDING.txt文件,文中提到需要apxs,这个程序是httpd-devel包中安装的
查找apxs的位置,使用
rpm -ql httpd-devel
...
/usr/sbin/apxs
...
其实apache http server 的可执行文件都放在/usr/sbin/目录下,该目录在PATH环境变量中的。
./configure --with-apxs=/usr/sbin/apxs
make
在当前目录下生成了apache-1.3 和apache-2.0两个目录,我们用的是apache2.0
cd apache-2.0
cp mod_jk.so /etc/httpd/modules/
4、配置jk.
(1)创建workers.properties配置文件
cd /etc/httpd/conf
vi workers.properties
# Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009
(2)编辑httpd.conf
在加载模块段落下加入以下行
# Load mod_jk module # Update this path to match your modules location LoadModule jk_module modules/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/httpd/conf/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /var/log/httpd/mod_jk.shm # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile /var/log/httpd/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # Send everything for context /examples to worker named worker1 (ajp13) JkMount /examples/* worker1
重启apache
测试:
用tomcat的端口可以访问,用apache的端口同样也可发访问同样的内容。
如果用防火墙,要记得把lo的8009端口打开
-A INPUT -i lo -p tcp -m tcp --dport 8009 -j ACCEPT
好了,放在这里,下次配置就不会找不到了。