---------------安裝MYSQL---------------
(照搬mysql文檔)
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
以上已經完成mysql的安裝,然後将mysql加入到系統服務中
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld
給mysql設定密碼:
/usr/local/mysql/bin/mysqladmin -u root password "123456"
驗證
/usr/local/mysql/bin/mysql -uroot -p
輸入密碼後,僅需mysql指令行
輸入show databases; 可以顯示目前資料庫
配置mysql庫檔案的搜尋路徑:
echo "/usr/local/mysql/lib/mysql/" >> /etc/ld.so.conf
ldconfig
ldconfig -v (輸出檢視)
添加mysql到環境變量
echo "export PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile
source /etc/profile
-----------安裝 apr----------------------
tar -zxvf apr-1.3.6.tar.gz
cd apr-1.3.16
./configure --prefix=/usr/local/apr
make
make install
----------------安裝apr-util---------------
tar -zxvf apr-util-1.3.8.tar.gz
cd apr-util-1.3.8
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/mysql/lib/mysql
/usr/local/apr-util/lib/
使生效:
#ldconfig
---------------------安裝apache----------------------
tar -zxvf httpd-2.2.13.tar.gz
cd httpd-2.2.13
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-proxy --enable-proxy-ajp --
enable-proxy-balance --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
把apache添加到服務中
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vim /etc/rc.d/init.d/httpd
在第二行添加以下兩行文字
#chkconfig: 2345 10 90
#description: Activates/Deactivates Apache Web Server
儲存退出
chkconfig --add httpd
chkconfig --level 345 httpd on
此時已經可是使用
service httpd restart
---------------------安裝tomcat----------------------
tar -zxvf apache-tomcat-6.0.29.tar.gz
mv apache-tomcat-6.0.29 /usr/local/tomcat (重命名tomcat檔案夾)
vim /usr/local/tomcat/bin/catalina.sh
在最後添加如下行:
JAVA_HOME=/usr/java/jdk1.6.0_22
啟動tomcat :
/usr/local/tomcat/bin/startup.sh
檢驗: netstat -tunlp
顯示以下:
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 7242/java
tcp 0 0 :::8009 :::* LISTEN 7242/java
tcp 0 0 :::8080 :::* LISTEN 7242/java
tcp 0 0 :::80 :::* LISTEN 7163/httpd
其中,tomcat使用8080 和8009兩個端口
将tomcat加入到自動啟動中:
vim /etc/rc.d/rc.local
加入:
export JDK_HOME=/usr/java/jdk1.6.0_22
export JAVA_HOME=/usr/java/jdk1.6.0_22
可以再IE中輸入:
http://128.1.37.68:8080/ 檢查tomcat是否啟動
在apache中添加對tomcat的支援(代理模式的支援)
vim /usr/local/apache/conf/httpd.conf
最後添加如下兩行:
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
儲存退出後,重新開機apache服務和tomcat
/usr/local/tomcat/bin/shutdown.sh
此時在IE中輸入http://128.1.37.68,顯示的是tomcat的支援頁面,就不用再位址後加端口号了。