当前位置: > CentOS > CentOS教程 >

centos6.2安装tomcat+mysql

时间:2014-02-24 00:38来源:linux.it.net.cn 作者:IT网

1,下载apache-tomcat-6.0.35.tar.gz

2,md5sum apache-tomcat-6.0.35.tar.gz

3,su - root,mv apache-tomcat-6.0.35.tar.gz /usr/share

4,cd /usr/share,tar zxvf apache-tomcat-6.0.35.tar.gz

5,到tomcat的bin目录测试下启动:./startup.sh

6,把tomcat安装成系统服务:

cd /etc/init.d

vi tomcat




1.#!/bin/bash   
2.# description: Tomcat Start Stop Restart   
3.# processname: tomcat   
4.# chkconfig: 234 20 80   
5.JAVA_HOME=/usr/java/jdk1.6.0_30   
6.export JAVA_HOME   
7.PATH=$JAVA_HOME/binPATH   
8.export PATH   
9.CATALINA_HOME=/usr/share/apache-tomcat-6.0.35   
10.   
11.case $1 in   
12.start)   
13.sh $CATALINA_HOME/bin/startup.sh   
14.;;    
15.stop)      
16.sh $CATALINA_HOME/bin/shutdown.sh   
17.;;    
18.restart)   
19.sh $CATALINA_HOME/bin/shutdown.sh   
20.sh $CATALINA_HOME/bin/startup.sh   
21.;;    
22.esac       
23.exit 0 





chmod 755 tomcat

chkconfig --add tomcat

chkconfig --level 2345 tomcat on

chkconfig --list tomcat

7,测试下:

service tomcat start

service tomcat restart

service tomcat stop



附:安装mysql5的步骤:

# sudo yum -y install mysql-server

# sudo /etc/rc.d/init.d/mysqld start

# sudo chkconfig mysqld on

# mysql -u root

mysql>
select user,host,password from mysql.user;
mysql>set password for root@localhost=password('password');
mysql>set password for root@'127.0.0.1'=password('password');
mysql>set password for root@'www.server.world'=password('password');
mysql>
delete from mysql.user where user='';

mysql>select user,host,password from mysql.user;
mysql>exit




# mysql -u root -p
输入密码进入即可。

附:安装phpMyAdmin
# sudo yum install phpMyAdmin
# su - root
# cd /usr/share/phpmyadmin/
# cp config.sample.inc.php config.inc.php
# vim config.inc.php
// $cfg['Servers'][$i]['controluser'] = ‘pma’;
// $cfg['Servers'][$i]['controlpass'] = ‘pmapass’;
将“//”注释号删除,同时输入您在 MySQL 中配置的用户名和密码

 

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容