2014年7月29日 星期二

將Linux上寄給root的mail轉發到外部信件

# vim /etc/aliases

root:           root, LinuxAdm@cmchiu.com

# echo test | mail -s "test message" root

2014年7月28日 星期一

YUM rpmnew rpmsave

find /etc/ -print | egrep "rpmnew$|rpmsave$"

2014年7月25日 星期五

在CentOS 6上安裝PHP 5.4與MySQL 5.5

啟用SCL
參考文件

安裝MySQL 5.5
# yum install mysql55-mysql-server

安裝PHP 5.4
# yum install php54-php php54-php-mbstring php54-php-mysqlnd

2014年7月24日 星期四

CentOS 6 啟用 SCL Repositories

安裝
# yum install centos-release-SCL

設定Repository
# cd /etc/yum.repos.d
# vi ./CentOS-SCL.repo

# CentOS-SCL.repo
#
# The Software Collections  ( SCL ) repository contains rpms for newer
# software that can be installed alongside default versions
#
# Look at http://wiki.centos.org/AdditionalResources/Repositories/SCL
# for more details about how this repository works

[scl]
name=CentOS-$releasever - SCL
baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/SCL/$basearch/
gpgcheck=1
enabled=1

gpgkey=http://mirror01.idc.hinet.net/CentOS/RPM-GPG-KEY-CentOS-6

參考資料
可供 CentOS 使用的軟件庫
軟件選集(SCL)軟件庫

2014年7月21日 星期一

安裝Extra Packages for Enterprise Linux (EPEL)

Extra Packages for Enterprise Linux (EPEL)

Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Enterprise Linux(OEL).

EPEL packages are usually based on their Fedora counterparts and will never conflict with or replace packages in the base Enterprise Linux distributions. EPEL uses much of the same infrastructure as Fedora, including buildsystem, bugzilla instance, updates manager, mirror manager and more.

安裝
# yum install centos-release-scl
# rpm -ivh http://mirror01.idc.hinet.net/EPEL/6/x86_64/epel-release-6-8.noarch.rpm

設定Repository
# cd /etc/yum.repos.d
# vi ./epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirror01.idc.hinet.net/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirror01.idc.hinet.net/epel/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://mirror01.idc.hinet.net/epel/6/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=http://mirror01.idc.hinet.net/epel/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://mirror01.idc.hinet.net/epel/6/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=http://mirror01.idc.hinet.net/epel/RPM-GPG-KEY-EPEL-6
gpgcheck=1

設定YUM Repositories

YUM Repositories Mirror List
查詢Mirror List: http://mirrorlist.centos.org/?release=6.5&arch=x86_64&repo=os http://mirror01.idc.hinet.net/CentOS/6.5/os/x86_64/
http://ftp.tc.edu.tw/Linux/CentOS/6.5/os/x86_64/ http://ftp.stu.edu.tw/Linux/CentOS/6.5/os/x86_64/ http://ftp.stust.edu.tw/pub/Linux/CentOS/6.5/os/x86_64/ http://ftp.nsysu.edu.tw/CentOS/6.5/os/x86_64/ http://ftp.isu.edu.tw/pub/Linux/CentOS/6.5/os/x86_64/ http://ftp.twaren.net/Linux/CentOS/6.5/os/x86_64/ http://mirrors.skyshe.cn/centos/6.5/os/x86_64/ http://centos.ustc.edu.cn/centos/6.5/os/x86_64/ http://mirrors.hust.edu.cn/centos/6.5/os/x86_64/ 手動設定Repositories # cd /etc/yum.repos.d # cp ./CentOS-Base.repo ./CentOS-Base.repo.bak # vi ./CentOS-Base.repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$releasever - Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/os/$basearch/ gpgcheck=1 gpgkey=http://mirror01.idc.hinet.net/CentOS/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror01.idc.hinet.net/CentOS/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror01.idc.hinet.net/CentOS/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror01.idc.hinet.net/CentOS/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib baseurl=http://mirror01.idc.hinet.net/CentOS/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror01.idc.hinet.net/CentOS/RPM-GPG-KEY-CentOS-6

