2011年5月4日 星期三

KVM的雲端技術

雲端系統正夯...


可惜國內好文不多


想了解雲端系統使用linux KVM的技術可以參考一下這個網站


http://linuxkvm.blogspot.com/


寫得很棒喔!



http://www.youtube.com/watch?v=9Du8HCNPK4U


另外我google到國外有一篇文章叫 Roll Your Own Cloud: Enterprise Virtualization with KVM, DRBD, iSCSI and Pacemaker


http://linuxconfau.blip.tv/file/4719948/


也是很棒的影片,分享給大家!




iPad插電腦USB充電問題

iPad 接一般PC電腦USB由於電壓不夠的關係,會顯示"沒有在充電"


但如果接蘋果電腦就OK


有些主機板廠商也推出了修正程式 , 安裝之後很神奇地就會跟你說有在充電


google一下就有載點了


 


雖然他跟你提示說沒有在充電


但實際上就算他顯示沒有在充電, 但還是有在充電喔...


使用iPad附的變壓器 , 官方說是衝兩個小時充飽


我用電腦的USB充六小時的結果是....................30% XDDDDD


 


結論就是.....還是乖乖的使用變壓器充電吧....囧


2011年4月30日 星期六

更改 Ubuntu 預設語系

1. # vim /var/lib/locales/supported.d/locale


 


zh_TW UTF-8
en_US.UTF-8 UTF-8


2. # locale-gen


 


Generating locales...
  en_US.UTF-8... up-to-date
  zh_TW.UTF-8... done
Generation complete.


 


 


ubuntu JDBC 設定

1. apt-get install  libmysql-java


2. 環境變數 CLASSPATH 新增 /usr/share/java/mysql-connector-java.jar


3. 寫個code測試


import java.sql.Connection;
import java.sql.DriverManager;

class JDBCTest {

private static final String url = "jdbc:mysql://localhost";

private static final String user = "username";

private static final String password = "password";

public static void main(String args[]) {
try {
Connection con = DriverManager.getConnection(url, user, password);
System.out.println("Success");

} catch (Exception e) {
e.printStackTrace();
}
}
}

2011年4月29日 星期五

ubuntu 11.04 有關 JAVA 的相關設定

1. 新增軟體源


vim /etc/apt/sources.list


#deb cdrom:[Ubuntu 11.04 _Natty Narwhal_ - Release i386 (20110427.1)]/ natty main restricted




# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to


# newer versions of the distribution.


deb http://ubuntu.stu.edu.tw/ubuntu/ natty main restricted


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty main restricted




## Major bug fix updates produced after the final release of the


## distribution.


deb http://ubuntu.stu.edu.tw/ubuntu/ natty-updates main restricted


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-updates main restricted




## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu


## team. Also, please note that software in universe WILL NOT receive any


## review or updates from the Ubuntu security team.


deb http://ubuntu.stu.edu.tw/ubuntu/ natty universe


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty universe


deb http://ubuntu.stu.edu.tw/ubuntu/ natty-updates universe


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-updates universe




## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu


## team, and may not be under a free licence. Please satisfy yourself as to


## your rights to use the software. Also, please note that software in


## multiverse WILL NOT receive any review or updates from the Ubuntu


## security team.


deb http://ubuntu.stu.edu.tw/ubuntu/ natty multiverse


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty multiverse


deb http://ubuntu.stu.edu.tw/ubuntu/ natty-updates multiverse


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-updates multiverse




## Uncomment the following two lines to add software from the 'backports'


## repository.


## N.B. software from this repository may not have been tested as


## extensively as that contained in the main release, although it includes


## newer versions of some applications which may provide useful features.


## Also, please note that software in backports WILL NOT receive any review


## or updates from the Ubuntu security team.


# deb http://ubuntu.stu.edu.tw/ubuntu/ natty-backports main restricted universe multiverse


# deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-backports main restricted universe multiverse




