Detail es0EN14.04 Build (migration) hustoj record

  • 2020-08-22 23:21:20
  • OfStack

After entering the system to update the system, I personally prefer the vim editor, so First download the vim editor.


sudo apt-get update
sudo apt-get install vim # The editor   Personal preference 
sudo apt-get install openssh-server # Remote connection tool 

Change domestic download source:


###### Ali Yunyuan: 
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

###### University of Science and Technology of China source: 
deb http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe 
deb http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe 
deb http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe 
deb http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe 
deb http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe 
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty main multiverse restricted universe 
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-backports main multiverse restricted universe 
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-proposed main multiverse restricted universe 
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-security main multiverse restricted universe 
deb-src http://debian.ustc.edu.cn/ubuntu/ trusty-updates main multiverse restricted universe

###### Tsinghua source :
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse 
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse 
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty main restricted universe multiverse 
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-security main restricted universe multiverse 
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-updates main restricted universe multiverse 
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-backports main restricted universe multiverse 
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ trusty-proposed main restricted universe multiverse

Modify download source:


sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # The backup 
sudo vim /etc/apt/sources.list # Modify the 
sudo apt-get update # Update the list 

Since the desktop version of ubuntu14.04 is installed, here is an uninstall of almost unused software:


sudo apt-get remove --purge libreoffice* 
sudo apt-get remove unity-webapps-common 
sudo apt-get remove thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku landscape-client-ui-install 
sudo apt-get remove onboard deja-dup 

So the system is a little bit cleaner.

Installation script (since I am porting the original project and adopting nginx environment, the script is adapted from The script of Mr. Zhang Haobin) :


# Package all existing items into judge.tar Inside the file 
#judge The following are: data etc JudgeOnline log run0 run1 run2 run3 
#!/bin/bash
DBUSER=root
DBPASS=root
printf "Input Database(MySQL) Username:"
read tmp
if test -n "$tmp"
then
  DBUSER="$tmp"
fi
printf "Input Database(MySQL) Password:"
read tmp
if test -n "$tmp"
then
  DBPASS="$tmp"
fi
# Unzip the files 
tar -xvf judge.tar
# Update the source 
sudo apt-get install update
# Compile environment 
sudo apt-get install mono-mcs subversion 
sudo apt-get install make flex g++ clang libmysqlclient-dev libmysql++-dev
#java And other compilation environment download 
sudo apt-get install ruby2.0 -y
sudo apt-get install fpc -y
sudo apt-get install openjdk-7-jdk -y
sudo apt-get install perl -y
sudo apt-get install mono-gmcs -y
#LNMP The environment 
sudo apt-get install nginx mysql-server php5-fpm php5-mysql php5-gd php-xml-* php-cli php-mbstring redis-server php-redis
sudo mkdir /JudgeOnline
sudo cp -r ./judge/JudgeOnline/* /JudgeOnline
sudo chown -R www-data /JudgeOnline
sudo chmod -R 711 /JudgeOnline
sudo mysql -h localhost -u$DBUSER -p$DBPASS < ./jol.sql
# restart nginx
sudo service php5-fpm restart 

sudo service nginx restart
# Take out the judged Source files are compiled for installation 
sudo svn checkout https://github.com/zhblue/hustoj/trunk/trunk hustoj-read-only
cd hustoj-read-only/core/
sudo ./make.sh
cd ../..
# create judge User and root directory 
sudo /usr/sbin/useradd -m -u 1536 judge
# Copy file to judge The home directory   It depends on your situation 
sudo cp -r ./hustoj /home/judge
# Change folder permissions 
sudo chown -R www-data /home/judge
sudo chown -R root /home/judge/log /home/judge/etc /home/judge/run?
sudo chmod 711 /home/judge /home/judge/data
sudo chgrp judge /home/judge/run?
sudo chmod 771 /home/judge/run?
sudo chmod -R 000 /home/judge/etc

Then modify the /etc/nginx/ sites-ES27en /default file.


sudo vim /etc/nginx/sites-available/default 

The original server module is modified as follows:


server{

  listen 80 ;
  listen [::]:80 ipv6only=on;

  root /JudgeOnline;
  index index.php index.html index.htm;

  server_name localhost;

  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;

  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

Restart nginx:


sudo service nginx restart 

Log in to the hustoj background for database updates. And then try a problem, and if there are no problems, you're done.


Related articles: