2014年6月11日 星期三

CentOS 文字模式安裝

參考來源:
http://www.cmarket.tw/yjhwang/linux?n=convew&i=4363
http://blog.xuite.net/itwiz/learning/58011669

【文字模式安裝CentOS 6.5】
在CentOS的開安歡迎畫面選擇Install or upgrade an existing後,按TAB鍵在選單下方會出現
vmlinuz initrd=initrd.img
在字串後方加上 linux text按enter開始,簡單的選擇語系、鍵盤、時區、root密碼後就一路自動跑下到結束。

在安裝CentOS 6.5 之後,輸入 setup 出現
 setup: command not found

解決方式如下:
yum –y install setuptool

另外還可安裝其它管理工具,所有清單可以參考http://mirror.centos.org/centos/6/os/i386/Packages/

先安裝一些常用的部份
yum –y install system-config-firewall-tui
yum –y install system-config-network-tui
yum –y install system-config-securitylevel-tui
yum –y install ntsysv

※在CentOS 6.6版,firewall的選單卻無法執行,會出現錯誤訊息
# system-config-firewall-tui 
Traceback (most recent call last):
  File "/usr/bin/system-config-firewall-tui", line 29, in <module>
    import fw_tui
  File "/usr/share/system-config-firewall/fw_tui.py", line 34, in <module>
    import fw_nm
ImportError: No module named fw_nm

這裏有說明Bug 1123919,解決的方法就是另外安裝dbus 和 dbus-python 兩個套件,然後shutdown -r now,重新登入後就解決了。

安裝uWSGI配合Nginx Server

【安裝uwsgi】

參考:http://www.openfoundry.org/tw/tech-column/8536-introduction-of-python-extension-management-tools

先安裝 pip 套件管理程式
easy_install pip

參考:https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/
安裝gcc
yum install gcc

安裝
yum install python-devel

安裝目前stable版的uwsgi
pip install uwsgi

參考文章:http://django-china.cn/topic/101/

測試安裝結果

測試一:直接執行uwsgi命令,不加任何參數
uwsgi

測試二:
新增測試檔案
cd /home/john/www/test.py

# test.py
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return "Hello World"

執行uwsgi伺服器
uwsgi --http :8001 --wsgi-file test.py

用瀏覽器開啟網頁
http://127.0.0.1:8001

成功的話,應該會出現
Hello World

2014年6月10日 星期二

CentOS安裝Django

參考文章:http://itekblog.com/django-centos-6-4/

因為安裝CentOS65時,使用Desktop方式安裝,所以系統中已經有python 2.6.6了
所以接著先安裝EPEL repositories

wget http://mirrors.nl.eu.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
rm epel-release-6-8.noarch.rpm -f

※另法
也可以先用wget下載,安裝https://pypi.python.org/pypi/distribute 套件。

安裝Django
yum install python-setuptools
easy_install django

或者改用pip方式裝,可指定安裝的版本
pip install Django==1.6.5

測試Django

import django
print django.get_version()

測試開發Django網站
cd ~
django-admin.py startproject testdjangosite
cd testdjangosite
python manage.py runserver

用瀏覽器開啟 http://127.0.0.1:8000/


2014年6月9日 星期一

在CentOS 6 上安裝nginx server

■資料來源:
http://wiki.nginx.org/Install
http://nginx.org/en/linux_packages.html

■新增nginx yum repository,
新增檔案/etc/yum.repos.d/nginx.repo,內容如下:

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

記得確定版本
或
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

■更新套件庫
yum update

■安裝 Nginx Web Server
yum install nginx

■執行 Nginx Web Server
service nginx start
Starting nginx:                                            [  OK  ]

■瀏覽一下


■設定開機預設啟動 Nginx 和關閉 Apache Web Server
chkconfig --level 3 nginx on
chkconfig --level 3 httpd off

■順便安裝webmin的管理模組
http://www.webmin.com/cgi-bin/search_third.cgi?search=nginx
登入webmin後,直接以網址方式安裝模組即可。



另一篇也不錯
http://www.cyberciti.biz/faq/install-nginx-centos-rhel-6-server-rpm-using-yum-command/

2012年10月17日 星期三

vmdk轉vdi

直接利用VirtualBox附的VBoxManage就可以轉換虛擬硬碟的格式。 指令:
VBoxManage clonehd source.vmdk target.vdi --format VDI
--format是指target的格式

