hustoj是一個開源ACM平臺,配置它是爲了創建自己的ACM測試平臺。
配置方法:
一:安裝所需軟件
1、安裝mysql
sudo apt-get install mysql-server mysql-client
如果顯示找不到軟件,需要更新source.list。我用的是北京交通大學的:
deb http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-backports main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-proposed main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-security main multiverse restricted universe
deb-src http://mirror.bjtu.edu.cn/ubuntu/ precise-updates main multiverse restricted universe
將souces.list清空,然後把上面的地址全部複製到sources.list中,保存。然後執行
sudo apt-get update
在安裝mysql時會讓你輸入數據庫用戶名和密碼,記住輸入的,例如用戶名:root, 密碼:root
2、安裝apache2
sudo apt-get install apache2
這裏要說明一下的就是 ubuntu 下的 apache 默認網頁執行文件夾在 /var/www/ 下面,配置文件在/etc/apache2/apache2.conf,配置文件子目錄在 /etc/apache2/ 下
進入火狐瀏覽器,鍵入 http://localhost ,出現It works!代表安裝成功
3、安裝 php
繼續輸入 apt-get install php5 libapache2-mod-php5確認安裝即可
重啓 apache ,輸入 /etc/init.d/apache2restart
打開編輯器,
添加內容 <?php phpinfo();?> 保存即可,保存目錄爲/var/www/info.php
進入火狐瀏覽器,鍵入 http://localhost/info.php ,出現 php 屬性頁面代表安裝成功
4、安裝php5-mysql和 libapache2-mod-auth-mysql
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
我之前配置hustoj時,配置完成後,打開網頁顯示空白。我開啓錯誤顯示,顯示mysql-pconnect()函數未定義,我認爲是php沒有連接到mysql,查閱資料,原來需要安裝php5-mysql。很重要。
5、安裝JudgeOnline
首先記得在/var/www/ 下新建一個html文件夾
然後
sudo apt-get update
sudo apt-get install subversion //安裝版本控制系統,爲了使用SVN命令獲得JudgeOnline源碼
sudo svn co https://github.com/zhblue/hustoj/trunk/trunk/install hustoj //獲得hustoj源碼 cd hustoj
sudo bash install-interactive.sh
//自動配置hustoj腳本 此時要求輸入數據庫用戶名和密碼,即上面安裝mysql時設置的用戶名,密碼。 這樣便全部結束。在瀏覽器中打開http://127.0.0.1/html/JudgeOnline/,即可看到如下頁面。