104的小美工作家-找工作也可以試試喔!

顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2010年7月5日 星期一

Apache Mod_rewrite 開啟方式

<body ONDRAGSTART="window.event.returnValue=false" onSelectStart="event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" >

修改Apache 設定檔

將底下模組的#拿掉
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c

修改.htaccess 設定值,將其設定為 All
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

2009年4月13日 星期一

CentOS 第三方套件庫 - RPMforge

*參考說明

1. CentOS 5

You should make sure that you have Priorities installed.

1.1. Priorities

yum-priorities is available in the CentOS 5 repositories:

yum install yum-priorities

Plugins are enabled in CentOS 5 by default.

Make sure that yum-priorities is enabled by editing the /etc/yum/pluginconf.d/priorities.conf file, and ensuring that it contains the following lines:

[main]
enabled=1

Edit the .repo files in /etc/yum.repos.d/ and set up priorities by adding the line:

priority=N

to a repository entry, where N is an integer number from 1 to 99.

The recommended settings are:

[base], [addons], [updates], [extras] ... priority=1 
[centosplus],[contrib] ... priority=2
Third Party Repos such as rpmforge ... priority=N (where N is > 10 and based on your preference)

1.2. RPMforge

Download the rpmforge-release package. Choose one of the two links below, depending on your architecture. If you are unsure of which one to use you can check your architecture with the command uname -i

