First of all, this version hustoj is a skin and improved for https://code.google.com/p/hustoj/. So the you can migrate the old version web to this version without any big chance.

This guide is not a deep tutorial for beginner, the base step for os and backend you should reference the old version of hustoj.

MySQL

  1. run the origin hustoj db script Origin Database of Hustoj
  2. run the db alter script database changed
set names utf8;
create database judge;
use judge; CREATE TABLE `compileinfo` (
`solution_id` int(11) NOT NULL DEFAULT '0',
`error` text,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `contest` (
`contest_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) DEFAULT NULL,
`start_time` datetime DEFAULT NULL,
`end_time` datetime DEFAULT NULL,
`defunct` char(1) NOT NULL DEFAULT 'N',
`description` text,
`private` tinyint(4) NOT NULL DEFAULT '0',
`langmask` int NOT NULL DEFAULT '0' COMMENT 'bits for LANG to mask',
PRIMARY KEY (`contest_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; CREATE TABLE `contest_problem` (
`problem_id` int(11) NOT NULL DEFAULT '0',
`contest_id` int(11) DEFAULT NULL,
`title` char(200) NOT NULL DEFAULT '',
`num` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `loginlog` (
`user_id` varchar(48) NOT NULL DEFAULT '',
`password` varchar(40) DEFAULT NULL,
`ip` varchar(100) DEFAULT NULL,
`time` datetime DEFAULT NULL,
KEY `user_log_index` (`user_id`,`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `mail` (
`mail_id` int(11) NOT NULL AUTO_INCREMENT,
`to_user` varchar(48) NOT NULL DEFAULT '',
`from_user` varchar(48) NOT NULL DEFAULT '',
`title` varchar(200) NOT NULL DEFAULT '',
`content` text,
`new_mail` tinyint(1) NOT NULL DEFAULT '1',
`reply` tinyint(4) DEFAULT '0',
`in_date` datetime DEFAULT NULL,
`defunct` char(1) NOT NULL DEFAULT 'N',
PRIMARY KEY (`mail_id`),
KEY `uid` (`to_user`)
) ENGINE=MyISAM AUTO_INCREMENT=1013 DEFAULT CHARSET=utf8; CREATE TABLE `news` (
`news_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` varchar(48) NOT NULL DEFAULT '',
`title` varchar(200) NOT NULL DEFAULT '',
`content` text NOT NULL,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`importance` tinyint(4) NOT NULL DEFAULT '0',
`defunct` char(1) NOT NULL DEFAULT 'N',
PRIMARY KEY (`news_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1004 DEFAULT CHARSET=utf8; CREATE TABLE `privilege` (
`user_id` char(48) NOT NULL DEFAULT '',
`rightstr` char(30) NOT NULL DEFAULT '',
`defunct` char(1) NOT NULL DEFAULT 'N'
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `problem` (
`problem_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL DEFAULT '',
`description` text,
`input` text,
`output` text,
`sample_input` text,
`sample_output` text,
`spj` char(1) NOT NULL DEFAULT '0',
`hint` text,
`source` varchar(100) DEFAULT NULL,
`in_date` datetime DEFAULT NULL,
`time_limit` int(11) NOT NULL DEFAULT '0',
`memory_limit` int(11) NOT NULL DEFAULT '0',
`defunct` char(1) NOT NULL DEFAULT 'N',
`accepted` int(11) DEFAULT '0',
`submit` int(11) DEFAULT '0',
`solved` int(11) DEFAULT '0',
PRIMARY KEY (`problem_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; CREATE TABLE `reply` (
`rid` int(11) NOT NULL AUTO_INCREMENT,
`author_id` varchar(48) NOT NULL,
`time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`content` text NOT NULL,
`topic_id` int(11) NOT NULL,
`status` int(2) NOT NULL DEFAULT '0',
`ip` varchar(30) NOT NULL,
PRIMARY KEY (`rid`),
KEY `author_id` (`author_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `sim` (
`s_id` int(11) NOT NULL,
`sim_s_id` int(11) DEFAULT NULL,
`sim` int(11) DEFAULT NULL,
PRIMARY KEY (`s_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `solution` (
`solution_id` int(11) NOT NULL AUTO_INCREMENT,
`problem_id` int(11) NOT NULL DEFAULT '0',
`user_id` char(48) NOT NULL,
`time` int(11) NOT NULL DEFAULT '0',
`memory` int(11) NOT NULL DEFAULT '0',
`in_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`result` smallint(6) NOT NULL DEFAULT '0',
`language` INT UNSIGNED NOT NULL DEFAULT '0',
`ip` char(15) NOT NULL,
`contest_id` int(11) DEFAULT NULL,
`valid` tinyint(4) NOT NULL DEFAULT '1',
`num` tinyint(4) NOT NULL DEFAULT '-1',
`code_length` int(11) NOT NULL DEFAULT '0',
`judgetime` datetime DEFAULT NULL,
`pass_rate` DECIMAL(2,2) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`solution_id`),
KEY `uid` (`user_id`),
KEY `pid` (`problem_id`),
KEY `res` (`result`),
KEY `cid` (`contest_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8; CREATE TABLE `source_code` (
`solution_id` int(11) NOT NULL,
`source` text NOT NULL,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `topic` (
`tid` int(11) NOT NULL AUTO_INCREMENT,
`title` varbinary(60) NOT NULL,
`status` int(2) NOT NULL DEFAULT '0',
`top_level` int(2) NOT NULL DEFAULT '0',
`cid` int(11) DEFAULT NULL,
`pid` int(11) NOT NULL,
`author_id` varchar(48) NOT NULL,
PRIMARY KEY (`tid`),
KEY `cid` (`cid`,`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `users` (
`user_id` varchar(48) NOT NULL DEFAULT '',
`email` varchar(100) DEFAULT NULL,
`submit` int(11) DEFAULT '0',
`solved` int(11) DEFAULT '0',
`defunct` char(1) NOT NULL DEFAULT 'N',
`ip` varchar(20) NOT NULL DEFAULT '',
`accesstime` datetime DEFAULT NULL,
`volume` int(11) NOT NULL DEFAULT '1',
`language` int(11) NOT NULL DEFAULT '1',
`password` varchar(32) DEFAULT NULL,
`reg_time` datetime DEFAULT NULL,
`nick` varchar(100) NOT NULL DEFAULT '',
`school` varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `online` (
`hash` varchar(32) collate utf8_unicode_ci NOT NULL,
`ip` varchar(20) character set utf8 NOT NULL default '',
`ua` varchar(255) character set utf8 NOT NULL default '',
`refer` varchar(255) collate utf8_unicode_ci default NULL,
`lastmove` int(10) NOT NULL,
`firsttime` int(10) default NULL,
`uri` varchar(255) collate utf8_unicode_ci default NULL,
PRIMARY KEY (`hash`),
UNIQUE KEY `hash` (`hash`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE `runtimeinfo` (
`solution_id` int(11) NOT NULL DEFAULT '0',
`error` text,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `custominput` (
`solution_id` int(11) NOT NULL DEFAULT '0',
`input_text` text,
PRIMARY KEY (`solution_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

datavase changed:

# support language
ALTER TABLE users ADD locale CHAR(7) NULL;
# support user theme
ALTER TABLE users ADD theme CHAR(30) NULL; # add option table
CREATE TABLE `options` (
`option_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL DEFAULT '',
`desc` varchar(128) NOT NULL DEFAULT '',
`value` varchar(128) NOT NULL DEFAULT '',
PRIMARY KEY (`option_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; INSERT INTO `options` (`option_id`, `name`, `desc`, `value`)
VALUES
(2, 'ga_code', 'Google Analytics Code', 'UA-YOURCODE-1');

Web

  1. git clone https://github.com/freefcw/hustoj.git into the code to your webdocs
  2. follow the configure guide. notice, the old extension of mysql for php is deprecated, so you need use MySQLi, or PDO

configuren guide:

the config file is locate applicaiton/config directory

  1. cp production/database.sample.php to production/database.php, set your database information

  2. cp base.sample.php to base.php, set domain and base_url, domain should not contain the port

problems:

 skys215 commented on 2 Aug 2014

When wil the Installation sction will be updated?
I downloaded it, but I cannot install. Regards,
@freefcw
Owner
freefcw commented on 5 Aug 2014 I will do it when I have enough time, you can install use the old judge database from google code
@dotkrnl
Collaborator
dotkrnl commented on 5 Aug 2014 With an installed Google Code version HUSTOJ. See hints in https://github.com/freefcw/hustoj/wiki/database-changed and https://github.com/freefcw/hustoj/wiki/configure . This project just refactored the front-end.
@skys215
skys215 commented on 6 Aug 2014 I did as you guys said, But it remains "出错了,请联系 freefcw#gmail".
@skys215
skys215 commented on 6 Aug 2014 I got the 500 Http Response and
this error message: Database_Exception [ 8192 ]: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
@freefcw
Owner
freefcw commented on 6 Aug 2014 please choose mysqli or pdo in database.php. the mysql driver is deprecated in the newest php version
@skys215
skys215 commented on 6 Aug 2014 Yes, it solved the problem.
But there's annother problem:
When I click the links on the navbar, it get an 404 error. (eg.http://127.0.0.1:8889/problem/list)
But when I add index.php in the url, then it's ok.(eg. http://127.0.0.1:8889/index.php/problem/list)
Is it my Apache Configuration's problem? Update:
It was my Apache Configuration's problem, AllowOverride was set to None.
It works perfect after changed it to All and restarting the Apache. Thanks for the help!
@skys215
skys215 commented on 10 Aug 2014 HustOJ works well at my localhost, but there's an error running on my vps.
ErrorException [ Fatal Error ]: Call to undefined function __()
SYSPATH/classes/Kohana/Kohana/Exception.php [ 53 ] It seems that I18n.php didn't load propperly. Update:
One of my friend who is familiar with Kohana said, I need to give permissions to the application/cache/ and application/logs/ after that, the problem is solved.
@freefcw
Owner
freefcw commented on 11 Aug 2014 yes, you should che the owner of the webdocs, chmod -R www-data:www-data DIR
@skys215
skys215 commented on 11 Aug 2014 After asking a net-friend, he said that the judging system is not in this repository.
This repository is just another web interface of the judging system. So I checkout the judge system which is in SVN, and did the sudo bash install/install-interactive.sh.
This time, I can open the online judge, I can add problem, submit code and judge the code on localhost. But when I did the same thing on my vps, it seems that it can create the Problem-Id directory in the /home/judge/data, I don't know why. If I create the directory manualy, then the code could be accepted.
@qhpeklh5959
qhpeklh5959 commented on 28 Oct 2014 I've configed the database and permission of the dictionary, but I get "出错了,请联系 freefcw#gmail". I wonder if I've made some mistake??
@freefcw
Owner
freefcw commented on 29 Oct 2014 please check the error log for the detail
@qhpeklh5959
qhpeklh5959 commented on 29 Oct 2014 2014-10-29 09:03:05 --- DEBUG: #0 /var/www/hustoj/system/classes/Kohana/Request.php(986): Kohana_HTTP_Exception::factory(404, 'Unable to find ...', Array)
#1 /var/www/hustoj/index.php(105): Kohana_Request->execute()
#2 {main} in /var/www/hustoj/system/classes/Kohana/Request.php:98 How to fix it?
@freefcw
Owner
freefcw commented on 29 Oct 2014 The imformation is hide the most important, please give me the whole log. Seems route set has some problem in route, did u installed in subdirectory?
@jcf94
jcf94 commented on 26 Apr 2015 I think I get a same error like qhpeklh5959 do ..... Here is my log: 2015-04-26 16:20:42 --- EMERGENCY: HTTP_Exception_404 [ 404 ]: The requested URL hustoj was not found on this server. ~ SYSPATH/classes/Kohana/HTTP/Exception.php [ 19 ] in /var/www/html/hustoj/system/classes/Kohana/Request/Client/Internal.php:79
2015-04-26 16:20:42 --- DEBUG: #0 /var/www/html/hustoj/system/classes/Kohana/Request/Client/Internal.php(79): Kohana_HTTP_Exception::factory(404, 'The requested U...', Array)
#1 /var/www/html/hustoj/system/classes/Kohana/Request/Client.php(114): Kohana_Request_Client_Internal->execute_request(Object(Request), Object(Response))
#2 /var/www/html/hustoj/system/classes/Kohana/Request.php(997): Kohana_Request_Client->execute(Object(Request))
#3 /var/www/html/hustoj/index.php(105): Kohana_Request->execute()
#4 {main} in /var/www/html/hustoj/system/classes/Kohana/Request/Client/Internal.php:79
@Foxprodev
Foxprodev commented on 21 May 2015 Same error. What should i do?
@freefcw
Owner
freefcw commented on 24 May 2015 @xff252595680 @Foxprodev Please show me your nginx or apache site config file
@Foxprodev
Foxprodev commented on 25 May 2015 @freefcw Already fixed it, AllowOverride in this directory.
But how to fix http://stackoverflow.com/questions/4624726/http-error-302-using-uploadify?
In firefox, safari, os x browsers.

注意:

如果加了.htaccess文件出现500错误,有可能 没有开启rewrite模块

后来查到这是因为Php没有开启rewrite模块而无法重定向

启用 Mod_rewrite 模块:

sudo a2enmod rewrite

Admin

  1. open the site and register a user as the master admin.
  2. run the sql script insert into privilege(user_id,rightstr) values('admin','administrator'); admin is the username of your registered

freefcw/hustoj Install Guide的更多相关文章

  1. Win10 Theano Install Guide

    basic install guide 1. download miniconda 2. conda install libpython mingw 3. conda install theano n ...

  2. Fedora 25/24/23 nVidia Drivers Install Guide

    https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/ search Most Popular Featured Linux ...

  3. Install guide for OpenLDAP and GOsa 2 on Ubuntu & Debian

    First we will install OpenLDAP by running the command as root: apt-get install slapd ldap-utils ldap ...

  4. Isilon OneFS Simulator Install Guide

    Isilon build for storage data Use VMware converter to convert node1 to ESX(参考silon_OneFS_Simulator_I ...

  5. csvn install guide

    一. make sure java install $ java -version $ echo $JAVA_HOME 二. untar tgz file $ tar xf CollabNetSubv ...

  6. [原]Chef_Server and Chef_WorkStation and Chef_Client Install Guide[by haibo]

    一.Prerequisite OS  :  CentOS-7.0-1406-x86_64-DVD.iso Time Server :   NTP Server SERVER NAME IP PLAN ...

  7. kubernetes Auto Install Guide

    1.概念&架构 Kubernetes is an open-source system for automating deployment, scaling, and management o ...

  8. HOWTO install Oracle 11g on Ubuntu Linux 12.04 (Precise Pangolin) 64bits

    安装了Ubuntu 12.04 64bit, 想在上面安装Oracle 11gr2,网上找了好多文档都没成功,最后完全参考了MordicusEtCubitus的文章. 成功安装的关键点:install ...

  9. Install Asterisk 11 on Ubuntu 12.04 LTS

    http://blogs.digium.com/2012/11/14/how-to-install-asterisk-11-on-ubuntu-12-4-lts/ Last week I put up ...

随机推荐

  1. sass的嵌套

    sass的嵌套包括两种: 1.选择器的嵌套.(最常用到) 指的是在一个选择器中嵌套另一个选择器来实现继承,从而增强了sass文件的结构性和可读性. 在选择器嵌套中,可以使用&表示父元素选择器 ...

  2. JS 原型总结

    参考: (从内存角度)简单类型与复杂类型及原型链

  3. [HDU6326]Monster Hunter(贪心)

    用(a,b)表示一个点先失去a点HP,然后增加b点HP 首先容易证明忽略父亲条件下,任意两个点,先吃b大的最优 对于一个节点v和它的父节点u,若此时选v最优,那么就是吃到u时可以立即吃掉v, 于是可以 ...

  4. Java 数字用二进制表示,以及原码,反码,补码、负数的二进制表示

    首先我们要对原码.反码和补码有个了解: 1.所谓原码就是二进制定点表示法,即最高位为符号位,"0"表示正,"1"表示负,其余位表示数值的大小. 2.反码表示法规 ...

  5. ORB-SLAM(五)KeyFrameDataBase类

    关键帧数据库通过预先训练好的词典,维护一个向量std::vector<list<KeyFrame*> > mvInvertedFile; 该向量中mvInvertedFile[ ...

  6. Java 快速排序讲解

    快速排序由于排序效率在同为 O(nlogn) 的几种排序方法中效率最高,因此经常被采用.再加上快速排序思想——分治法也确实非常实用,所以 在各大厂的面试习题中,快排总是最耀眼的那个.要是你会的排序算法 ...

  7. leetcode笔记11 First Unique Character in a String

    题目描述: Given a string, find the first non-repeating character in it and return it's index. If it does ...

  8. Omad群组部署、依赖部署一键解决

    本文来自网易云社区 作者:李培斌 前言 基于omad部署平台实现一键部署的实践已有很多成功的经验,杭研QA的技术先锋们也在ks圈里有很多不同的文章去阐述关于这类需求的实现和思路,当然包括我们金融事业部 ...

  9. Python内嵌函数与Lambda表达式

    //2018.10.29 内嵌函数与lambda 表达式 1.如果在内嵌函数中需要改变全局变量的时候需要用到global语句对于变 量进行一定的说明与定义 2.内部的嵌套函数不可以直接在外部进行访问 ...

  10. [CF19B]Checkout Assistant

    题目描述 Bob 来到一家现购自运商店,将 n 件商品放入了他的手推车,然后到收银台 付款.每件商品由它的价格 pi 和收银员扫描它的时间 ti 秒定义.当收银员正在扫 描某件商品时,Bob 可以从他 ...