安裝jdk java
a.http://download.csdn.net/download/weidi1989/6420205 下載jdk6 x64 bin文件 mysql
b.建立 /usr/local/java 目錄將bin文件拷貝這裏 web
c.vim /etc/profile sql
添加 # /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 shell
d.source /etc/profile 這個操做只對當前的對話域中有效果,若是想老是起效的話,須要從新啓動電腦 數據庫
e.java -verison 驗證 vim
2.安裝tomcat tomcat
a.apt-get install tomcat7 安全
b.工程,log等文件在/var/lib/tomcat7 server配置在/usr/share/tomcat7/ 下 bash
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 ]