2012年2月20日 星期一

網執執行scratch專案

參考來源

準備檔案
1. http://scratch.mit.edu/static/misc/ScratchApplet.jar
2. http://scratch.mit.edu/static/misc/soundbank.gm

html語法



屬性 project的值可以使用utf-8中文字

2011年11月20日 星期日

真是難搞的!

為了雲端比賽,不得不開始學習使用Flex和JAVA。但不是很熟Flex又得使用GooogleMap,還真令人倍感挫折!手邊的書籍都是javascript版本得資料,flex的資料只能從網路上取得。這二天試了試,終於試出來了。原來在lib的部份,不能把google map for flash sdk中的二個SWC都匯進來,只能選其中flex的版本吧!雖然最後試出來的心情很爽,但是早上試不出來時,真是歸爛趴火…

2011年10月13日 星期四

程式語言排名

TIOBE Programming Community Index for October 2011

使用JAVA的是17.913第一名,第二名是C佔17.707,二者只差0.206。有人說java雖然發表了JAVA8的藍圖,仍舊持續失去版圖。其實,也還好啦~工具的重點在能不能賺錢,也不是說新的東西就一定比較好用、棒!倒是php在第四名,心裏還滿爽的。而python也沒衝到多高,可見得叫好的未必叫座就是了!

另外,年度得獎的語言,看起來是大家輪流坐!

2011年10月8日 星期六

Google Cloud SQL推出了~

原文網址: 協助中小企業 Google 推雲端資料庫服務Google Cloud | 3C新聞 | NOWnews 今日新聞網http://www.nownews.com/2011/10/07/339-2747785.htm#ixzz1aBTwBkKT

●不需要管理及維護 - Google 幫你搞定這部份的工作
●高可靠性及可用性 - 資料在雲端主機間複製、同步,當硬體發生問題時會自動調整,讓其對使用者造成的影響降到最低
●開發者熟悉的 MySQL 資料庫環 - 支援 JDBC(Java) 和 DB-API(Python)
●提供完整的使用者介面來管理資料庫
●與 Google 應用服務引擎間有良好的整合

Google Cloud SQL 具備資料匯出匯入功能,以便開發人員將 MySQL 資料庫轉移至雲端。


哇~又有個新東東推出了,而且還有工具可以將MySQL的資料轉移,真的得找個時間研究一下了!

2011年9月29日 星期四

產生結構化程式的規則!

過去學寫程式多從工具的角度出發,儘快學習用法、儘早生出東東來…一些學理的部份也不是那麼計較。不過,既然要重新學個新的語言,它又是JAVA,那麼就照教科書認真學習。

「產生結構化程式的規則」→哇!從來沒注意到有這回事…
一、以最簡單的活動圖開始。
二、任何的動作狀都可以用兩個循序的動作狀態加以取代。
三、任何的動作狀態都可以用任何的控制敘述式加以取代。
四、視需求以任意次數和順序使用規則二、規則三。

2011年9月28日 星期三

eclipse file editor找不到source file

使用eclipse開發java程式時,有個好用的功能就是將滑鼠游標停留類別字串上時,會跳出那個類別的說明內容,如果按Ctrl+滑鼠左鍵的話,則會出現那個類別的原始碼。可是…第一次用的時候,eclipse卻告訴我
Class File Editor
Source not found
找了一下,原來是eclipse設定中source的目錄是C:\Program Files\Java\jre7\lib\rt.jar,目錄中不包含原始檔,只要把它改成C:\Program Files\Java\jdk1.7.0\src.zip就好囉~

2011年9月26日 星期一

好用又免費的UML工具軟體

最近因為開始學習JAVA,教科書裏經常提到UML,所以不得不開始重視起UML。雖然以前曾少量的學習過一些,但是因為沒有個比較順手而且免費的工具,所以也就馬馬虎虎的學習。本想找一個eclipse的外掛,將工具都整合在一起,而且它絕對必要的功能就是要能自動產生JAVA語法。稍微爬了一下文,好像不容易找到這樣的工具。倒是找到一個應該是個人、學校使用免費的獨立軟體叫SoftIdeasModeler。畫面如下:
真是太棒了~

不過,中文的相容性好像還有問題,比如工具/產生文件/pdf的文件中,就沒法兒正常顯示,在rtf中則沒問題。

