2011年1月10日 星期一

CentOS Chinese Support and others

CentOS Chinese Support and others

server 2010-07-11 22:07:58 阅读126 评论0  字号:大中小 订阅
After many years, we get back to Linux again, installed CentOS 5.5 during
the match that Germany defeated Uruguay

yum install "@Chinese Support"
yum install fonts-chinese
yum install scim-chinese-standard scim-tables-chinese

Logout and restart

2011年1月9日 星期日

Centos 5.5 Vmware Server 2.0 installation

1、到VMware官網上下載安裝包,註冊免費Licensing 
https://www.vmware.com/ 
http://register.vmware.com/content/download-107.html 
VMware Server 2 for Linux AAM0N-FF00U-U9HC2-42194 
VMware Server 2 for Windows A2084-F6J0Y-VAJF0-40NV4 
VMware Server1.07
的rpm包下載地址:http://download3.vmware.com/software/vmserver/VMware-server-1.0.7-108231.i386.rpm 貌似Server2.0不能下載……
2、安裝必須的包: 
gcc gcc-c++ 
kernel kernel-devel kernel-headers 
libXtst-devel libXrender-devel xinetd 
yum install -y kernel-headers libXtst-devel libXrender-devel xinetd
3、安裝VMware Server: 
rpm -ivh VMware-server-1.0.7-108231.i386.rpm 
安裝完成以後運行配置腳本進行配置: 
/usr/bin/vmware-config.pl 
一路順下去 
1
)閱讀協議yes 
2
)In which directory do you want to install the mime type icons? 
[/usr/share/icons] 
3
)What directory contains your desktop menu entry files? These files have a 
.desktop file extension. [/usr/share/applications] 
4
)In which directory do you want to install the application's icon? 
[/usr/share/pixmaps] 
5
)Trying to find a suitable vmmon module for your running kernel. 
None of the pre-built vmmon modules for VMware Server is suitable for your running kernel. Do you want this program to try to build the vmmon module for your system (you need to have a C compiler installed on your system)? [yes] 
6
)Using compiler "/usr/bin/gcc". Use environment variable CC to override. 
What is the location of the directory of C header files that match your running kernel? [/lib/modules/2.6.18-92.el5PAE/build/include] 
7)The module loads perfectly in the running kernel. 
Do you want networking for your virtual machines? (yes/no/help) [yes] 
8)Configuring a bridged network for vmnet0. 
Your computer has multiple ethernet network interfaces available: eth0, eth1. Which one do you want to bridge to vmnet0? [eth0] 
9)The following bridged networks have been defined: 
. vmnet0 is bridged to eth0 
Do you wish to configure another bridged network? (yes/no) [no] 
10)Do you want to be able to use NAT networking in your virtual machines? (yes/no)[yes] 
11)Configuring a NAT network for vmnet8. 
Do you want this program to probe for an unused private subnet? (yes/no/help) [yes] 
12)Probing for an unused private subnet (this can take some time)... 
The subnet 172.16.134.0/255.255.255.0 appears to be unused. 
The following NAT networks have been defined: 
. vmnet8 is a NAT network on private subnet 172.16.134.0. 
Do you wish to configure another NAT network? (yes/no) [no] 
13)Do you want to be able to use host-only networking in your virtual machines? [yes] 
14)Configuring a host-only network for vmnet1. 
Do you want this program to probe for an unused private subnet? (yes/no/help) [yes] 
15)Probing for an unused private subnet (this can take some time)... 
The subnet 192.168.155.0/255.255.255.0 appears to be unused. 
The following host-only networks have been defined: 
. vmnet1 is a host-only network on private subnet 192.168.155.0. 
Do you wish to configure another host-only network? (yes/no) [no] 
16)The module loads perfectly in the running kernel. 
The default port : 902 is not free. We have selected a suitable alternative port for VMware Server use. You may override this value now.Remember to use this port when connecting to this server.Please specify a port for remote console connections to use [ 904] 
17)In which directory do you want to keep your virtual machine files? 
[/var/lib/vmware/Virtual Machines] 
18)The path "/var/lib/vmware/Virtual Machines" does not exist currently. This program is going to create it, including needed parent directories. Is this what you want? [yes] 
19)Please enter your 20-character serial number. 
Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel: AAM0N-FF00U-U9HC2-42194 
安裝完成。
4、安裝完成了以後(不知道用不用運行vmware命令)就可以直接用VMware Server Console去連了: 
主意的是,此處需要在IP後加上端口904,如: 
192.168.1.10:904 
就可以正常操作了

2010年12月16日 星期四

Linux 基本安全設置 (關閉不必要服務)

Linux 基本安全設置

1 . 檢查有什麼Service 正在運行 , 沒有必要的Service 便把其關閉

指令: netstat –anpltu | grep –vw ESTABLISHED

