Each machine in the school data center requires an account to access the Internet. However, the account is only available to teachers, which leads to insufficient Internet accounts in the data center. Therefore, we plan to build a VirtualJudge on an Ubuntu server in the data center. Other students can submit questions by using an account to connect to the Internet. Because I do not understand JSP. The configuration environment is abnormal. I also consulted Isun several times during the configuration process. Thank you very much! The following describes how to set up and configure my environment: environment requirements: JDK7 + Maven3 + Tom
Each machine in the school data center requires an account to access the Internet. However, the account is only available to teachers, which leads to insufficient Internet accounts in the data center. Therefore, we plan to build a Virtual Judge on an Ubuntu server in the data center. Other students can submit questions by using an account to connect to the Internet. Because I do not understand JSP. The configuration environment is abnormal. I also consulted Isun several times during the configuration process. Thank you very much!
The following describes how to set up and configure my environment:
Environment requirements:
JDK7 + Maven3 + Tomcat7 + Redis + MySql5
The following files need to be downloaded ):
1. Create a table 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
I. Download JDK, address: https://jdk7.java.net/download.html login system choose 32-bit or 64-bit tar.gz File Download
After the download is complete, run the unzip command in the current directory of the file:
Tar xzvf filename
Put the decompressed directory to the corresponding location. Here I put it in the/usr/lib/jvm/directory.
Sudo mv jdk1.7.0 _ 80/usr/lib/jvm/
Configure Environment Variables
Sudo export JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 80
2. Download Redis, decompress it, compile and install it.
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/
Sudo make
Sudo make install
Configure Redis to start automatically. Create a user for Redis and create a new data and log folder.
Set Automatic startup and automatic shutdown. And start Redis-server.
Wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-serve
Wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
Sudo mv redis-server/etc/init. d/redis-server
Sudo chmod + x/etc/init. d/redis-server
Sudo mv redis. conf/etc/redis. conf
Sudo useradd redis
Sudo mkdir-p/var/lib/redis
Sudo mkdir-p/var/log/redis
Sudo chown redis. redis/var/lib/redis
Sudo chown redis. redis/var/log/redis
Sudo update-rc.d redis-server defaults
Sudo/etc/init. d/redis-server start
3. Download Maven3, address: http://maven.apache.org/download.cgi
In the corresponding directory, configure the Maven environment variable.
Export M2_HOME =/usr/local/apache-maven-3.2.3
Export M2 = $ M2_HOME/bin
Export PATH = M2: $ PATH
Go to conf In the Maven directory and open settings. xml.
Find After this section, add the following code.
Nexus-osc
*
Nexus osc
Http://maven.oschina.net/content/groups/public/
4. install Tomcat 7. MySql can directly use apt-get In ubuntu.
Tomcat7 will be installed under the/var/lib/tomcat7/directory.
Sudo apt-get install tomcat7-y
Sudo apt-get install mysql-y
5. Go to the root directory of Virtual Judge (directory with pom. xml) and use Maven to package Virtual Judge.
Mvn clean package
A target folder will be generated under this Directory, which contains a. war file, which is the Virtual Judge we have packaged. Copy the war file to the webapps directory of tomcat.
Later, webapps will create a folder with the same name as the war file, and then put remote_accounts.json and http_client.json in the corresponding directory.
Add the submission account of each OJ to remote_accounts.json. If you do not need a proxy or VPN to access some OJ, you only need to keep the ["direct"] in http_client.json.
Then change the remote_accounts.json and http_client.json location information for config. properties under the/webapps/vjudge/WEB-INF/classes/directory. Is an absolute path ..
Create a new database named vhoj and import the table creation SQL statement.
Mysql-u root-p
Create database vhoj;
Exit;
Mysql-h localhost-u root-p vhoj </*. SQL
6. Restart Tomcat 7.
/Etc/init. d/tomcat7 restart
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-09/123240.htm