2011年7月25日 星期一

個人覺得少女時代裏身材最好、臉蛋最端正的應該算是YURI了吧!原來不是只有自己這麼認為,YURI真的被評為NO.1的○也!

可惜的是,感覺上她好像不是很有自信,不夠愛現,這樣的個性在九人團體中或許就不是那麼的出色吧!而且最近好像也瘦得有點誇張,看起來實在不夠健康的樣子。還是比較喜歡她有點肉、有點黑的那種健康美,做出自己的特色就不怕沒人喜歡。像孝淵在歐洲巡迴的時候,可是比其它團員還要受歡迎哵~

2011年7月18日 星期一

使用TortoiseSVN

寫程式的過程式,其中有個最大的工作就是版本的維護,靠手動複製備份實在不是個好方法。愈大的專案就愈需要靠版本控制軟體來處理,先認識一下啥是版本控制。

要$買的當然是有,不過當然先找不花錢的試試!
因為目前多在仍在MSWin環境下作業,所以還是先找有支援WIN平台的。既然WIKI裏提到的軟體第一個先提到TortoiseSVN,那就先試試看好了!

官方下載網頁、安裝沒啥特別的,就一直按下一步。

主要的使用方法是參考這篇,因為目前下載的版本是 1.6.16,所以畫面有些差異,用起來倒是沒多大的差別。

2011年7月6日 星期三

在CentOS上安裝lighttpd

一直以來慣用的web伺服器都是apache,功能是很強,但是在學校裏,實際能用到的功能也不多啦!所以就換個精簡一點的來用用。因為在一些嵌入式的設備中看到滿多廠商使用的是lighttpd這個套件,所以就來試試。

它的功能也不算差啦!最重要的,它至少要支援php,要不就沒戲唱了!

不過很不幸的,CentOS並未將它包含在內,如果要安裝的話,就得下載原始碼自行編譯。「編譯」!?再說吧!先找rpm套件吧!

還好有個套件叫RPMforge,它將一些好用的東東整理成軟件庫,方便使用者可以直接用yum安裝一些套件。先到http://packages.sw.be/網上去找找。
一、先安裝維護者的金鑰
二、下載
三、驗證檔案
四、安裝


