The easy way to install the last JKD1.7
-- sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
uninstall
sudo apt-get remove oracle-java7-installer
Oralce JDK 1.7.0_03 (由于公司要求,live环境指定了JDK 版本)
Download JDK
http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz
(you get the permission by access the page: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html )
cd ~/Downloads
tar –zxcf jdk-7u3-linux-x64.tar.gz
#you will see the folder jdk1.7.0_03, for the same which live ,change the folder name to jdk 1.7.0
mv jdk1.7.0_03 jdk1.7.0
sudo mkdir –p –m ug+rw /usr/lib/jvm/jdk1.7.0
sodu mv jdk1.7.0 /usr/lib/jvm/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1. 1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1. 1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
sudo update-alternatives --config java
sudo update-alternatives --config javac //
sudo update-alternatives --config javaws
sudo vi /etc/environment
#Add following
JAVA_HOME=”/usr/lib/jvm/jdk1.7.0”
Test:
source /etc/environment
echo $JAVA_HOME
Notice: If you want to install other version JDK, Please see Install Other JDK 1.3 Install Nginx
sudo apt-get install nginx
Useful Command about Nginx.
Start Nginx:sudo /etc/init.d/nginx start; // sudo service nginx start
Test: Browser the location:http://localhost ; if browser show "Welcome to nginx!", you have installed Nginx successfully;
Shutdown Nginx:sudo /etc/init.d/nginx stop;
Restart nginx:sudo /etc/init.d/nginx restart;
**You can run the following command to reveal your virtual server’s IP address.
ifconfig eth0 | grep inet | awk '{ print $2 }'
When you visit your IP address page in your browser, you will see the words, “Welcome to nginx”
You can see a screenshot of the utilitarian nginx welcome page here
To ensure that nginx will be up after reboots, it’s best to add it to the startup. Type this command into terminal:
update-rc.d nginx defaults 1.4 Install PHP
访问:http://localhost/phpmyadmin
出现登陆页面, 用mysql 的用户名密度登陆即可. 1.7 Install tomcat 7
sudo apt-get install tomcat7 tomcat7-docs tomcat7-examples tomcat7-admin
Choose username and password to manage tomcat and add to /etc/tomcat7/tomcat-users.xml file in the below format.
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="[tomactAdmin]" password="[tomcatPW]" roles="manager-gui,admin-gui"/>
This code must be within this < tomcat-users > …. < / tomcat-users > Tags
Now restart the service.
sudo /etc/init.d/tomcat7 restart
与nginx整合
Must make sure stop tomcat7 and nginx first: (如果没有stop tomcat 7 , 会出现很多很奇怪的问题)