(You can find a complete list of rpmforge-release package packages at http://dag.wieers.com/packages/rpmforge-release/ but it is recommended that you use one of the two listed above).

Install DAG's GPG key

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

Verify the package you have downloaded

rpm -K rpmforge-release-0.3.6-1.el5.rf.*.rpm

Security warning: The rpmforge-release package imports GPG keys into your RPM database. As long as you have verified the package and trust Dag then it should be safe.

Install the package

rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm

This will add a yum repository config file and import the appropriate GPG keys. At this point, you can set the priority of the RPMForge repository, and also of the CentOS repositories if you have not done so yet.

Test with this command:

yum check-update

It should output these two lines:

Loading "priorities" plugin
...
76 packages excluded due to repository priority protections

The number above may differ, but there should be several packages shown as being excluded.

If so then it looks like things are working so try installing something like this

yum install mplayer

2009年4月11日 星期六

2009年4月6日 星期一

CentOS5 中VNC Server 設定

1. 所需套件:
# yum -y install vnc vnc-server

2. VNC Server 設定
修改VNCSERVERS="1:myusername" VNCSERVERARGS 的設定
(1表示port為5901,2表示port為5902......; myusername 為登入者帳號)

# vi /etc/sysconfig/vncservers
VNCSERVERS="2:root"
VNCSERVERARGS[2]="-geometry 1024x768 -depth 24"

3. 設定VNC 使用者密碼
# vncpasswd

4. 修改 X桌面設定值,將xstartup中底下的兩行註解拿掉
#service vncserver start (先啟動一次VNC Server)
# vi ~/.vnc/xstartup

unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

5. 設定防火牆,讓VNC Server 可以從外部網路連入
#vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5902 -j ACCEPT

6.從新啟動iptables
#service iptables restart

7. 啟動VNC Server 檢查port 有否開啟
# /etc/rc.d/init.d/vncserver start
#netstat -tlnp
tcp 0 0 *:5902

8. 利用VNC Viewer 連入

2009年4月5日 星期日

How to install ZIPARCHIVE for PHP in CentOS5

如何在CentOS 5 中安裝PHP用的 ZIP 擴充套件:

Step 0: Set up the yum-priorities plugin: http://wiki.centos.org/PackageManagement/Yum/Priorities
Step 1: Enable the EPEL repository: http://wiki.centos.org/AdditionalResources/Repositories
Step 2: Install the php-pecl-zip extension package:

依造上面的步驟說明分別是:
1. #yum install yum-priorities

2. #wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
#rmp -ivh epel-release-5-3.noarch.rpm

3. #yum install php-pecl-zip
過程中會驗證GPG key 選擇 y

2009年4月4日 星期六

Apache ServerTokens

Description: Configures the Server HTTP response header

Syntax: ServerTokens Major|Minor|Min[imal]|Prod[uctOnly]|OS|Full

Default: ServerTokens Full

Context: server config

ServerTokens Prod[uctOnly] Server sends (e.g.): Server: Apache

ServerTokens Major Server sends (e.g.): Server: Apache/2

ServerTokens Minor Server sends (e.g.): Server: Apache/2.0

ServerTokens Min[imal] Server sends (e.g.): Server: Apache/2.0.41

ServerTokens OS Server sends (e.g.): Server: Apache/2.0.41 (Unix)

ServerTokens Full (or not specified) Server sends (e.g.): Server: Apache/2.0.41 (Unix) PHP/4.2.2 MyMod/1.2

This setting applies to the entire server, and cannot be enabled or disabled on a virtualhost-by-virtualhost basis.


2009年3月26日 星期四

Cent OS 安裝 PHP GD

預設安裝中 CentOS沒有php-gd,需額外再安裝,
#yum install php-gd

安裝完成後再從新啟動mysqld就完成。
#service mysqld restart

2008年12月4日 星期四

製作不用密碼立即登入ssh server

1. 先在client端建立Public Key和Private Key兩把鑰匙:
#ssh-keygen -t rsa
(如此便會在家目錄中的.ssh資料夾裡產生id_rsa、id_rsa.pub兩個檔案,需特別注意id_rsa的權限要為-rw------)

2. 到server端放置id_rsa.pub檔,並轉存為authorized_keys於登入者家目錄中.ssh資料夾裡:
先於client端
#cd ~/.ssh
#scp id_rsa.pub root@XXX.XXX.XX.XX:/root/.ssh
到server端
#cd ~/.ssh
#cat id_rsa.pub >> authorized_keys

2008年9月28日 星期日

安裝phpMyAdmin管理MySQL

phpMyAdmin是一套圖形介面的MySQL管理程式,透過圖形介面更容易管理MySQL,對於不太熟悉SQL語言的人也是一個很不錯的工具。

  • CentOS中配置方法可參考這篇教學
另外配置過程中需要額外安裝兩個套件:php-mbstringphp-mcrypt
# yum -y install php-mbstring
# yum --enablerepo=centosplus install php-mcrypt

(若無法順利安裝php-mcrypt套件,可以改用底下方式試試:
# wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
# rpmbuild -ta libmcrypt-2.5.7.tar.gz
# rpm -ivh /usr/src/redhat/RPMS/i386/libmcrypt-2.5.7-1.i386.rpm /usr/src/redhat/RPMS/i386/libmcrypt-devel-2.5.7-1.i386.rpm
# yum --enablerepo=centosplus install php-mcrypt
)

※phpmyadmin參數設定
#cp /var/www/phpmyadmin/config.sample.php /var/www/phpmyadmin/config.inc.php
#chmod 660 /var/www/phpmyadmin/config.inc.php
#vi /var/www/phpmyadmin/config.inc.php
$cfg['blowfish_secret'] = '填入任何字串';
#
chown -R root.apache /var/www/phpmyadmin/
#vi /etc/httpd/conf.d/phpmyadmin.conf
Alias /phpmyadmin /var/www/phpmyadmin
//此句設定可限制外部網路連接phpmyadmin
< Location /phpmyadmin >
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0
< /location >

2008年7月19日 星期六

Linux 中 port 對照表

存放port對應相關服務之檔案位置: /etc/services

常用的port:
ftp --> 21/tcp
ssh --> 22/tcp
telnet --> 23/tcp
smtp --> 25/tcp
pop3 --> 110/tcp
http -->80/tcp

2008年6月6日 星期五

phpMyAdmin 中文資料亂碼問題

在使用phpMyAdmin 做為管理MySQL的介面時,即使編碼已設定為UTF-8,但在一些數據資料上中文的顯示仍是會出現亂碼,解決的方式是:
修改 phpMyAdmin 裡 \libraries\select_lang.lib.php 設定檔中底下的變數

$GLOBALS['mysql_charset_map'] = array(
/* UTF-8 */
'utf-8' => 'utf8' 改成 'utf-8' => 'latin1'
/* Big5 */
'big5' => 'big5' 改成 'big5' => 'latin1'

2008年5月17日 星期六

CentOS Server設定調整

設定 fatestmirror :(讓yum在搜尋下載套件時,自行搜尋使用最近最快的境像站台)
#yum install yum-plugin-fastestmirror (for CentOS4)
#yum install yum-fastestmirror (for CentOS5)

完成後再編輯 /etc/yum/pluginconf.d/fastestmirror.conf
[main]
verbose = 0
socket_timeout = 3
enabled = 1
hostfilepath = /var/cache/yum/timedhosts.txt
maxhostfileage = 1


語系設定檔位置:
# /etc/sysconfig/i18n
LANG="zh_TW.UTF-8"

防火牆設定指令:
#system-config-securitylevel

開機時即自動啟動之系統服務:
#ntsysv