未加星标

详解ubuntu14.04搭建(迁移)hustoj记录

字体大小 | |
[运维安全 所属分类 运维安全 | 发布者 店小二03 | 时间 | 作者 红领巾 ] 0人收藏点击收藏

进入系统之后更新系统,个人比较喜欢vim编辑器,所以首先下载vim编辑器。

sudo apt-get update
sudo apt-get install vim #编辑器 看个人喜好
sudo apt-get install openssh-server #远程连接工具

更改国内下载源:

######阿里云源:
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

######中科大源:
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

######清华源:
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

修改下载源:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #备份
sudo vim /etc/apt/sources.list #修改
sudo apt-get update #更新列表

由于安装的桌面版本的ubuntu14.04,这里卸载掉几乎不用的软件:

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

这样系统就比较干净了。

安装脚本(由于我这是将原有的项目移植并采用nginx环境,脚本根据张浩斌老师的脚本改编):

#将原有的项目都打包到judge.tar文件里面
#judge下面有: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
#解压文件
tar -xvf judge.tar
#更新源
sudo apt-get install update
#编译环境
sudo apt-get install mono-mcs subversion
sudo apt-get install make flex g++ clang libmysqlclient-dev libmysql++-dev
#java等其他编译环境下载
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环境
sudo apt-get install nginx mysql-serverphp5-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
#重启nginx
sudo service php5-fpm restart
sudo service nginx restart
#取出judged源文件编译安装
sudo svn checkout https://github.com/zhblue/hustoj/trunk/trunk hustoj-read-only
cd hustoj-read-only/core/
sudo ./make.sh
cd ../..
#创建judge用户以及根目录
sudo /usr/sbin/useradd -m -u 1536 judge
#拷贝文件到judge家目录下 这个根据自己情况
sudo cp -r ./hustoj /home/judge
#更改文件夹权限
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

然后修改 /etc/nginx/sites-available/default 文件。

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

将原有的server模块修改如下:

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;
}
}

 重启nginx:

sudo service nginx restart
登录hustoj后台进行数据库更新。然后做个题试试,如若没有问题就大功告成了。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。


您可能感兴趣的文章:腾讯云Ubuntu14.04安装Tomcat8教程Ubuntu14.04 安装配置Tomcat7教程详解Ubuntu14.04桥接网络设置与SSH登陆Ubuntu14.04虚拟机安装(图文详解)Ubuntu14.04搭建Caffe(仅CPU)详解教程Ubuntu14.04安装pycharm的步骤ubuntu14.04LTS安装nginx+mariaDB+php7+YAF的方法ubuntu14.04 使用中遇到的问题及解决方法集锦ubuntu14.04+docker的安装及使用

本文运维安全相关术语:linux服务器代维 linux服务器搭建 运维管理 运维工程师 企业安全文章 企业安全管理 cf安全系统检测到游戏数据异常

主题: UbuntuSQLMySQLTomcatCPU阿里云DBU数据清华腾讯
tags: main,restricted,http,trusty,ubuntu,universe,sudo,deb,mirrors,edu,apt,multiverse,cn,get,src
分页:12
转载请注明
本文标题:详解ubuntu14.04搭建(迁移)hustoj记录
本站链接:http://www.codesec.net/view/574765.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 运维安全 | 评论(0) | 阅读(24)