2012年10月6日 星期六

CentOS MySQL 調整

1、複製my-large.cnf文件到/etc/my.cnf cp /usr/share/doc/mysql-server-5.1.61/my-large.cnf /etc/my.cnf 2、打開my.cnf修改編碼 vi /etc/my.cnf
[client]
character-set-server = utf8

[mysql]
character-set-server = utf8

[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci' 
init_connect
='SET NAMES utf8'
character-set-server
=utf8
collation-server
=utf8_unicode_ci
skip-character-set-client-handshake

3、重啟MySQL服務 service mysqld restart 4、登錄mysql看看修改成功否 show variables like 'character%'; 5.更新密碼
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

CentOS 啟用memcached

#yum install -y memcached php5-memcache

#vi /etc/php.ini

session.save_handler = files
修改成
session.save_handler = memcache
session.save_path="tcp://127.0.0.1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"

#vi /etc/sysconfig/memcached

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="512"
OPTIONS=""


#service memcached restart
#service httpd restart

查看狀態
memcached-tool 127.0.0.1:11211 stats
memcached-tool 127.0.0.1:11211 display
memcached-tool 127.0.0.1:11211 dump

設定開機啟用

chkconfig memcached on

可以解決session 檔案過多,造成效能下降的狀況

CentOS 改中文語系

/etc/sysconfig/i18n

修改成下面設定

原LANG="en_US.UTF8"
改為LANG="zh_TW.UTF8"

2012年8月29日 星期三

bluehost hostmonster 排程更新網頁方法 cronjob

go to the "advanced" tab

click "cron jobs"

choose the "standard" experience level

in the field "command to run" type the following

curl 網址

2012年1月18日 星期三

openSUSE 軟體源

http://ftp.cs.pu.edu.tw/Linux/OpenSuse/update/12.1/

http://gnupg.cdpa.nsysu.edu.tw/Linux/OpenSuSE/update/12.1/

SUSE 常用設定

重啟
rcapache2 restart

#網頁目錄
cd /srv/www
#apache 設定檔
cd /etc/apache2/conf.d
#系統目錄
cd /etc/sysconfig/

PHP.ini
/etc/php5/apache2/php.ini

APACHE_MODULES

crontab -e

yast -i gd

yast -i libpng
yast -i php5-gd php5-mbstring php5-mcrypt php-xml php5-pear

--
起始安裝
yast2 –-install apache2

yast2 –-install mysql mysql-tools

yast2 –-install php5 php5-mysql apache2-mod_php5

yast2 –-install php5-gd php5-mbstring php5-mcrypt php-xml php5-pear

rcmysql start

mysqladmin -u root password 'mysecretpassword'

chkconfig -a mysql

(Please substitute your own unique password for 'mysecretpassword')

pear install MDB2_driver_mssql

a2enmod php5

a2enmod -l

rcapache2 restart

chkconfig -a apache2

2012年1月17日 星期二

openSUSE 12 安裝 openwebmail FAQ

安裝後的網址 http://localhost/cgi-bin/openwebmail/openwebmail.pl


1.
yast2 -i postfix perl perl-Compress-Zlib perl-Text-Iconv
perl -MCPAN -e 'install HTML::Template' 
perl -MCPAN -e 'install Unix::SetUser' 


2. 配合apache安裝openwebmail 網頁


cd /srv/www/
wget http://openwebmail.org/openwebmail/download/current/openwebmail-current.tar.gz
tar zxvf openwebmail-current.tar.gz 
rm openwebmail-current.tar.gz 
mv /srv/www/data/openwebmail /srv/www/htdocs/


vi /srv/www/cgi-bin/openwebmail/etc/openwebmail.conf



ow_cgidir /srv/www/cgi-bin/openwebmail
ow_htmldir /srv/www/htdocs/openwebmail
default_language        zh_TW.Big5


cd /srv/www/cgi-bin/openwebmail/etc/


cp /srv/www/cgi-bin/openwebmail/etc/defaults/dbm.conf /srv/www/cgi-bin/openwebmail/etc/
vi dbm.conf
dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no


cp /srv/www/cgi-bin/openwebmail/etc/defaults/auth_unix.conf /srv/www/cgi-bin/openwebmail/etc/
vi auth_unix.conf


#passwdfile_encrypted /etc/master.passwd
#passwdmkdb /usr/sbin/pwd_mkdb
passwdfile_plaintext /etc/passwd 
passwdfile_encrypted /etc/shadow 
passwdmkdb none


check_expire no
check_nologin no
check_shell no
check_cobaltuser no
change_smbpasswd no


初始化


/srv/www/cgi-bin/openwebmail/openwebmail-tool.pl --init


chmod 4555 /srv/www/cgi-bin/openwebmail/openwebmail*.pl 


chown root.mail /srv/www/cgi-bin/openwebmail/openwebmail*.pl


chmod


----


安裝FAQ
Q1: Can't locate HTML/Template.pm in @INC...
A1: perl -MCPAN -e 'install HTML::Template'


Q2. Cannot read /usr/local/www/cgi-bin/openwebmail/etc/lang! (No such file or directory)
A2:
mkdir /usr/local/www
ln -s /srv/www/cgi-bin /usr/local/www/
ln -s /srv/www/htdocs /usr/local/www/data


Q3./srv/www/cgi-bin/openwebmail/openwebmail.pl must be setuid to root to read the mail spools


vi /srvl/www/cgi-bin/openwebmail/etc/defaults/suid.conf 


have_savedsuid_support no

chmod 4555 /usr/bin/perl 

 之後,登入後就一切正常了。 


 Q4.


vi openwebmail-prefs.pl  line 1794


#sort => $sort,


--


# vi /etc/apache2/default-server.conf
================================================
Alias /openwebmail "/srv/www/htdocs/openwebmail"
ScriptAlias /webmail "/srv/www/cgi-bin/openwebmail/openwebmail.pl"
ScriptAlias /mail "/srv/www/cgi-bin/openwebmail/openwebmail.pl"
================================================


# rcapache2 restart