顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2012年2月22日 星期三

[Linux] VIM color(VIM顏色)

安裝

  • 先建立目錄

    mkdir ~/.vim/colors/
    
  • 將下載好的COLOR_SCHEME.vim檔放入colors目錄中
  • 編輯 ~/.vimrc
  • 加入以下程式碼

    colorscheme COLOR_SCHEME #(scheme的檔案名稱)
    
  • 設定支援256色環境

    set t_Co=256
    

2012年2月19日 星期日

[Linux] Nginx

需求環境

  • Install Indeed Repository

    ## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
    ## EPEL Repository
    rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    
    ## Remi Repository
    ## CentOS 6 and Red Hat (RHEL) 6 ##
    rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    
  • Add Nginx Repository

    Cent OS

    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1
    

安裝

  • Install Client Package

    yum --enablerepo=remi install nginx php php-fpm php-common
    
  • 啟動Nginx

    ※需停止Apache(httpd)服務

    /etc/init.d/nginx start
    

Nginx設定

  • 設定開機啟動Nginx

    #關閉httpd開機啟動
    chkconfig httpd off
    
    #設定Nginx開機啟動
    chkconfig --add nginx
    chkconfig --levels 235 nginx on
    

防火牆設定

  • 編輯iptables設定檔

    vim /etc/sysconfig/iptables
    
  • 加入規則

  • -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    
  • 重啟iptables

     /etc/init.d/iptables restart
    
http://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/

日後再來整理文章

[Linux] Mongo DB

安裝

  • Add Repository<新增MongoDB資料源>

    vim /etc/yum.repos.d/10gen-mongodb.repo
    
  • 加入以下程式碼

    [10gen]
    name=10gen Repository
    baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
    gpgcheck=0
    

      可依個人系統需求調整路徑

    • Mongodb-repo for Fedora 16/15/14/13/12/11
    • CentOS 6/5.7 and Red Hat (RHEL) 6.1/6/5.7 on x86_64 (64-bit)
  • 將Repository設定好後,就可以直接使用yum安裝Mongo DB了。

    yum install mongo-10gen mongo-10gen-server
    

設定

  • Edit /etc/mongod.conf file

    vim /etc/mongdb.conf
    
  • 確認路徑及調整個人設定

    logpath=/var/log/mongo/mongod.log
    port=27017
    dbpath=/var/lib/mongo
    
  • 啟動Mongo DB

    /etc/init.d/mongod start
    
  • 設定開機啟動Mongo DB

    chkconfig --levels 235 mongod on
    

防火牆

  • iptables 設定條件開放

    vim /etc/sysconfig/iptables
    
    #加入以下程式碼
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT
    
  • iptables 重啟

    iptables restart
    

[Linux] git

安裝流程

Centos 安裝

由於yum本身就有這類的套件可以直接安裝,所以直接使用yum安裝即可。

yum -y install git

設定

基本設定

git config --global user.name "Ciao Chiang"
git config --golbal user.email "ciao@test.com"

顏色設定

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git config --global color.log auto
  • color.diff: git diff 顯示顏色。
  • color.status: git status 顯示顏色。 <綠色或紅色>
  • color.branch: git branch 顯示顏色。
  • color.log: git log --graph 顯示顏色。

分享設定

將以建立的Repository對群組分享

git config core.sharedRepository group

或者是建立Repository時可以輸入這樣:

git init --shared=group

[Linux] EPEL Repository Install

下載最新EPEL安裝軟體

CentOS 6 安裝EPEL

wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm

CentOS 5.X 安裝EPEL

wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

執行安裝

rpm -Uvh epel-release-6-5.noarch.rpm

如果有需要其他版本可以到fedora EPEL下載.

2012年1月7日 星期六

[Linux] tmux

安裝

  • 安裝需求

    需先安裝EPEL套件-請參考這篇EPEL Repository Install
  • 安裝方式

    執行程式碼
    yum -y install tmux
    

分享畫面(share view)

  • 當使用同一帳號登入,且tmux attach畫面時,畫面就會共享。

2012年1月6日 星期五

[Linux] VIM Indent(VIM縮排)

安裝流程

  • 下載 "html(indent).vim"
  • 在.vim目錄下建立資料夾 " ~/.vim/indent"
  • 將"html.vim"放進indent資料夾
  • 編輯 "~/.vimrc" 檔案
  • 新增 "filetype indent on" 這行程式碼就可以了!!