close

1.安裝 CentOS 5.5 (可以安裝最基本的,相關程後面手動安裝)

============================================


2.
安裝Web Server
    yum -y install httpd mod_ssl
    vi /etc/httpd/conf/httpd.conf

    390 DirectoryIndex index.html index.html.var 修改成--> DirectoryIndex index.html index.htm index.php index.html.var
    730 LanguagePriority zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN

    746 AddDefaultCharset UTF-8 修改成--> #AddDefaultCharset UTF-8

最後加上 Alias /upfiles/ "/var/www/html/sfs3/data/"
                   <Directory "/var/www/html/sfs3/data">
                    AllowOverride None
                    Options None
                    Order allow,deny
                    Allow from all
                    </Directory>

    /etc/init.d/httpd start
    chkconfig --levle 35 httpd on   #
開機啟動

=====================================================

 

 3.PHP、MySQL
   yum -y install php mysql mysql-server php-mysql php-gd php-mbstring
   vi /etc/php.ini
   312 max_execution_time =
300
   313行 max_input_time =
600
   314行 memory_limit = 160M    #
加大一點,免得將來印成績單的時候無法列印全班
   477行 post_max_size =
80M
   582行
upload_max_filesize = 20M
  
vi /etc/httpd/conf.d/php.conf
   18
DirectoryIndex index.php 修改成--> #
DirectoryIndex index.php
   /etc/init.d/httpd restart  #
修改完php.ini後記得得重跑
apache
   /etc/init.d/mysqld start #起動 mysql
   chkconfig --level 35 mysqld on
   設定mysql 的root 密碼(用phpmyadmin 也可以)
   >mysql -u root
   mysql>use mysql;
   mysql>UPDATE user SET password=password('AbCdEfG') WHERE user='root';

 

   mysql>FLUSH PRIVILEGES;  #完成後就可離開Mysql

 

 

 ========================================================


4.下載安裝sfs3主程式
   cd /var/www/html
   wget
http://sfscvs.tcc.edu.tw/sfs_stable.tar.gz 
   tar -zxcf sfs_stabele.tar.gz
   chmod a+x setup.sh
  ./setup.sh  
#先用預設帳號 1001/demo登入 到學務統內晃一晃

 

========================================================

5.將/var/lib/mysql/sfs3/ 內的資料清空
將資料庫備份到新server
  舊>mysqldump -u root -p -h localhost sfs3 --opt >sfs3.sql
#以上使用 --opt 指令是包含了 DROP 與 CREATE 指令,以確保之後的資料庫能夠完整的還原。
 新>mysql -u root -p -h localhost sfs3 <sfs3.sql
#如果有錯誤訊息的話 , 先把sql檔裡 前幾行的版本資訊砍掉再試試

PS :
對時

yum -y install ntp
crontab -e
0 0-23 * * * root /usr/sbin/ntpdate watch.stdtime.gov.tw > /dev/null 2>&1
#
老舊機器更需要這個,要當SERVER
的話,時間的準確性很重要的。
=======================================================
自動更新
SFS3
cd /
vi upsfs3.php
#!/usr/bin/php
<?php
//sfs3
安裝目錄

$SFS_INSTALL_PATH="/var/www/html/sfs3";

$SFS_TEMP_DIR="/tmp/sfs3_stable";

if (is_dir($SFS_TEMP_DIR)) {
exec("rm -rf ".$SFS_TEMP_DIR);
}

if (file_exists("/tmp/sfs_stable.tar.gz")) {
exec("rm -f /tmp/sfs_stable.tar.gz");
}

if (!is_dir($SFS_INSTALL_PATH)) {
echo "Oh! Error! .... File *** sfs3 *** not exists! ";
echo "Please run ./setup.sh first! ";
exit;
}

$SFS_TAR_FILE="http://sfscvs.tcc.edu.tw/sfs_stable.tar.gz";

exec("wget -q ".$SFS_TAR_FILE." --directory-prefix=/tmp");
exec("tar zxf /tmp/sfs_stable.tar.gz -C /tmp");
exec("cp -a ".$SFS_TEMP_DIR."/* ".$SFS_INSTALL_PATH);

include $SFS_INSTALL_PATH."/sfs-release.php";

echo "Update to ".$SFS_BUILD_DATE." ";
?>
chmod 700 upsfs3.php
寫入排程  >crontab -e
0 0-23 * * * root /upsfs3.php

===========================
系統語系

為了往後用putty進行遠端維護的方便,所以建議更改語系。
(
預設為UTF-8,建議改成BIG-5)
/etc/sysconfig/i18n
LANG="zh_TW.UTF-8" => zh_TW.BIG5
================================
backup.sh
# vi sfs3_backup.sh

tar czvf /home/sfs3_backup/"sfs3_data_"`date +%y-%m-%d`.tar.gz /var/lib/mysql/sfs3

tar czvf /home/sfs3_backup/"sfs3_www_"`date +%y-%m-%d`.tar.gz /var/www/html/sfs3

mysqldump --default-character-set=latin1 -uroot -pxoxoxo sfs3 > /home/sfs3_backup/"sfs3_"`date +%y-%m-%d`.sql

=========================================

結論 : 資料庫的部份搞了很久 因為 3.2 轉到 5.X版 直接CP 不行 , dump 沒有--opt 也有問題 , 這部份完成其他其實沒什麼大問題!

同一時間 發現在學校在跟我做一樣的事 , 過程也很詳細 =>http://163.17.90.135/plog/post/2/64

=========================================================

arrow
arrow
    全站熱搜

    jason0324 發表在 痞客邦 留言(6) 人氣()