[root@centos5 ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
[root@centos5 ~]# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
[root@centos5 ~]# rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpmforge-release-0.5.2-2.el5.rf.i386.rpm: (sha1) dsa sha1 md5 gpg OK
[root@centos5 ~]# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
Preparing... ########################################### [100%]
1:rpmforge-release ########################################### [100%]


接著就來安裝lighttpd

[root@centos5 ~]# yum install lighttpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* extras: ftp.tc.edu.tw
* rpmforge: fr2.rpmfind.net
* updates: ftp.tc.edu.tw
Setting up Install Process
Resolving Dependencies
--< Running transaction check
---< Package lighttpd.i386 0:1.4.28-2.el5.rf set to be updated
--< Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
lighttpd i386 1.4.28-2.el5.rf rpmforge 1.1 M

Transaction Summary
=============================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 1.1 M
Is this ok [y/N]:
Downloading Packages:
lighttpd-1.4.28-2.el5.rf.i386.rpm | 1.1 MB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : lighttpd 1/1

Installed:
lighttpd.i386 0:1.4.28-2.el5.rf

Complete!

修改一下權限

[root@centos5 ~]# mkdir -p /var/run/lighttpd/
[root@centos5 ~]# chown lighttpd /var/run/lighttpd

檢查tcp 80是不是被佔住

[root@centos5 ~]# netstat -an |grep :80

檢查組態檔語法是否正確

[root@centos5 ~]# lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK

就給它啟動吧!沒想到發生下面的錯誤,起不來…

[root@centos5 lighttpd]# service lighttpd start
Starting lighttpd: 2011-07-06 16:03:23: (server.c.722) couldn't set 'max filedescriptors' Operation not permitted
[FAILED]


原因是和SELinue的policy衝突了,要修改一下。

[root@centos5 lighttpd]# /usr/sbin/semodule -DB
[root@centos5 lighttpd]# service auditd restart
[root@centos5 lighttpd]# grep lighttpd /var/log/audit/audit.log | audit2allow -M lighttpdmaxfds2
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i lighttpdmaxfds2.pp
[root@centos5 lighttpd]# semodule -i lighttpdmaxfds2.pp
[root@centos5 lighttpd]# service lighttpd restart
Stopping lighttpd: [FAILED]
Starting lighttpd: [ OK ]

不過CentOS預設有啟動iptables,所以tcp 80是不被放行的,另外預設的根目錄裏/srv/www裏沒檔案,所以得自行建個檔案,要不然從瀏覽器中一直會顯示404的錯誤喔!


參考文章:
http://wiki.centos.org/zh-tw/AdditionalResources/Repositories/RPMForge
http://www.howtoforge.com/installing-lighttpd-with-php5-and-mysql-support-on-centos-5.4
http://www.kernelhardware.org/lighttpd-and-centos-5/
https://bugzilla.redhat.com/show_bug.cgi?id=571924

2011年7月4日 星期一

anaconda-ks.cfg內容

# Kickstart file automatically generated by anaconda.

install
url --url http://ftp.isu.edu.tw/pub/Linux/CentOS/5.6/os/i386
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto static --ip 192.168.1.111 --netmask 255.255.255.0 --gateway 192.168.1.254 --nameserver 168.95.1.1,8.8.8.8 --hostname centos5
rootpw --iscrypted $1$LCZhYcG9$pxb7ZeHvJXaoPABPQQVU4/
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Asia/Taipei
bootloader --location=mbr --driveorder=sda
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda
#part /boot --fstype ext3 --size=100 --ondisk=sda
#part pv.2 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.2
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024

%packages
@base
@core
@dialup
@editors
@text-internet
keyutils
iscsi-initiator-utils
trousers
fipscheck
device-mapper-multipath

CentOS 5.6 netinstall 最小安裝套件清單

只是記錄一下!
在安裝完成之後,/root/install.log 中有詳細的記錄,本想排序一下的,不過想想還是算了,說不定那天會需要原始的順序。

-- install.log --
filesystem-2.4.0-3.el5
tzdata-2010l-1.el5
rmt-0.4b41-5.el5
nash-5.1.19.6-68.el5
termcap-5.5-1.20060701.1
dump-0.4b41-5.el5
gnu-efi-3.0c-1.1
specspo-13-1.el5.centos
libgcc-4.1.2-50.el5
chkconfig-1.3.30.2-2.el5
glib2-2.12.3-4.el5_3.1
audit-libs-1.7.18-2.el5
libstdc++-4.1.2-50.el5
libusb-0.1.12-5.1
libtermcap-2.0.8-46.1
info-4.8-14.el5
libsepol-1.15.2-3.el5
nss-3.12.8-1.el5.centos
sed-4.1.5-5.fc6
bzip2-libs-1.0.3-6.el5_5
libxml2-2.6.26-2.1.2.8.el5_5.1
db4-4.3.29-10.el5_5.2
libattr-2.4.32-1.1
libcap-1.10-26
procps-3.2.7-16.el5
diffutils-2.8.1-15.2.3.el5
libgpg-error-1.4-2
libgcrypt-1.4.4-5.el5
binutils-2.17.50.0.6-14.el5
libpng-1.2.10-7.1.el5_5.3
libjpeg-6b-37
gdbm-1.8.0-26.2.1
libICE-1.0.1-2.1
libtiff-3.8.2-7.el5_5.5
bzip2-1.0.3-6.el5_5
gzip-1.3.5-11.el5.centos.1
cpio-2.6-23.el5_4.1
libsysfs-2.0.0-6
mailx-8.1.1-44.2.2
perl-String-CRC32-1.4-2.fc6
keyutils-1.2-1.el5
nss-tools-3.12.8-1.el5.centos
ed-0.2-39.el5_2
time-1.7-27.2.2
m4-1.4.5-3.el5.1
iputils-20020927-46.el5
tcl-8.4.13-4.el5
desktop-file-utils-0.10-7
grep-2.5.1-55.el5
libIDL-0.8.7-1.fc6
file-4.17-15.el5_3.1
checkpolicy-1.33.1-6.el5
dmidecode-2.10-3.el5
pax-3.4-2.el5_4
wireless-tools-28-2.el5
libdaemon-0.10-5.el5
libXdmcp-1.0.1-2.1
lftp-3.7.11-4.el5_5.3
numactl-0.9.8-11.el5
iptstate-1.4-2.el5
jwhois-3.2.3-11.el5
rsync-2.6.8-3.1
cyrus-sasl-plain-2.1.22-5.el5_4.3
udftools-1.0.0b3-0.1.el5
mtr-0.71-3.1
talk-0.17-29.2.2
cpuspeed-1.2.1-9.el5
ibmasm-3.0-9
zip-2.31-2.el5
dos2unix-3.1-27.2.el5
rdate-1.4-8.el5
hdparm-6.6-2
eject-2.1.5-4.2.el5
tree-1.5.0-4
pam_smb-1.1.7-7.2.1
pam_passwdqc-1.0.2-1.2.2
lrzsz-0.12.20-22.1
rdist-6.1.5-44
redhat-menus-6.7.8-3.el5
xorg-x11-filesystem-7.1-2.fc6
bitstream-vera-fonts-1.10-7
libX11-1.0.3-11.el5
libXrender-0.9.1-3.1
libXcursor-1.1.7-1.1
libXres-1.0.1-3.1
libXinerama-1.0.1-2.1
grub-0.97-13.5
libselinux-1.33.4-5.7.el5
device-mapper-1.02.55-2.el5
findutils-4.2.27-6.el5
krb5-libs-1.6.1-55.el5
openldap-2.3.43-12.el5_5.3
cairo-1.2.4-5.el5
psmisc-22.2-7
tar-1.15.1-30.el5
libpcap-0.9.4-15.el5
cryptsetup-luks-1.0.3-5.el5
libselinux-utils-1.33.4-5.7.el5
device-mapper-multipath-0.4.7-42.el5
pango-1.14.9-8.el5.centos
libwvstreams-4.2.2-2.1
wget-1.11.4-2.el5_4.1
cups-libs-1.3.7-26.el5
mtools-3.9.10-2.fc6
nscd-2.5-58
lvm2-2.02.74-5.el5
MAKEDEV-3.23-1.2
vim-minimal-7.0.109-7.el5
minicom-2.1-3
gnupg-1.4.5-14.el5_5.1
cadaver-0.22.3-4.el5
tmpwatch-2.9.7-1.1.el5.5
stunnel-4.15-2.el5.1
slrn-0.9.8.1pl1-1.2.2
pkinit-nss-0.7.6-1.el5
ksh-20100202-1.el5_5.1
mlocate-0.15-1.el5.2
nss_db-2.2-35.4.el5_5
syslinux-3.11-4
logwatch-7.3-8.el5
GConf2-2.14.0-9.el5
libwnck-2.16.0-4.fc6
dbus-libs-1.1.2-14.el5
dbus-1.1.2-14.el5
rpm-4.4.2.3-22.el5
python-libs-2.4.3-43.el5
libsemanage-1.9.1-4.4.el5
dmraid-1.0.0.rc13-63.el5
rpm-python-4.4.2.3-22.el5
gamin-python-0.1.7-8.el5
system-config-securitylevel-tui-1.6.29.1-6.el5
notification-daemon-0.3.5-9.el5
bluez-gnome-0.5-5.fc6
audit-libs-python-1.7.18-2.el5
yum-metadata-parser-1.1.2-3.el5.centos
m2crypto-0.16-6.el5.8
python-elementtree-1.2.6-5
pam-0.99.6.2-6.el5_5.2
util-linux-2.13-0.56.el5
SysVinit-2.86-15.el5
policycoreutils-1.33.12-14.8.el5
portmap-4.0-65.2.2.1
passwd-0.73-2
kbd-1.12-21.el5
ypbind-1.19-12.el5
sysklogd-1.4.1-46.el5
cyrus-sasl-2.1.22-5.el5_4.3
dnsmasq-2.45-1.1.el5_3
which-2.16-7
pygobject2-2.12.1-5.el5
fipscheck-1.2.0-1.el5
fetchmail-6.3.6-1.1.el5_3.1
yp-tools-2.9-1.el5
setools-3.0-3.el5
bluez-utils-3.7-2.2.el5.centos
rng-utils-2.0-4.el5
smartmontools-5.38-2.el5
acpid-1.0.4-9.el5_4.2
rp-pppoe-3.5-32.1
prelink-0.4.0-2.el5
nss_ldap-253-37.el5
pam_pkcs11-0.5.3-23
sudo-1.7.2p1-10.el5
libhugetlbfs-1.3-8.2.el5
htmlview-4.0.0-2.el5
python-urlgrabber-3.1.0-6.el5
selinux-policy-targeted-2.4.6-300.el5
sos-1.7-9.49.el5
pcsc-lite-1.4.4-4.el5_5
module-init-tools-3.3-0.pre3.1.60.el5_5.1
hwdata-0.213.22-1.el5
pciutils-3.1.7-3.el5
oddjob-0.27-11.el5
kernel-2.6.18-238.el5
yum-updatesd-0.9-2.el5
pcmciautils-014-5
isdn4k-utils-3.2-56.el5
nfs-utils-1.0.9-50.el5
hal-0.5.8.1-62.el5
NetworkManager-0.7.0-10.el5_5.2
NetworkManager-glib-0.7.0-10.el5_5.2
system-config-network-tui-1.3.99.18-1.el5
gpg-pubkey-e8562897-459f07a4
openssh-server-4.3p2-72.el5_6.3
setup-2.5.58-7.el5
basesystem-8.0-5.1.1.el5.centos
glibc-common-2.5-58
mailcap-2.1.23-1.fc6
centos-release-notes-5.6-0
cracklib-dicts-2.8.9-3.3
rootfiles-8.1-1.1.1
man-pages-2.39-17.el5
words-3.0-9.1
glibc-2.5-58
zlib-1.2.3-3
mktemp-1.5-23.2.2
popt-1.10.2.3-22.el5
expat-1.95.8-8.3.el5_5.3
atk-1.12.2-1.fc6
bash-3.2-24.el5
ncurses-5.5-24.20060715
nspr-4.8.6-1.el5
readline-5.1-3.el5
gawk-3.1.5-14.el5
tcp_wrappers-7.6-40.7.el5
cyrus-sasl-lib-2.1.22-5.el5_4.3
keyutils-libs-1.2-1.el5
libacl-2.2.39-6.el5
sqlite-3.3.6-5
libidn-0.6.5-1.1
freetype-2.2.1-28.el5_5.1
elfutils-libelf-0.137-3.el5
iproute-2.6.18-11.el5
iptables-1.3.5-5.3.el5_4.1
hesiod-3.1.0-8
slang-2.0.6-4.el5
perl-5.8.8-32.el5_5.2
libSM-1.0.1-3.1
gnutls-1.4.1-3.el5_4.8
less-436-7.el5
make-3.81-3.el5
libXau-1.0.1-3.1
pcsc-lite-libs-1.4.4-4.el5_5
aspell-0.60.3-7.1
iptables-ipv6-1.3.5-5.3.el5_4.1
vim-common-7.0.109-7.el5
hmaccalc-0.9.6-3.el5
groff-1.18.1.1-11.1
libgomp-4.4.4-13.el5
gpm-1.20.1-74.1
procmail-3.22-17.1.el5.centos
gamin-0.1.7-8.el5
pcre-6.6-6.el5
bc-1.06-21
ORBit2-2.14.3-5.el5
libevent-1.4.13-1
libvolume_id-095-14.24.el5
mingetty-1.07-5.2.2
dosfstools-2.11-9.el5
ethtool-6-4.el5
bluez-libs-3.7-1.1
sgpio-1.2.0_10-2.el5
sysfsutils-2.0.0-6
fbset-2.1-22
crash-4.1.2-8.el5.centos
acl-2.2.39-6.el5
attr-2.4.32-1.1
ftp-0.17-35.el5
telnet-0.17-39.el5
nano-1.3.12-1.1
mgetty-1.1.33-9.fc6
nc-1.84-10.fc6
unzip-5.52-3.el5
setarch-2.0-1.1
vconfig-1.9-3
rsh-0.17-40.el5
traceroute-2.0.1-5.el5
symlinks-1.2-24.2.2
setserial-2.17-19.2.2
unix2dos-2.2-26.2.3.el5
finger-0.17-32.2.1.1
libaio-0.3.106-5
crontabs-1.10-8
centos-release-5-6.el5.centos.1
redhat-logos-4.9.99-11.el5.centos
aspell-en-6.0-2.1
libXext-1.0.1-2.1
libXfixes-4.0.1-2.1
libXrandr-1.1.1-3.3
libXi-1.0.1-4.el5_4
startup-notification-0.8-4.1
anacron-2.3-45.el5.centos
shadow-utils-4.0.17-18.el5
e2fsprogs-libs-1.39-23.el5_5.1
coreutils-5.97-23.el5_4.2
openssl-0.9.8e-12.el5_5.7
fontconfig-2.4.1-7.el5
e2fsprogs-1.39-23.el5_5.1
logrotate-3.7.4-9.el5_5.2
kpartx-0.4.7-42.el5
libgssapi-0.10-2
net-tools-1.60-81.el5
nfs-utils-lib-1.0.8-7.6.el5
libXft-2.1.10-1.1
neon-0.25.5-10.el5_4.1
bind-libs-9.3.6-16.P1.el5
curl-7.15.5-9.el5
tcsh-6.14-17.el5_5.2
audit-1.7.18-2.el5
device-mapper-event-1.02.55-2.el5
libutempter-1.1.4-4.el5
lockdev-1.0.1-10
patch-2.5.4-31.el5
amtu-1.0.6-2.el5
bind-utils-9.3.6-16.P1.el5
conman-0.1.9.2-8.el5
autofs-5.0.1-0.rc2.143.el5_5.6
tcpdump-3.9.4-15.el5
elinks-0.11.1-6.el5_4.1
psacct-6.3.2-44.el5
parted-1.8.1-27.el5
vim-enhanced-7.0.109-7.el5
lsof-4.78-3
hicolor-icon-theme-0.9-2.1
gtk2-2.10.4-21.el5_5.6
trousers-0.3.1-4.el5
python-2.4.3-43.el5
dbus-glib-0.73-10.el5_5
newt-0.52.2-15.el5
fipscheck-lib-1.2.0-1.el5
libxml2-python-2.6.26-2.1.2.8.el5_5.1
gettext-0.17-1.el5
rhpl-0.194.1-1
rpm-libs-4.4.2.3-22.el5
dbus-python-0.70-9.el5_4
man-1.6d-1.1
ntsysv-1.3.30.2-2.el5
libnotify-0.4.2-6.el5
wpa_supplicant-0.5.10-9.el5
python-sqlite-1.1.7-1.2.1
iscsi-initiator-utils-6.2.0.872-6.el5
libselinux-python-1.33.4-5.7.el5
cracklib-2.8.9-3.3
udev-095-14.24.el5
ppp-2.4.4-2.el5
initscripts-8.45.33-1.el5.centos
libuser-0.54.7-2.1.el5_4.1
usermode-1.88-3.el5.2
authconfig-5.3.21-6.el5
dhclient-3.0.5-23.el5_5.2
vixie-cron-4.1-77.el5_4.1
sendmail-8.13.8-8.el5
mcstrans-0.2.11-3.el5
at-3.1.8-84.el5
dmraid-events-1.0.0.rc13-63.el5
mdadm-2.6.9-3.el5
mutt-1.4.2.2-3.0.2.el5
setuptool-1.19.2-1.el5.centos
quota-3.13-4.el5
microcode_ctl-1.17-1.52.el5
dhcpv6-client-1.0.10-20.el5
irqbalance-0.55-15.el5
ipsec-tools-0.6.5-14.el5_5.5
wvdial-1.54.0-5.2.2.1
krb5-workstation-1.6.1-55.el5
pam_ccreds-3-5
pam_krb5-2.2.14-18.el5
ecryptfs-utils-75-5.el5
readahead-1.3-8.el5
selinux-policy-2.4.6-300.el5
python-iniparse-0.2.3-4.el5
redhat-lsb-4.0-2.1.4.el5
pinfo-0.6.9-1.fc6
mkinitrd-5.1.19.6-68.el5
ifd-egate-0.05-15
yum-3.2.22-33.el5.centos
ccid-1.3.8-1.el5
oddjob-libs-0.27-11.el5
yum-fastestmirror-1.1.16-14.el5.centos.1
mkbootdisk-1.5.3-2.1
coolkey-1.1.0-15.el5
usbutils-0.71-2.1
irda-utils-0.9.17-2.fc6
pm-utils-0.99.3-10.el5.centos
kudzu-1.2.57.1.26-1.el5.centos
apmd-3.2.2-5
firstboot-tui-1.4.27.8-1.el5.centos


設定ip

如果在安裝的過程中使用的透過dhcp方式取得ip的話,當伺服器就比較不便。所以如果有靜態IP的話會比較方便。在CentOS中這個工作簡單多了,因為系統有提供一個文字命令system-config-network可以直接設定。
> system-config-network




另外,設定hostname和dns的設定也是在這個介面中操作。

當然重新啟動網路服務
> service network restart
畫面一直停在這兒不必覺得奇怪,因為ip變了,所以putty當然連不上囉!

安裝openssh-server

CentOS系統安裝好後當然接著就是裝其它的應用軟體,可是持續待在機房裏實在也不是辦法,噪音和機器散發出的有害物質也太令人害怕了!所以當然是將機器放在機房,透過遠端連線進來操作。基於安全性的問題,現在的linux遠端連線都是透過加密連線,實做的方式就裝個ssh伺服器最快了!

在CentOS裏,只要下命令
> yum install openssh-server
> …(略)…
> Is this ok[y/N]:

接著會出現一些套件相依性的資訊,會另外安裝openssh、openssh-clients大約1.0M左右。當然要按y繼續安裝囉!

接著會顯示要匯入一個GPG的key,先按y繼續。沒意外的話,就會顯示安裝成功的訊息。

接著就啟動服務囉!

再來就用putty連線一下囉!第一次連線的話,putty會先問是否要將key存起來,按y的話下次連線就不會再出現詢問畫面。

如果沒有設定其它使用者的話,可以用root直接登入。

這樣就可以用囉!進階的設定待後續…

CentOS設定系統時間

系統剛安裝好,先處理系統時間,從資安的角度來看,系統時間的正確性是基本的查核項目。
在CentOS裏關於時間的命令有date、hwclock,若透過網路更新的話則有ntpdatet可用。
以CentOS-5.6-i386-netinstall.iso以最小安裝為例。

不過,為了一勞永逸,當然是透過網路更新比較省事囉!首先,要先安裝ntp這個套件。


[root@centos5 ~]# yum install ntp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.tc.edu.tw
* extras: ftp.tc.edu.tw
* updates: ftp.tc.edu.tw
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i386 0:4.2.2p1-9.el5.centos.2.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
Package Arch Version Repository Size
=========================================================================================
Installing:
ntp i386 4.2.2p1-9.el5.centos.2.1 base 1.3 M

Transaction Summary
=========================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)

