16/11/14
修改了一下源(Tsinghua Tuna):
<code>
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bk
sudo vi /etc/apt/sources.list
</code>
内容如下:
<code>
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
</code>
<code>
sudo apt-get update
</code>
sudo apt-get upgrate报错:
<code>
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-34 linux-headers-4.4.0-34-generic linux-image-4.4.0-34-generic
linux-image-extra-4.4.0-34-generic linux-signed-image-4.4.0-34-generic
Use 'sudo apt autoremove' to remove them.
</code>
解决:
<code>
sudo apt-get autoremove
</code>
继续执行
<code>
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
</code>
报错:AH00558: apache2: Could not reliably determine the server's fully qualified domaiage
解决:
<code>
sudo vi /etc/apache2/apache2.conf
最后加入一句 ServerName localhost:80
</code>
继续执行
<code>
sudo apt-get install subversion
sudo svn co https://github.com/zhblue/hustoj/trunk/trunk/install hustoj
cd hustoj
sudo bash install-interactive.sh
</code>
测试用,配置了MySQL
Database(MySQL)
Username: kiraioj
Password: xwd
访问localhost:80/JudgeOnline报错:Could not connect: Access denied for user 'root'@'localhost' (using password: NO)
解决:
<code>
重新确认DB_USER和DB_PASS发现若账户不存在脚本不自动生成新用户并赋权,所以手工新建新用户并赋权。
mysql -uroot -p
insert into mysql.user(host,user,password)
values("localhost","kiraioj",password("xwd"));
create database kiraiojDB;
grant all privileges on kiraiojDB.* to kiraioj@localhost identified by 'xwd';
bash install-interactive.sh
填入参数kiraiojDB,密码xwd
cd /var/www/html/JudgeOnline/include
vi db_info.inc.php
修改
static $DB_NAME="kiraiojDB";
static $DB_USER="kiraioj";
static $DB_PASS="xwd";
</code>
访问localhost/JudgeOnline成功
链接:http://123.207.173.126/JudgeOnline/problemset.php
后来发现这样手工修改数据库的名字是不行的,因为脚本中建立数据库和建表的脚本hustoj/hustoj-read-only/install/db.sql中默认数据库叫jol,想修改的话可以直接改这里。遇到此前的问题是因为运行安装脚本的时候数据库的帐号权限不够,读了一下install-interactive.sh发现它要帐号干的事是登录数据库,这一点我傻B了,哈哈。
解决方法有很多,我选择重新赋权后再重新运行脚本,输入上述帐号密码建表。
<code>
grant all privileges on . to kiraioj@localhost identified by 'xwd';
</code>
添加管理员帐号
<code>
use jol;
insert into privilege(user_id,rightstr) values('kirai','administrator');
</code>
添加语言支持:
目前就先这几个吧
sudo apt-get install gcc g++ fpc openjdk-7-jdk ruby2.0 bash python php5 libapache2-mod-php5 perl mono-gmcs lua5.2 -y