deb http://ubuntu.stu.edu.tw/ubuntu/ natty-security main restricted


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-security main restricted


deb http://ubuntu.stu.edu.tw/ubuntu/ natty-security universe


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-security universe


deb http://ubuntu.stu.edu.tw/ubuntu/ natty-security multiverse


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty-security multiverse




## Uncomment the following two lines to add software from Canonical's


## 'partner' repository.


## This software is not part of Ubuntu, but is offered by Canonical and the


## respective vendors as a service to Ubuntu users.


# deb http://archive.canonical.com/ubuntu natty partner


# deb-src http://archive.canonical.com/ubuntu natty partner




## This software is not part of Ubuntu, but is offered by third-party


## developers who want to ship their latest software.


deb http://ubuntu.stu.edu.tw/ubuntu/ natty main


deb-src http://ubuntu.stu.edu.tw/ubuntu/ natty main


 


apt-get update


 


2. 安裝JDK , JRE


apt-get install sun-java-jre


jdk : wget jdk.1.6 


安裝 : sh ./jdk1.6


cp-r jdk1.6 /opt/jdk1.6


 


3. 安裝tomcat 6


wget http://apache.cs.pu.edu.tw/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz


tar -zxvf apache-tomcat-6.0.32.tar.gz


http://apache.cs.pu.edu.tw/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-


 


4. 環境變數設定


vim ~/.bashrc


JAVA_HOME=/opt/jdk1.6
export JRE_HOME=/usr/lib/jvm/java-6-sun-1.6.0.24/jre
export TOMCAT_HOME=/opt/apache-tomcat-6.0.32
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export M2_HOME=/opt/apache-maven-2.2.1
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$TOMCAT_HOME/bin:$M2_HOME/bin:$PATH


5. 安裝 subversion


apt-get install subversion


svn
checkout svn://140.115.11.133/ncucc --username tyrc




 


2011年4月28日 星期四

CentOS 5.6 安裝 tomcat6

cd /etc/yum.repos.d
wget 'http://www.jpackage.org/jpackage50.repo'
yum update

yum install yum-utils

yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
service tomcat6 start

 


yum install yum-utils


 


cd /opt


wget http://ftp.twaren.net/Unix/Web/apache//maven/source/apache-maven-2.2.1-src.tar.gz


tar -zxvf apache-maven-2.2.1-src.tar.gz


 



vim /etc/profile



JAVA_HOME=/usr/java/jdk1.6.0_25
JRE_HOME=$JAVA_HOME/jre
CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
M2_HOME=/opt/apache-maven-2.2.1


export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CLASSPATH JRE_HOME M2_HOME


 


 


2011年4月25日 星期一

CentOS 5.6 使用rsyslog接收外部設備的連線LOG

使用OS : CentOS 5.6


安裝套件 : rsyslog


前置作業 : 以 Juniper NetScreen-ISG 2000 為例子


登入到isg2000 > Configuration > Report Settings > Syslog 


設定好接收機器的相關設定


 


1. 安裝 rsyslog


# yum install rsyslog

 


2. 修改設定檔


# vim /etc/rsyslog.conf

$ModLoad imudp.so
$UDPServerRun 514
:fromhost-ip,isequal,"isg200 IP" /var/log/isg2000/isg_log

 


3. 關閉預設syslogd 並啟用 rsyslog


# chkconfig syslogd off
# chkconfig rsyslog on

# service syslog stop
# service rsyslog start

 


4. 設定輪替檔


# vim /etc/logrotate.conf

/var/log/isg2000/isg_log{
        daily
        create
        rotate 360
        compress
        postrotate
        /etc/init.d/rsyslog reload
        endscript
}

如何在 golang 裡面引用 gitlab private repo

參考文章:https://stackoverflow.com/questions/27500861/whats-the-proper-way-to-go-get-a-private-repository 原文是用 gitlab.company.com 當範例,這邊改成一般帳號...