Build a Hustoj competition platform under the server under ubuntu 14|15 with multiple question banks and problem analysis

This article is regarded as a collection of posts. I refer to the blog posts of many great gods. Now I will make a summary. Mainly learn from Liu Xin’s blog posts

table of Contents:

1 : General construction method##

1. Install mysql

apt-get install mysql-server mysql-client

**2. Install **apache2

apt-get install apache2

What I want to explain here is that the apache default webpage execution folder under ubuntu is under /var/www/, the configuration file is under /etc/apache2/apache2.conf, and the configuration file subdirectory is under /etc/apache2/

Enter the browser, type http://localhost, or 127.0.0.1 It works! Means successful installation

**3. Install **php

apt-get install php5 libapache2-mod-php5

Restart apache, enter /etc/init.d/apache2 restart

Check the effect

/var/www/html/info.php

Enter the Firefox browser, type http://localhost/info.php, the php property page appears, which means the installation is successful

4. You can also install onlinejudge (ubuntu14.04 i386) for pro-test 15

Execute the following command

sudo apt-get update

sudo apt-get install subversion

sudo svn co https://github.com/zhblue/hustoj/trunk/trunk/install hustoj

cd hustoj

sudo bash install-interactive.sh

If something goes wrong later, you can reinstall from here

Enter the browser, type http://localhost/JudgeOnline, and the JudgeOnline page appears, which means the installation is successful. For other related questions, see http://code.google.com/p/hustoj/wiki/FAQ

Install pascal and java compiler

After hustoj is installed, it can only judge c and c++ code by default

sudo apt-get install fpc openjdk-6-jdk

2 Frequent Questions##

2.1 Administrator rights###

The first step is to register an account on the built website

Step 2 Enter mysql -u root -p in the console, press Enter and enter the password to enter mysql

The third step is to enter show databases; view all databases

The fourth step is to enter use jol; (hustoj user database) After entering, you can select * from users; to view the user table

The fifth step is to enter insert into privilege(user_id, rightstr) values('root','administrator');

If your account is called lalalal, you only need to change the account part to replace root,

So your account has administrator rights. . . . The point is to choose the right database... and you need to reopen the website and log in to your account again.

2.2 Question bank import###

Here is a database file, which is a little big and about 700+ questions are enough. The first one is recommended first, and the second one is spare

After downloading the first file, unzip it. Get the xml file. Import as shown below. There will be a size limit at the beginning

2.3 Modify php.ini to increase upload space.

Vim php.ini in the /etc/php5/apache2 directory

Modify post_max_size = 380M and upload_max_filesize = 300M

About 600 lines and 800 lines

2.4 phpmyadmin visual management database###

First install: sudo apt-get install phpmyadmin

Establish a target connection between phpmyadmin and apache2, www directory is in /var/www, phpmyadmin is in /usr/share/phpmyadmin directory,

So just use the command: sudo ln -s /usr/share/phpmyadmin /var/www/html to establish a connection. 【important】

2.5 Always in a sentence###

After you finish, log in to OJ and submit the question, and the question is always PENGIND. If you also appear, the solution is as follows

The judgment program judged needs to be started with the root account, please restart the server or execute sudojudged manually. If it does not work, please check the database account configuration in /home/judge/etc/judge.conf, and change the root password and admin password to your own settings.

Refer to Configuration, restart the server again after correction or execute sudo pkill-9 judged and wait a while and execute sudo judged

Re-enter the website after success, that's it

2.6 Set the root path of the apache server website (OJ can be accessed via IP after setting)

  1. Enter the directory /etc/apache2/sites-aviliable/

Open the two files in the directory (default or something), and add judgeonline after documentroot

  1. Then restart apache2: terminal input

/etc/init.d/apache2 restart This should be OK.

Under the terminal ipconfig or ifconfig, find the IP address of the machine, just enter the IP in the browser in the LAN, you can log in to OJ

3 : hustoj configuration file (change to Chinese and modify theme)

Learn from: http://blog.csdn.net/zhblue/article/details/7366194

/home/judge/etc/judge.conf

/var/www/html/JudgeOnline/include/db_info.inc.php

Change the blue border color: /var/www/html/JudgeOnline/template/bs/image

Restart apache, enter /etc/init.d/apache2 restart

judge.conf  /home/judge/etc/judge.conf

OJ_HOST_NAME=127.0.0.1 If you use mysql connection to read the database, the host address of the database
OJ_USER_NAME=root database account
OJ_PASSWORD=root database password
OJ_DB_NAME=jol database name
OJ_PORT_NUMBER=3306 database port
OJ_RUNNING=4 judged will start judge_Client judges questions, here it is stipulated to run several judges at most at the same time_client  
OJ_SLEEP_TIME=5 Judged discovers new tasks by polling the database, the rest time between polling, in seconds
OJ_TOTAL=1 The total number of judged in old-style concurrent processing
OJ_MOD=0 In the old-fashioned concurrent processing, this judged is responsible for the solution_ID is a task whose remainder is after taking the modulus of TOTAL.
OJ_JAVA_TIME_BONUS=2 The extra runtime obtained by virtual machine languages such as Java.
OJ_JAVA_MEMORY_BONUS=512 Additional memory obtained by virtual machine languages such as Java.
OJ_SIM_ENABLE=0Whether to use sim for code similarity detection
OJ_HTTP_JUDGE=0 Whether to use HTTP to connect to the database, if enabled, the previous HOST_Settings such as NAME are ignored.
OJ_HTTP_BASEURL=http://127.0.0.1/The base address of JudgeOnline to connect to the database using HTTP is the homepage address of OJ.
OJ_HTTP_USERNAME=admin The user account used by HTTP (HTTP_JUDGE permission), the VCODE graphic verification code cannot be enabled when the account is logged in, but it can be enabled after successful login.
OJ_HTTP_PASSWORD=admin password
OJ_OI_MODE=0 Whether the OI mode is enabled, that is, the remaining data will continue to be judged regardless of whether there is an error, and the operation will stop once an error occurs in the ACM game.
OJ_SHM_RUN=0 whether to use/dev/The shared memory virtual disk of shm runs the answer, if it is enabled, it can improve the speed of judging questions, but it requires more memory.
OJ_USE_MAX_TIME=1 Whether to use the largest running time among all test data as the final running time, if not enabled, the total time of all test data is used as the basis for timeout judgment.