[root@luckyland-hk ~]# netstat -anpltu |grep -vw ESTABLISHED
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      2689/hpiod
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      29911/mysqld
tcp        0      0 0.0.0.0:106                 0.0.0.0:*                   LISTEN      2778/xinetd
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      12684/smbd
tcp        0      0 127.0.0.1:783               0.0.0.0:*                   LISTEN      2932/spamd.pid
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2292/portmap
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      3287/perl
tcp        0      0 0.0.0.0:818                 0.0.0.0:*                   LISTEN      2332/rpc.statd
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      20792/vsftpd
tcp        0      0 127.0.0.1:3350              0.0.0.0:*                   LISTEN      3262/sesman
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      7751/smtpd
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      12684/smbd



2 . 如果IP 來源為 127.0.0.1 可以不用理會 , 因為該服務只在本機運行

3 . 其他的Services 需要細心去查閱是不必要 , 如是把其閉關

指令:
chkconfig – - level service name  off (disable the dedicate service )
Chkconfig - - list  ( showing the running service  )
chkconfig service name on  (enable the service during reboot )


4 . grep –w portno /etc/services





限制su 使用

1 . 限制只有wheel group 的用使用者才可以使用su 指令\


1 . chgrp wheel /bin/su
2 . chmod 4750 /bin/su
 Ls –l /bin/su

3 . vi /etc/group

Find wheel , add the user name at the end of the line 以 “ , “ 分隔開

