>> 軟件清單
jdk6
tomcat
memcached
activemq
nginx(已裝)
ps:未註明版本號的,用最新的穩定版即可。
未註明安裝位置的,均安裝在指定目錄(這裏是/usr/local/cellar)
一些軟件的操作腳本在/usr/local/etc/rc.d下
jdk6
tomcat
memcached
activemq
nginx(已裝)
ps:未註明版本號的,用最新的穩定版即可。
未註明安裝位置的,均安裝在指定目錄(這裏是/usr/local/cellar)
一些軟件的操作腳本在/usr/local/etc/rc.d下
>> 安裝步驟
jdk6
* 檢查服務器是否已安裝過sun jdk,有則跳過此步驟.
* 從官網下載jdk-6u27-linux-i586.bin
* # mkdir /usr/java
* # ./jdk-6u27-linux-i586.bin 執行後將解壓後的jdk1.6.0_27移到/usr/java/下.
* # vi /etc/profile 添加
export JAVA_HOME=/usr/java/jdk1.6.0_27
export CLASS_PATH=.:%JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
* source /etc/profile 生效
jdk6
* 檢查服務器是否已安裝過sun jdk,有則跳過此步驟.
* 從官網下載jdk-6u27-linux-i586.bin
* # mkdir /usr/java
* # ./jdk-6u27-linux-i586.bin 執行後將解壓後的jdk1.6.0_27移到/usr/java/下.
* # vi /etc/profile 添加
export JAVA_HOME=/usr/java/jdk1.6.0_27
export CLASS_PATH=.:%JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
* source /etc/profile 生效
tomcat
* 下載並解壓
#wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.22/bin/apache-tomcat-7.0.22.tar.gz
#tar zxvf apache-tomcat-7.0.22.tar.gz -C /usr/local/cellar/
#mv apache-tomcat-7.0.22 tomcat
* 啓動tomcat
/usr/local/cellar/tomcat/bin/startup.sh
* 關閉tomcat
/usr/local/cellar/tomcat/bin/shutdown.sh
* 下載並解壓
#wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-7/v7.0.22/bin/apache-tomcat-7.0.22.tar.gz
#tar zxvf apache-tomcat-7.0.22.tar.gz -C /usr/local/cellar/
#mv apache-tomcat-7.0.22 tomcat
* 啓動tomcat
/usr/local/cellar/tomcat/bin/startup.sh
* 關閉tomcat
/usr/local/cellar/tomcat/bin/shutdown.sh
memcached
* 下載並解壓
# wget http://memcached.googlecode.com/files/memcached-1.4.8.tar.gz
# tar zxvf memcached-1.4.8.tar.gz
# 編譯安裝 ./configure --pri;make;make install
* 啓動 11211 11212 兩個端口服務
/usr/local/cellar/memcached -d -u www -m 64 -l 127.0.0.1 -t 2 -p 11211-P /var/run/mem.pid
/usr/local/cellar/memcached -d -u www -m 64 -l 127.0.0.1 -t 2 -p 11212-P /var/run/mem.pid2
* 下載並解壓
# wget http://memcached.googlecode.com/files/memcached-1.4.8.tar.gz
# tar zxvf memcached-1.4.8.tar.gz
# 編譯安裝 ./configure --pri;make;make install
* 啓動 11211 11212 兩個端口服務
/usr/local/cellar/memcached -d -u www -m 64 -l 127.0.0.1 -t 2 -p 11211-P /var/run/mem.pid
/usr/local/cellar/memcached -d -u www -m 64 -l 127.0.0.1 -t 2 -p 11212-P /var/run/mem.pid2
activemq
* 下載並解壓
# wget http://labs.renren.com/apache-mirror//activemq/apache-activemq/5.5.0/apache-activemq-5.5.0-bin.tar.gz
# tar zxvf apache-activemq-5.5.0-bin.tar.gz -C /usr/local/cellar/
# mv apache-activemq-5.5.0 activemq
* 啓動activemq
# /usr/local/cellar/activemq/bin/linux-x86-64/activemq start
* 關閉activemq
# /usr/local/cellar/activemq/bin/linux-x86-64/activemq stop
* 下載並解壓
# wget http://labs.renren.com/apache-mirror//activemq/apache-activemq/5.5.0/apache-activemq-5.5.0-bin.tar.gz
# tar zxvf apache-activemq-5.5.0-bin.tar.gz -C /usr/local/cellar/
# mv apache-activemq-5.5.0 activemq
* 啓動activemq
# /usr/local/cellar/activemq/bin/linux-x86-64/activemq start
* 關閉activemq
# /usr/local/cellar/activemq/bin/linux-x86-64/activemq stop
>> 配置
項目代碼
/usr/deploy/testhall
|-doc
|-src
|-WebContent
nginx
* 配置文件添加
* 配置文件添加
upstream backserver{
ip_hash;
server 127.0.0.1:8080;
}
ip_hash;
server 127.0.0.1:8080;
}
server{
listen 80;
server_name hall.clmobi.net;
index /testhall/index.do; #設定訪問的默認首頁地址
root /usr/deploy/testhall/WebContent;
charset utf-8;
location ~ ^/testhall/static/(.*)$
{
alias /usr/deploy/testhall/WebContent/static/$1;
expires 1d;
break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
listen 80;
server_name hall.clmobi.net;
index /testhall/index.do; #設定訪問的默認首頁地址
root /usr/deploy/testhall/WebContent;
charset utf-8;
location ~ ^/testhall/static/(.*)$
{
alias /usr/deploy/testhall/WebContent/static/$1;
expires 1d;
break;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
location ~ /WEB-INF/ {
deny all;
break;
}
deny all;
break;
}
location ~ ^/testhall/
{
index index.do;
proxy_pass http://backserver; #轉向tomcat處理
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
break;
}
{
index index.do;
proxy_pass http://backserver; #轉向tomcat處理
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
break;
}
location /NginxStatus {
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file authen/htpasswd;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file authen/htpasswd;
}
location /resource {
root /usr/deploy/testhall/WebContent;
}
root /usr/deploy/testhall/WebContent;
}
location / {
root /usr/deploy/testhall;
index index.html index.htm;
}
root /usr/deploy/testhall;
index index.html index.htm;
}
location ~ /\.ht {
deny all;
}
}
deny all;
}
}
tomcat
# cd /usr/local/cellar/tomcat/webapps
# ln -s /usr/deploy/testhall/WebContent testhall
# cd /usr/local/cellar/tomcat/webapps
# ln -s /usr/deploy/testhall/WebContent testhall
# cd testhall
# mkdir -p /var/hall/node/resource
# ln -s /var/hall/node/resource
# mkdir -p /var/hall/node/resource
# ln -s /var/hall/node/resource