-
安装jdk
a.http://download.csdn.net/download/weidi1989/6420205 下载jdk6 x64 bin文件
b.创建 /usr/local/java 目录将bin文件拷贝这里
c.vim /etc/profile
添加 # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
#set java environment
export JAVA_HOME=/usr/local/java/jdk1.6.0_37
export JRE_HOME=/usr/local/java/jdk1.6.0_37/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JAVA_HOME:$PATH
d.source /etc/profile 这个操作只对当前的对话域中有效果,如果想总是起效的话,需要重新启动电脑
e.java -verison 验证
2.安装tomcat
a.apt-get install tomcat7
b.工程,log等文件在/var/lib/tomcat7 server配置在/usr/share/tomcat7/ 下
c.设置启动参数
修改/usr/share/tomcat7/bin/catalina.sh文件
在cygwin=false前添加(物理内存512M)
JAVA_OPTS="-server -Xms200M -Xmx400M -XX:PermSize=128M -XX:MaxPermSize=256M"
d.启动关闭
service tomcat7 restart
/etc/init.d/tomcat7 stop
/etc/init.d/tomcat7 start
3.部署
a.工程右键->export->javaee->war file
如果报错10.7.1 可参考http://download.csdn.net/download/cfltp/8005467
b.打成zip包,上传也可
4.修改tomcat ROOT目录
找到 :
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
下面添加
<Context path="" docBase="XXXXX" debug="0" reloadable="true" />
5.安装mysql
a.验证原有主机上是否安装mysql:sudo netstat -tap | grep mysql
b.sudo apt-get install mysql-server mysql-client来安装mysql
c.配置文件:vim /etc/mysql/my.cnf
d.mysql 远程授权
现在my.cnf中注释bing-adress=127.0.0.1
#mysql -u root -p
#GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'password' WITH GRANT OPTION;
6.修改mysql密码:
1. 确认服务器处于安全状态,因为数据库都很重要,在以下修改mysql的root账户的密码中,任意用户都能访问修改你的数据库,所以建议断网,在不联网的环境下修改。
2. 关闭MySQL,打开/etc/my.cnf,在[mysqld]的段中加上一句:skip-grant-tables,保存退出。
3. [...] # /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
4. [...] # /usr/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> USE mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
5.[...] # vi /etc/my.cnf ,将刚才在[mysqld]的段中加上的skip-grant-tables删除 ,保存并且退出vi。
6.[...] # /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]