利用XRDP遠端登陸linux系統 [ remote desktop

[ 轉貼自網絡 ] 利用XRDP遠端登陸linux系統

http://linux.chinaunix.net/bbs/viewthread.php?tid=1149869

一般情況下我們用ssh用戶端遠端登陸inux系統,至於圖形介面下的linux遠端登陸工具,我們一般都會想到vnc,但它的安全性不夠,在這裏,我將介紹XRDP的安裝配置方法。

xrdp安裝配置方法

1、如果是debian系發行版,可以設置好源後直接apt-get install xrdp
如果是redhat系發行版,可以到http://xrdp.sourceforge.net下載安裝包

xrdp依賴於pam和openssl-del,編譯前需要先安裝pam-devel和openssl-devel這兩個包(不同發行版的包名稱有一點不同)
如果是redhat系,設置好源直接yum install pam-devel openssl-devel

2、下載好xrdp的安裝包後,用tar -xvvzf 解壓
進入解壓出來的目錄用root帳號執行make ,然後執行make install

3、xrdp需要vncserver,所以還要安裝vncserver

4、準備好後,可以通過解壓出來的目錄下的instfiles目錄下的xrdp-control.sh腳本啟動xrdp
xrdp-control.sh start
可以把此腳本添加到/etc/rc.d/init.d/中,讓它開機自動運行。

5、啟動好xrdp,就可以通過用戶端的rdp client 連接到伺服器上,win下可以用mstsc,linux下可以用rdesktop或者krdp。
module 選擇為:sesman-Xvnc

6、xrdp的配置文檔在/etc/xrdp目錄下的xrdp.ini和sesman.ini

xrdp.ini 關鍵部分在globals

[globals]
bitmap_cache=yes 點陣圖緩存
bitmap_compression=yes 點陣圖壓縮
port=3389 監聽埠
crypt_level=low 加密程度(low為40位,high為128位,medium為雙40位)
channel_code=1 不知道是什麼

sesman.ini

[Globals]
ListenAddress=127.0.0.1 監聽ip地址(默認即可)
ListenPort=3350 監聽埠(默認即可)
EnableUserWindowManager=1 1為開啟,可讓用戶自定義自己的啟動腳本
UserWindowManager=startwm.sh
DefaultWindowManager=startwm.sh

[Security]
AllowRootLogin=1 允許root登陸
MaxLoginRetry=4 最大重試次數
TerminalServerUsers=tsusers 允許連接的用戶組(如果不存在則默認全部用戶允許連接)
TerminalServerAdmins=tsadmins 允許連接的超級用戶(如果不存在則默認全部用戶允許連接)

[Sessions]
MaxSessions=10 最大會話數
KillDisconnected=0 是否立即關閉斷開的連接(如果為1,則斷開連接後會自動註銷)
IdleTimeLimit=0 空閒會話時間限制(0為沒有限制)
DisconnectedTimeLimit=0 斷開連接的存活時間(0為沒有限制)

[Logging]
LogFile=./sesman.log 登陸日誌文件
LogLevel=DEBUG 登陸日誌記錄等級(級別分別為,core,error,warn,info,debug)
EnableSyslog=0 是否開啟日誌
SyslogLevel=DEBUG 系統日誌記錄等級

裝好後,我們就可以直接從win系統下利用mstsc直接進行登陸,相當方便,如果是linux,可以用rdesktop。





***********************************



 

Linux Xrdp 安裝

Posted by admin on 01 六月, 2010 12:54
Xrdp 是開放原始碼的遠端桌面通訊協定 Remote Desktop Protocol 伺服器服務,可用來替代傳統的 vnc server,以增進遠端連線的效能。

以 apt 指令安裝 xrdp 將會顯示
vnc4server xbase-clients xrdp 等三個相依套件需要安裝,記得在使用 Ubuntu 9.10 時,仍需加裝「libpam0g-dev」和「libcurl4-openssl-dev」才能順利運作 xrdp,所以安裝指令為:

sudo apt-get install libpam0g-dev libcurl4-openssl-dev xrdp

不過,來到了 Ubuntu 10.04 這個版本,xrdp 版本雖然仍是 2008-07-18 的 v0.4.1,很好奇的試了一下只用這一行指令:

sudo apt-get install xrdp

系統已簡化了安裝流程,自動列出「vnc4server xbase-clients xrdp」三個相依套件,按下「enter」安裝後好就可啟用了,而且實測結果:連線成功!

xrdp 服務啟動後,使用者就可以用 Windows 上的「遠端桌面連線」來操作 Linux 的桌面了。對於慣用「遠端桌面連線」的人來說,最大的好處在於不用再另外再安裝 vnc 連線程式了。不過,第一次使用時將會發現,並非如 Windows 平臺間的「遠端桌面連線」那樣,「直接」登入就可操作遠端電腦。而是多了一個陌生的登入視窗,螢幕上顯示的共有「sesman-Xvnc」、「console」、「vnc-any」……等六種登入選項。原來 xrdp 服務是以 Port 3389 接受「遠端桌面連線」,操作桌面時再轉交給主機中的 vncserver 來執行。



因此,選用「console」模式,就成了以本機連線方式操作了,這時只要輸入 vnc 密碼就可以登入了。而從「vnc-any」模式中的 IP 欄位元可知道,這裡不僅可輸入本機的 IP,或者「localhost」也行,試著指定其他提供 vnc 服務主機的 IP,照樣也可以登入。本來是在 Ubuntu 9.10 版上大多以「console」模式,連線到被控端電腦,Ubuntu 10.04 似乎改變了使用者登入方式,這個「console」模式常常無法登入。還好預設的第一個模式「sesman-Xvnc」,輸入使用者帳號、密碼就能操作了。那就改用這個模式吧!

如果操作環境安全條件許可的話,將連線設定儲存成「遠端桌面連線」rdp 設定檔,再配合「遠端桌面連線」程式的「儲存認證」功能,把密碼記憶在使用者端的電腦中,使用時就可不用輸入帳號、密碼而直接登入了。

xrdp 的設定檔是 /etc/xrdp/xrdp.ini
sudo vi /etc/xrdp/xrdp.ini
可看到以下內容:

[globals]
bitmap_cache=yes
bitmap_compression=yes
port=3389
crypt_level=low
channel_code=1

[xrdp1]
name=sesman-Xvnc
lib=libvnc.so
username=ask
……

[xrdp2]
name=console
lib=libvnc.so
ip=127.0.0.1
……

[xrdp3]
name=vnc-any
lib=libvnc.so
……

如果把其中的[xrdp1]和[xrdp2]的設定內容順序對調,序號1和2也一併修改,這樣連線選項順位就會隨著改變了。而且在 [globals] 這個項目中,可以看到預設的 Port 3389 也是在這裡設定的。

設定完重新啟動 xrdp:
/etc/init.d/xrdp restart

相關網站:http://xrdp.sourceforge.net/
 

Linux Ram (一) : 如何釋放Cached Ram

Linux Ram (一)   : 如何釋放Cached Ram

1 . Buffer : 減少文件寫入硬碟機的時間
2 . Cache : 把文件暫存於記憶體內 , 減少I/O 存取次數 , 提升效率


如何手動清除Cached Ram

可以用以下指令
echo 1 > /proc/sys/vm/drop_caches
建議用1即可,用2可以從dentries、inodes中壓出更多的空間.
echo 2 > /proc/sys/vm/drop_caches
但3就不建議了,容易造成系統錯誤.
記得釋放完,要再下
echo 0 > /proc/sys/vm/drop_caches
指令.來回復預設狀況喔!~



Ram 是如何使用
顯示:           
total
used
free
shared
buffers
cached
 Mem:
255268
238332
16936
0
85540
126384
-/+buffers/cache

26408
228860 (free2)






            




在終端中敲入:free

255268 238332 16936 0 85540 126384
    -/+ buffers/cache:26408 228860
系統的總物理內存:255268Kb(256M),但係統當前真正可用的內存並不是第一行free 標記的16936Kb,它僅代表未被分配的內存。
我們使用total1、used1、free1、used2、 free2 等名稱來代表上面統計數據的各值,1、2 分別代表第一行和第二行的數據。
total1
:表示物理內存總量。
used1
:表示總計分配給緩存(包含buffers 與cache )使用的數量,但其中可能部分緩存並未實際使用。
free1
:未被分配的內存。
shared1
:共享內存,一般系統不會用到,這裡也不討論。
buffers1
:系統分配但未被使用的buffers 數量。
cached1
:系統分配但未被使用的cache 數量。 buffer 與cache 的區別見後面。
used2:實際使用的buffers 與cache 總量,也是實際使用的內存總量。
free2:未被使用的buffers 與cache 和未被分配的內存之和,這就是系統當前實際可用內存。
可以整理出如下等式:
total1 = used1 + free1
total1 = used2 + free2