使用光碟或其他離線檔案安裝套件
# vi ./CentOS-Media.repo
# CentOS-Media.repo # # This repo can be used with mounted DVD media, verify the mount point for # CentOS-6. You can use this repo and yum to install items directly off the # DVD ISO that we release. # # To use this repo, put in your DVD and use it with the other repos too: # yum --enablerepo=c6-media [command] # # or for ONLY the media repo, do this: # # yum --disablerepo=\* --enablerepo=c6-media [command] [c6-media] name=CentOS-$releasever - Media baseurl=file:///media/CentOS/ file:///media/cdrom/ file:///media/cdrecorder/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

2014年7月17日 星期四

常用照片尺寸資訊 - 對應解析度

Size (in.)
Size (mm)
300ppi (pixels/in.)
Aspect Rratio
Note
4 × 6
102 × 152
1200 × 1800
3:2 (1.5)
1.5
135(35mm)FFAPS-C
4½ × 6
114 × 152
1350 × 1800
4:3 (1.33)
1.33
4/3 System & M43 System
5 × 7
127 × 178
1500 × 2100
7:5 (1.4)
1.4
 
6 × 8
152 × 203
1800 × 2400
4:3 (1.33)
1.33
 
8 × 10
203 × 254
2400 × 3000
5:4 (1.25)
1.25
 
8 × 12
203 × 305
2400 × 3600
3:2 (1.5)
1.5
Closest approximation to A4
10 × 12
254 × 305
3000 × 3600
6:5 (1.2)
1.2
 
10 × 15
254 × 381
3000 × 4500
3:2 (1.5)
1.5
 
11 × 14
279 × 356
3300 × 4200
14:11 (1.27)
1.27
 
11 × 17
279 × 432
3300 × 5100
17:11 (1.55)
1.55
 
12 × 15
305 × 381
3600 × 4500
5:4 (1.25)
1.25
 
12 × 18
305 × 457
3600 × 5400
3:2 (1.5)
1.5
 

在Blogger上格式化Source Code - SyntaxHighlighter

使用SyntaxHighlighter來達到這個功能

快速使用兩步驟

Step 1: 將下列的CSS與JavaScript貼到Blogger HTML內,<head> </head>的標籤內
<!-- BEGIN SyntaxHighlighter BEGIN -->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAppleScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAS3.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDelphi.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDiff.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushErlang.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushGroovy.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJavaFX.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPowerShell.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSass.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushScala.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script language='javascript' type='text/javascript'>
 SyntaxHighlighter.config.bloggerMode = true;
 SyntaxHighlighter.defaults['auto-links'] = false;
 SyntaxHighlighter.defaults['toolbar'] = false;
 SyntaxHighlighter.all();
</script>
<style type="text/css">
  .syntaxhighlighter { 
     overflow-y: hidden !important; 
     overflow-x: auto !important; 
  }
</style>
<!-- END SyntaxHighlighter END -->

Step 2: 透過<pre class="brush:html; first-line:1; highlight:[3,31]" title="SyntaxHighlighter"> </pre>來格式化,參設請參考Configuration
<pre class="brush:html; first-line:1; highlight:[3,31]" title="SyntaxHighlighter">

</pre>

進階說明
  • 上面是透過官方的免費空間來存取相關檔案,可到官方下載檔案後放到自己的空間,當然也可以使用在自行開發的網頁上
  • shThemeDefault.css是預設的格式,可以換成其他的顯示格式,例如:shThemeDefault.css, shThemeDjango.css, shThemeEclipse.css, shThemeEmacs.css, shThemeFadeToGrey.css, shThemeMDUltra.css, shThemeMidnight.css, shThemeRDark.css
  • shBrushXXX.js是相對應語言的格式,可以只挑要用的載入,目前有25種語言樣板
  • Bundled Brushes是指定要套用哪種語言的格式,可以透過aliases指定,例如:bash, shell, css、javascript、java、sql、html、xml
  • bloggerMode在Blogger上一定要設定為true
  • 如果是分享html,因為Blogger的限制所以需要將< >轉換為HTML Entitie: &lt; &gt;,可透過HTML Entities Encoder協助,平常網頁可以直接使用html-script:true