OS:ubuntu server 32bit 14.04
接下來就是安裝HUST OJ了。
1.換源,因為是校園網的環境,所以,中科大的源不錯,阿裡雲的源在校園裡也很牛,但是感覺中科大的更勝一籌,如果我在家裡那就不用說了肯定是阿裡的。
先備份,再修改,最後更新。。。
更新源後,必須更新軟件,不然,安裝hustoj可能會出錯!
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo vim /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-security main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse
sudo apt-get update sudo apt-get upgrade
sudo apt-get install gcc g++ openjdk-7-jdk apache2 mysql-server mysql-client subversion libmysqlclient-dev php5 libapache2-mod-php5 make flex3.修改mysql的默認字符集(上次沒有更改,好像也能用,不過不好管理,最後也改了)。
sudo vim /etc/mysql/my.cnf
character-set-server = utf8 collation-server = utf8_general_ci在裡面的[client]下,加入下面的語句:
default-character-set = utf8然後重啟mysql服務
sudo /etc/init.d/mysql restart想要查看的話,可以打開mysql,輸入一下指令:
show variables like 'char%';如果出現這樣就OK了:
+--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+也可以編寫一個小例子:
create database test; use test create table test(value varchar(20)); insert test VALUES("你好,世界"); select * from test;效果圖:
+---------------+ | value | +---------------+ | 你好,世界 | +---------------+4.修改APACHE2的配置文檔
sudo vim /etc/apache2/sites-enabled/000-default.conf修改地方:
DocumentRoot /var/www5.下載hustoj的源代碼
sudo svn co https://github.com/zhblue/hustoj/trunk/trunk/install hustoj6.安裝hustoj
cd hustoj/ sudo bash install-interactive.sh cd /var/www sudo mv JudgeOnline/ ../
OK,到此為止,就全部安裝成功了。可以,遠程打開看一看。網址:http://地址/JudgeOnline
接下來是一些設置上面的問題,下次再說!