db_info.inc.php  /var/www/html/JudgeOnline/include/db_info.inc.php

db_info.inc.php  
  
static  $DB_HOST="localhost";Server address of the database
static  $DB_NAME="jol";data storage name
static  $DB_USER="root";database username
static  $DB_PASS="root";Database password
  // connect db   static  $OJ_NAME="HUSTOJ";The name of OJ will replace HUSTOJ in the title of the page.
static  $OJ_HOME="./";OJ's homepage address
static  $OJ_ADMIN="root@localhost";Administrator email
static  $OJ_DATA="/home/judge/data";The directory and actual location of the test data.
static  $OJ_BBS="discuss";//"bbs"The form of the forum, discuss is a simple forum that comes with it, bbs is a plug-in forum, refer to bbs.php code. static$OJ_ONLINE=false;Whether to use online monitoring, it needs to consume a certain amount of memory and calculations, so if the concurrency is large, it is recommended to close
< span style="color: #ff0000;">static  $OJ_LANG="en";The default language, Chinese is cn
static  $OJ_SIM=true;Whether to display the result of similarity detection.
static  $OJ_DICT=true;Whether to enable online English dictionary</span><span style="color: #ff0000;">static  $OJ_TEMPLATE="sae"</span>Modify topic name.The theme directory is under template
static  $OJ_LANGMASK=1008;//1mC 2mCPP 4mPascal 8mJava 16mRuby 32mBash 1008 for security reason to mask all other language The submission language accepted by OJ represented by the mask can be overridden by the competition settings. static$OJ_EDITE_AREA=true;//Whether to enable the submission interface of highlighted syntax display, online programming is possible without IDE. static$OJ_AUTO_SHARE=false;//true:Share the code automatically. If you enable it, you can see other people&#39;s answers in the Status of the question if you make a question. static$OJ_CSS="hoj.css";Default css,You can choose dark.css and gcode.css,Has a limited interface formulation effect.
static  $OJ_SAE=false;//Whether to run the static part of the web on Sina&#39;s cloud platform$OJ_VCODE=true;Whether to enable graphical login and registration verification code.
static  $OJ_APPENDCODE=false;Whether to enable automatic code addition, if enabled, it will be referred to when submitting$OJ_Whether there is append in the corresponding directory of DATA.For files of c type, some code will be appended to the answer in the corresponding language. The main function can be specified cleverly and students are required to write the function called by the main part.
static  $OJ_MEMCACHE=false;Whether to use memcache as page cache, if not enabled, use/cache directory
static  $OJ_MEMSERVER="127.0.0.1";memcached server address
static  $OJ_MEMPORT=11211;memcached port

Appendix: Reference blog post

reference

http://blog.csdn.net/chaoshenyutou/article/details/40183965

https://github.com/zhblue/hustoj

Build the oj environment:

http://blog.csdn.net/chaoshenyutou/article/details/18950909

How to use, install mysql command

http://www.cnblogs.com/zhuyp1015/p/3561470.html

Configuration file

http://blog.csdn.net/zhblue/article/details/7366194

What steps will reproduce the problem?

  1. Install Ubuntu 14.04 LTS (64bit) ?
  2. Install Ubuntu 14.04 LTS (64bit)
  3. Submit a C/C++ code
  4. Submit C/C++ program (#include<stdio.h> Then only scanf and printf are the most common A+B =_=
  5. Get Runtime Error:[ERROR] A Not allowed system call: runid:8674 called:89
  6. Then it was RE, and the call number was 89. Although I don't know what it readdir does, it is called.

What is the expected output? What do you see instead?
Accepted ;-), but get Runtime Error:[ERROR] A Not allowed system call: runid:8674 called:89

What version of the product are you using? On what operating system?
Ubuntu 14.04 LTS (64bit), gcc (Ubuntu 4.8.2-17ubuntu1) 4.8.2, HUSTOJ core lastest svn (the last svn version)
Ubuntu 14.04 LTS 32bit not tested. Errors may occur =w= (32bit is not tested, but it is estimated that there may be problems)

Please provide any additional information below.
add 89 with HOJ_MAX_LIMIT in okcalls.h and problem solved.
Then I added 89 and HOJ_MAX_LIMIT to okcalls.h.

***Original article, please indicate: ** Reprinted from *URl-team

The link address of this article:Build a Hustoj competition platform under the server under ubuntu 14|15 with multiple question banks and problem analysis

Related posts:

  1. [ Solve .htaccess: Invalid command'RewriteEngine', problem](https://www.urlteam.cn/2016/04/%e8%a7%a3%e5%86%b3-htaccess-invalid-command-rewriteengine%e9% 97%ae%e9%a2%98/)

Recommended Posts

Build a Hustoj competition platform under the server under ubuntu 14|15 with multiple question banks and problem analysis
Build a file server on ubuntu
Build the C++ compilation environment under ubuntu
Build a python development environment under Ubuntu
DLNA/UPnP Server installation and configuration under Ubuntu 12.04
Build a Minecraft Bedrock Edition server (Ubuntu)