Ubuntu 14.04 Virtual Judge Construction

Source: Internet
Author: User

Ubuntu 14.04

Virtual Judge the construction

The layout of the blog may not be very good, you can download the PDF of this article: Ubuntu 14.04Virtual Judge building

I am an ACM weak dish, because training team need,

We decided to set up our own Onlinejudge and virtual Judge, so we started to build a nightmare.

OJ construction, very smooth, the reference is Ubuntu Server 12.04 build hustoj This blog

Write very well, others do not say, if there is a need to build their own school OJ friends, can refer to,

The main thing is to set up lamp, and nothing else.

Vjudge, I met quite a lot of problems, because the knowledge of JSP is not enough,

I can only continue to find information and solutions on the Internet,

Helpless, flooding a large number of blog posts, the information is quite miscellaneous, the boutique is quite small,

Most are reproduced to reprint, the same content is not nutritious,

The construction of the vjudge aspect of the blog is scarce, so the construction is very not smooth, for two consecutive days I have not been able to build up,

Finally, with the help of JCF, finally solved a variety of problems, successfully built a virtual Judge.

(Strong spit: I can say that I was packing the war file when the 0.2MB file switched to cause me to toss the whole two days).

Collected on the Internet, found a well-written article Virtual Judge environment construction and configuration,

Without this article, I can not afford to build virtual Judge, we may refer to.

In addition, here also found the original author's simple tutorial How to deploy your own Vjudge,

For the students who are familiar with Linux, it is enough to build up virtual Judge.

But for those of you who are unfamiliar with Linux and JSPs, this article may be too simple,

However, I can no longer find a better reference post or document,

So, decided to spend a little time to complete the vacancy, this article was born.

I am not, the cultivation is shallow, if you have any questions, suggestions or comments, very welcome to discuss together.

Contact information:

Email:[email protected]

blog:http://www.cnblogs.com/bigballon/

1. Pre-preparation work 1.1 a Linux system

Because of the live race, I have been using Ubontu.

Here I test with ubuntu14.04 Desktop, of course, the choice of server will be better, this see how you choose.

Installation of the system is no longer mentioned, as a server please select the server version.

1.2 Update source

Before setting up the environment, make sure that your source is valid and that the speed is power,

Recommended to select a domestic source 14.04 LTS Update source

sudo gedit/etc/apt/sources.list overwrite and save the original source

Last execute sudo apt-get update source

1.3 Necessary Document preparation

We need to download these files (some links need fq to access):

1. *.sql Https://gist.github.com/trcnkq/a3cf7004759d41d79eb7

2. Http_client.json https://gist.github.com/trcnkq/7a5deff639ff99475138

3. Remote_accounts.json https://gist.github.com/trcnkq/e9dac7eea72d2b781949

4. Virtual Judge source file Https://github.com/trcnkq/virtual-judge

If you are unable to FQ, please use my alternate link: vjudge Build

2. Installation and configuration of 2.1 jdk for necessary environment

First you need to download the JDK, address: https://jdk7.java.net/download.html

Note whether the system is 32-bit or 64-bit

1.) Unzip the downloaded file

TAR-XZVF jdk1.7.0_80

2.) Move the folder to the specified directory

sudo mkdir/usr/lib/jvmsudo mv jdk1.7.0_80//usr/lib/jvm/

3.) Set Environment variables

sudo gedit/etc/profile

At the end of the document, add the following:

Export Java_home=/usr/lib/jvm/jdk1.7.0_80export Jre_home=${java_home}/jreexport classpath=.:${java_home}/lib:${ Jre_home}/libexport Path=${java_home}/bin: $PATH

4.) make the changes effective:

sudo source/etc/profile

At this time java–version view the current JDK version in the terminal input

At this point, the JDK configuration is complete

2.2 Redis Installation and configuration

1.) Download and install Redis:

wget http://download.redis.io/releases/redis-2.8.9.tar.gz tar xvzf redis-2.8.9.tar.gz cd Redis-2.8.9/makesudo make Install  

2.) Configure the init script:

3.) Initialize user and log path

Before starting Redis for the first time, it is recommended that you create a separate user for Redis and create a new data and log folder

sudo useradd redissudo mkdir-p/var/lib/redissudo mkdir-p/var/log/redissudo chown Redis.redis/var/lib/redissudo chown Redis.redis/var/log/redis

4.) set power on auto start, shut down automatically

UPDATE-RC.D redis-server Defaults

5.) start Redis:

/etc/init.d/redis-server start

Installation and configuration of the 2.3 Maven3

1.) install Maven3 via apt-get