Total download size: 1.3 M
Is this ok [y/N]:



按y繼續囉!

Downloading Packages:
ntp-4.2.2p1-9.el5.centos.2.1.i386.rpm | 1.3 MB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : ntp 1/1

Installed:
ntp.i386 0:4.2.2p1-9.el5.centos.2.1

Complete!



話不多說,趕快同步一下,不過得先挑個伺服器。我慣用的的是tock.stdtime.gov.tw,

[root@centos5 ~]# ntpdate tock.stdtime.gov.tw
5 Jul 14:42:35 ntpdate[2664]: step time server 220.130.158.71 offset 73445.538839 sec



不過也有人建議用pool.ntp.org這個網址,所以上pool.ntp.org網站查了一下,在台灣它有13台伺服器在服務,網站是tw.pool.ntp.org。用ping測試了一下,好像是tock.stdtime.gov.tw回應快了一點點。

C:\Documents and Settings\User>ping tock.stdtime.gov.tw

Pinging tock.stdtime.gov.tw [220.130.158.71] with 32 bytes of data:

Reply from 220.130.158.71: bytes=32 time=8ms TTL=47
Reply from 220.130.158.71: bytes=32 time=9ms TTL=47
Reply from 220.130.158.71: bytes=32 time=8ms TTL=47
Reply from 220.130.158.71: bytes=32 time=8ms TTL=47

Ping statistics for 220.130.158.71:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 8ms, Maximum = 9ms, Average = 8ms

C:\Documents and Settings\User>ping tw.pool.ntp.org

Pinging tw.pool.ntp.org [140.130.175.9] with 32 bytes of data:

Reply from 140.130.175.9: bytes=32 time=10ms TTL=51
Reply from 140.130.175.9: bytes=32 time=10ms TTL=51
Reply from 140.130.175.9: bytes=32 time=10ms TTL=51
Reply from 140.130.175.9: bytes=32 time=9ms TTL=51

Ping statistics for 140.130.175.9:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 9ms, Maximum = 10ms, Average = 9ms