- Update your system
sudo apt update && \
sudo apt upgrade -y && \
sudo apt dist-upgrade -y
- Install git
- Clone this repo
sudo git clone https://github.com/WangYihang/SniperOJ.git /var/www/
- Install dependencies
sudo apt install apache2
sudo apt install php7.0
sudo apt install php7.0-gd
sudo apt install php7.0-mysqli
sudo apt install libapache2-mod-php7.0
sudo apt install mysql-server
- Configurations of php
phpenmod gd
a2enmod rewrite
- Configurations of apache2
<Directory /var/www/>
SetEnv CI_ENV production
Options FollowSymLinks
AllowOverride ALL
Require all granted
</Directory>
- Create folder to store captcha
mkdir /var/www/html/assets/captcha
chmod o+w /var/www/html/assets/captcha
- Create database in MySQL
create database SniperOJ;
- Import database
mysql -u root -p -D SniperOJ < database.sql
- Config database.php
cd /var/www/application/config/
cp database.php.example database.php
修改 :
username
password
database
- Config SMTP service
1. cp email.php.example email.php
2. change these variables
$smtp_host
$smtp_port
$smtp_user
$smtp_pass
3.vi /var/www/application/controllers/User.php
search this string '[email protected]'
replace it to your email addres
- Restart MySQL and Apache
service mysql restart
service apache2 restart