Category Archives: OS

vimrc 常用設定值

” ts => 1個tab佔幾個空格 set ts=2 ” sw => 每層縮進的空格數 set sw=2 ” 註解顏色 hi Comment ctermfg =blue ” 字串顏色 hi String ctermfg =darkred ” 類型顏色 hi Type ctermfg =yellow ” 數字顏色 hi Number ctermfg =darkblue ” 常數顏色 hi Constant … Continue reading

Posted in Linux, Vim | Leave a comment

Git Server 安裝 (New)

OS: Ubuntu 14.04 Server x64 安裝Gitlab + MySQL + Nginx 系統更新 apt-get update apt-get upgrade -y apt-get dist-upgrade 安裝基本需求 # 記得要先裝vim update-alternatives –set editor /usr/bin/vim.basic sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server … Continue reading

Posted in Git, Nginx, Ubuntu | Leave a comment

更換 apt-get 來源

root@ubuntu:~# vim /etc/apt/sources.list :%s/us.archive.ubuntu.com/tw.archive.ubuntu.com/g 或是 root@ubuntu:~# sed -i ‘s/us.archive.ubuntu.com/tw.archive.ubuntu.com/g’ /etc/sources.list 記得要在apt-get update一下.. 基本上國網 free.nchc.org 應該也可以 但是不知道為什麼一直出錯 如果想要用國網的點,就把tw.archive.ubuntu.com改成free.nchc.org

Posted in Ubuntu | Leave a comment

Nginx SSL Enable

環境: Ubuntu 14.04 x64 產生key root@Wordpress:/tmp# openssl genrsa -des3 -out site.key 2048 Generating RSA private key, 2048 bit long modulus ……………………..+++ ………………………………+++ e is 65537 (0x10001) Enter pass phrase for site.key: Verifying – Enter pass phrase for site.key: 2.產生 csr … Continue reading

Posted in Nginx, SSL, Ubuntu | Leave a comment

Apache SSL Enable

環境 CentOS 5.x i386 產生 key [root@Web test]# openssl genrsa -des3 -out site.key 2048 Generating RSA private key, 2048 bit long modulus …………+++ ………………+++ e is 65537 (0x10001) Enter pass phrase for site.key: Verifying – Enter pass phrase for site.key: … Continue reading

Posted in Apache, CentOS, SSL | Leave a comment

Splunk : 計算log檔案在Splunk所佔的大小

計算檔案空間 Splunk 語法: source=”/home/splunk_input_data/imss/2014/log.imss.20141019.0002″ | eval esize=len(_raw) | stats sum(esize) AS sum_esize, count | eval fsize=sum_esize + count | fields fsize Linux指令: grep -v -e “^s*$” /home/splunk_input_data/imss/2014/log.imss.20141019.0002 | wc -c 計算筆數 Splunk 語法: source=”/home/splunk_input_data/imss/2014/log.imss.20141019.0002″ | stats sum(linecount) Linux指令: grep -v … Continue reading

Posted in Linux, Splunk | Leave a comment

Shell Script 計算字元

cowman@ubuntu:~$ string=”0123 56 89″; echo “length: ${#strstring ing}” length: 10

Posted in Linux, Shell Script | Leave a comment

使用GMail SMTP寄信 – ssmtp (CentOS)

yum install ssmtp vim /etc/ssmtp/ssmtp.conf root=username@gmail.com mailhub=smtp.gmail.com:587 RewriteDomain= Hostname=username@gmail.com UseSTARTTLS=yes AuthUser=username@gmail.com AuthPass=password FromLineOverride=YES TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt alternatives –config mta 選擇 /usr/sbin/sendmail.ssmtp 檢查目前sendmail方式 sendmail -V sSMTP 2.61 (Not sendmail at all) 測試 echo “This is a test” | mail -s “Test” cowman.chiang@gmail.com Reference … Continue reading

Posted in CentOS | Leave a comment

使用GMail SMTP寄信 – command (CentOS)

近來發現diary log幾乎都收不到了 測試了一下, 發現連手動執行script都失敗 所以想一下就改用GMail SMTP應該比較保險 Reference: 在 Linux 上直接用 Gmail SMTP 寄信 yum install mailx vim ~/.mailrc account gmail { set smtp-use-starttls set smtp=smtp://smtp.gmail.com:587 set smtp-auth=login set smtp-auth-user=username@gmail.com set smtp-auth-password=password set from=”username@gmail.com” set ssl-verify=ignore set nss-config-dir=/root/.pki/nssdb set nss-config-dir=/etc/pki/nssdb } … Continue reading

Posted in CentOS | Leave a comment

Gitlab改使用GMail SMTP

檢查 config/environments/production.rb 檔案,查看 config.action_mailer.delivery_method = :sendmail 的註解是否已增加,關閉Gitlab sendmail寄送服務 config.action_mailer.delivery_method = :sendmail [註] 使用這一篇 使用GMail SMTP寄信 (Ubuntu) 的方法應該也可以~但是目前會出現 “Mail failure – no recipient addresses” A message that you sent using the -t command line option contained no addresses that were not … Continue reading

Posted in Git, Ubuntu | Leave a comment