Archive

文章標籤 ‘Linux’

Shell script輸出有顏色的文字

2011年7月22日 Austin 尚無評論
# Color defination
txtRed=$(tput setaf 1)
txtGreen=$(tput setaf 2)
txtYellow=$(tput setaf 3)
txtBlue=$(tput setaf 4)
txtPurple=$(tput setaf 5)
txtCyan=$(tput setaf 6)
txtWhite=$(tput setaf 7)
txtReset=$(tput sgr0)

# Style defination
txtBold=$(tput bold)
txtUL=$(tput smul)

# Example
echo "${txtRed}Red text"
echo "still Red text"

echo "$txtReset"
echo "Normal text"

Reference: How to echo colored text in linux shell script

Categories: Linux, 未分類 Tags: , , , ,

Install Intel C++ Compiler on Ubuntu 9.10(64bit)

2010年3月15日 Austin 尚無評論

安裝相關套件:

# 必要套件
sudo apt-get install gcc build-essential g++ rpm

# this is only required on 64bit Ubuntu/Debian systems
sudo apt-get install ia32-libs

# For use the Intel IDB graphical debugger
sudo apt-get install openjdk-6-jre-headless

Ubuntu 9.10後改用libstdc++6,而Install Intel C++ Compiler需要libstdc++5,所以要另外安裝。先到http://packages.debian.org/stable/base/libstdc++5下載adm64的版本用dpkg安裝,再下載i386解開,並取出函式庫

# 下載並adm64的版本
wget http://debian.linux.org.tw/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_amd64.deb
sudo dpkg -i libstdc++5_3.3.6-18_amd64.deb

# 下載i386並解開
wget http://debian.linux.org.tw/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_i386.deb
dpkg --extract libstdc++5_3.3.6-18_i386.deb ./

# 出函式庫
cd usr/lib
sudo cp libstdc++.so.5.0.7 /usr/lib32
cd /usr/lib32
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

然後就可進入Install Intel C++ Compiler的安裝了,裝完之後把下面指令加入到.bashrc即可直接使用icc

source /opt/intel/Compiler/11.1/069/bin/iccvars.sh intel64

 

參考資料:Using Intel Compilers for Linux with Ubuntu

Categories: C/C++, Linux Tags: , , , ,

vsftp Virtual User對MySQL認證 – 建立使用者

2009年4月14日 Austin 尚無評論

假設現在要建立一個使用者帳號test密碼testpss
並將登入後的根目錄指定到/xxx/abc

vsftp的帳號是存在vsftp這個資料庫內的users這個table
帳號的欄位是username,密碼是password
user_config_dir=/etc/vsftpd/vsftpd_user_conf/

Step 1. 建立帳號
進入資料庫執行下列語法

閱讀全文…

Categories: Linux, MySQL, 未分類 Tags: , , ,

X Client by putty + Xming

2009年3月24日 Austin 尚無評論

Xming:官方網站
Public Domain Releases:Xming 6.9.0.31Xming-fonts 7.4.0.3
Website Releases:Xming 7.4.0.3(See Donations for how to obtain a donor password)

Step 1. 下載及安裝
基本上裝Xming就可以跑了,不過最好還是要裝Xming-fonts比較不會有些字出不來

Step 2. 啟動XLaunch
開始 => 程式集 => Xming => XLaunch
然後一直下一步就對了

閱讀全文…

Categories: Linux, 未分類 Tags: , , , ,

快速建置Ubuntu Desktop(with Lazybuntu)

2009年1月9日 Austin 尚無評論

Lazybuntu 懶人包
先去下載最新版本,抓回來解開執行就對了
我只多勾了 網路應用=>IE4Linux
其他的視情況而定,不過預設選項就差不多ok了
選完之後按下套用就會自動開始安裝了
過程會有跳出幾個視窗會問是否套用到全部使用者等等…
還有java的license要按個OK
其他的就是等他跑囉!

上面跑完會出現 Lazybuntu 安裝完畢的藍色字樣
接著執行我自己的Ubuntu Installation

wget http://blog.gclin.org/wp-content/uploads/2008/11/ubuntu_installation_v02.tgz
tar -zxf ubuntu_installation_v02.tgz
sudo ./ubuntu_installation_v0.2/install.sh
# 等跑完記得看一下setting.txt檢查是否有要改的設定

Joomla安裝後要開放權限的目錄

2008年12月9日 Austin 尚無評論

最簡單的方式是從FTP直接把檔案屬性設成777
不過比較好的方式:
Linux是把Group指給web server再把group加上寫入的權限
Windows是在目錄安全性增加IUSER_xxxxxxx(IIS)這個使用者,並給完全控制

要改權限的目錄列表:

administrator/backups/
administrator/cache/
administrator/components/
administrator/language/
administrator/modules/
administrator/templates/
cache/
components/
images/
language/
media/
modules/
plugins/
tmp/
templates/

Categories: Joomla, Linux, 未分類 Tags: ,

在Ubuntu上安裝AWStats

2008年11月14日 Austin 尚無評論

What is AWStats
AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.

閱讀全文…

Ubuntu Installation v0.2

2008年11月7日 Austin 尚無評論

ubuntu_installation_v0.2

wget http://blog.gclin.org/wp-content/uploads/2008/11/ubuntu_installation_v02.tgz
tar -zxf ubuntu_installation_v02.tgz
sudo ./ubuntu_installation_v0.2/install.sh

閱讀全文…

Ubuntu Installation

2008年10月23日 Austin 尚無評論

先放上來改天再整理
ubuntu_installation_v01

sudo apt-get install unzip wget
wget http://blog.gclin.org/wp-content/uploads/2008/10/ubuntu_installation_v01.zip
unzip ubuntu_installation_v01.zip
chmod a+x ubuntu_installation_v0.1/install.sh
sudo ./ubuntu_installation_v0.1/install.sh
# 接下來呢~基本上一路yes就可以了
# 印象中好像會要設定MySQL密碼跟postfix
# 等install.sh跑完,再照著setting.txt去設定

閱讀全文…

在Ubuntu上設定vsftp Virtual User對MySQL認證

2008年10月20日 Austin 尚無評論

安裝相關套件及建立guest帳號

sudo apt-get install vsftpd mysql-server-5.0 libpam-mysql
sudo useradd web_edit
[/shell]
先建立vsftpd這個資料庫,然後建立users這個資料表
[sql]CREATE TABLE `users` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `username` VARCHAR( 30 ) NOT NULL ,
    `password` VARCHAR( 50 ) NOT NULL ,
    UNIQUE (`username`)
) ENGINE = MYISAM ;

INSERT INTO `users` (`username` ,`password`) VALUES ('user', PASSWORD('pass'));
[/sql]
修改/etc/pam.d/vsftpd
<!--more-->
[bash]sudo vi /etc/pam.d/vsftpd

# 原先的設定全註解掉
auth required pam_mysql.so user=vsftpd passwd=bWrRDD host=localhost db=vsftpd table=users usercolumn=username passwdcolumn=password crypt=2
account required pam_mysql.so user=vsftpd passwd=bWrRDD host=localhost db=vsftpd table=users usercolumn=username passwdcolumn=password crypt=2

修改/etc/vsftpd.conf

sudo vi /etc/vsftpd.conf

guest_enable=YES
write_enable=YES
guest_username=web_edit
local_root=/home/ftp_users/$USER
user_sub_token=$USER
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd_user_conf

sudo /etc/init.d/vsftpd restart