After ubuntu12.04, you can use Apt-get directly to obtain

sudo apt-get install maven-y

After installation, go to sudo su and go to root with mvn–v to see Maven's version, such as:

When the installation is complete, the default JDK version may be changed.

Because the Maven3 installs the OPENJDK also installs simultaneously.

2.) Modify the system default JDK

Update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk1.7.0_80/bin/java 300update-alternatives--install/ Usr/bin/javac Javac/usr/lib/jvm/jdk1.7.0_80/bin/javac 300update-alternatives--config javaupdate-alternatives-- Config Javac

View again with Java-version, JDK version changed

Installation and configuration of the 2.4 Tomcat7

1.) apt-get installation tomcat7:

sudo apt-get install tomcat7-y  

TOMCAT7 default will be installed under directory/var/lib/tomcat7/, after installation, enter localhost:8080 in the browser to see if the installation is successful if it appears

2.) install tomcat7-admin

After installation, we also need to install a tomcat7-admin

sudo apt-get install Tomcat7-admin

3.) Modify the account:

After installation, we enter the TOMCAT7 conf directory to modify the Tomcat-users.xml file

I use it here.

<role rolename= "Manager-gui"/><role rolename= "Admin-gui"/><user username= "Tomcat" password= "Tomcat" roles= "Manager-gui,admin-gui"/>

4.) restart Tomcat:

SUDO/ETC/INIT.D/TOMCAT7 restart

Re-open the Tomcat interface in the browser

Click on Manager webapp to log in with the user we created just now

5.) Modify the JDK default jdk version

Check the TOMCAT7 Server information, the version may not be our own JDK version.

Here we want to modify the JDK version that Tomcat uses, This step is important , otherwise there will be a lot of problems

sudo gedit/etc/default/tomcat7

Add the following content:

Java_home=/usr/lib/jvm/jdk1.7.0_80

Restart again TOMCAT7 :

SUDO/ETC/INIT.D/TOMCAT7 restart

OK, the JDK version of TOMCAT7 has been modified.

2.5 MySQL Installation
sudo apt-get install mysql-server-y

The installation process will require you to enter the database password, here I directly use 123456, two consecutive input.

Go to the database and test it.

Mysql-u root-p

If you see it after entering your password, it indicates that MySQL installed successfully:

Look at the existing database and then exit, and this part ends

at this point, build Virtual Judge all the required environments have been built!

3. Engineering Code Implementation

Prepare four files, which is the first download of the four:

3.1 Vjudge's packaging

Enter the Virtual-judge-master directory:

CD virtual-judge-master/

Use Maven to package Virtual Judge:

MVN Clean Package  

There will be a Vjudge.war file, which is the Virtual Judge that we have finished packing.

Copy this war file to Tomcat7 's WebApps directory.

(The packaging process can be quite long, especially if the network is bad, in case of a swap,

Very egg ache, if you do not want to wait too long, you can download this file directly, network disk)

When placed in the WebApps directory, a Vjudge folder is automatically generated and, if not generated, you can unzip it yourself.

3.2 Editing of Remote_accounts.json files

Add each OJ's submission account to the Remote_accounts.json.

3.3 Editing of config.properties files

If you do not need a proxy or VPN access to foreign OJ, keep Http_client.json inside the ["direct"] can.

Simple deployment of 3.4 Vjudge

Put the Remote_accounts.json and Http_client.json two files under the specified folder

I'll put it in the/var/lib/tomcat7/webapps/vjudge/directory.

sudo mv Http_client.json/var/lib/tomcat7/webapps/vjudge/sudo MV remote_accounts.json/var/lib/tomcat7/webapps/ vjudge/

Change the/webapps/vjudge/web-inf/classes/directory under Config.properties file

Change the absolute path of Remote_accounts.json and Http_client.json to the correct path

Cd/var/lib/tomcat7/webapps/vjudge/web-inf/classes/sudo gedit config.properties

PS: If your database password is not 123456 , then the above Root password you also need to modify, default to 123456

Establishment of 3.5 Vhoj database

Create a new database in MySQL with the name: Vhoj,

and import the table Vhoj_20141109.sql (maybe my version is slightly older).

Mysql-h localhost-u root-p Vhoj < Vhoj_20141109.sql  

Finally, restart Tomcat7, enter the manager to see application, you can see Vjudge is already in running state.

4. Vjudge
Enter Localhost:8080/vjudge in the Address bar and enter the Vjudge to build successfully:

To this end, Virtual Judge finally build success, just enjoy it!

Ubuntu 14.04 Virtual Judge Construction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.