mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 08:18:41 +00:00
feat(install/bundle): add install script PHP7 and Ubuntu 16.04 support
In order to support PHP7 and Ubuntu 16.04, there must be some changes to make it runs properly. The install script added php7 and mysql 5.7, newer v8js packages and supports, adjusted some config files. Also used new way to detect install args, and change tab to 4-char-long space char. BREAKING CHANGE: This branch can only be used for PHP7, and Ubuntu 14.04 users shouln't execute this script.
This commit is contained in:
parent
2d0b0814fd
commit
163dd8bb30
@ -13,12 +13,12 @@ _svn_certroot_password_=$(genRandStr 32)
|
|||||||
getAptPackage(){
|
getAptPackage(){
|
||||||
echo -e "\n\n==> Getting environment packages"
|
echo -e "\n\n==> Getting environment packages"
|
||||||
#Set MySQL root password
|
#Set MySQL root password
|
||||||
debconf-set-selections <<< "mysql-server-5.7 mysql-server/root_password password $_database_password_" && debconf-set-selections <<< "mysql-server-5.7 mysql-server/root_password_again password $_database_password_"
|
debconf-set-selections <<< "mysql-server mysql-server/root_password password $_database_password_" && debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $_database_password_"
|
||||||
#Update apt sources and install
|
#Update apt sources and install
|
||||||
apt-get update -y
|
echo "deb http://ppa.launchpad.net/pinepain/libv8/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/pinepain-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C60AA4
|
||||||
apt install -y vim ntp zip unzip curl wget subversion apache2 mysql-server mysql-client php libapache2-mod-php7.0 php7.0-mysql cmake fp-compiler re2c libv8-dev libyaml-dev python python3 python-requests
|
apt-get update -y && apt-get install -y vim ntp zip unzip curl wget subversion apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql mysql-server cmake fp-compiler re2c libv8-6.6-dev libyaml-dev python python3 python-requests
|
||||||
#Install PHP extensions
|
#Install PHP extensions
|
||||||
echo -e "\n\n" | pecl install v8js-0.1.3 yaml-1.3.1
|
cp -a /opt/libv8*/* /usr && echo -e "\n\n" | pecl install v8js yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
getOracleJDK(){
|
getOracleJDK(){
|
||||||
@ -43,7 +43,7 @@ setLAMPConf(){
|
|||||||
cat >/etc/apache2/sites-available/000-uoj.conf <<UOJEOF
|
cat >/etc/apache2/sites-available/000-uoj.conf <<UOJEOF
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
#ServerName local_uoj.ac
|
#ServerName local_uoj.ac
|
||||||
ServerAdmin vfleaking@163.com
|
ServerAdmin opensource@uoj.ac
|
||||||
DocumentRoot /var/www/uoj
|
DocumentRoot /var/www/uoj
|
||||||
|
|
||||||
#LogLevel info ssl:warn
|
#LogLevel info ssl:warn
|
||||||
@ -60,11 +60,20 @@ UOJEOF
|
|||||||
a2ensite 000-uoj.conf && a2dissite 000-default.conf
|
a2ensite 000-uoj.conf && a2dissite 000-default.conf
|
||||||
a2enmod rewrite headers && sed -i -e '166s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
a2enmod rewrite headers && sed -i -e '166s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||||
#Create UOJ session save dir and make PHP extensions available
|
#Create UOJ session save dir and make PHP extensions available
|
||||||
mkdir --mode=733 /var/lib/php5/uoj && chmod +t /var/lib/php5/uoj
|
mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions
|
||||||
sed -i -e '866a\extension=v8js.so\nextension=yaml.so' /etc/php5/apache2/php.ini
|
sed -i -e 's/session.save_path \/var\/lib\/php5\/uoj/session.save_path \/var\/lib\/php\/uoj_sessions/g' ../../uoj/1/.htaccess
|
||||||
|
sed -i -e '876a\extension=v8js.so\nextension=yaml.so' /etc/php/7.0/apache2/php.ini
|
||||||
#Set MySQL user directory and connection config
|
#Set MySQL user directory and connection config
|
||||||
usermod -d /var/lib/mysql/ mysql
|
usermod -d /var/lib/mysql/ mysql
|
||||||
sed -i -e "108a\init_connect='SET collation_connection = utf8_unicode_ci'\ninit_connect='SET NAMES utf8'\ncharacter-set-server=utf8\ncollation-server=utf8_unicode_ci\nskip-character-set-client-handshake" -e "117a\default-character-set=utf8" /etc/mysql/my.cnf
|
cat >/etc/mysql/mysql.conf.d/uoj_mysqld.cnf <<UOJEOF
|
||||||
|
[mysqld]
|
||||||
|
character-set-server=utf8
|
||||||
|
collation-server=utf8_unicode_ci
|
||||||
|
init_connect='SET NAMES utf8'
|
||||||
|
init_connect='SET collation_connection = utf8_unicode_ci'
|
||||||
|
skip-character-set-client-handshake
|
||||||
|
sql-mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
||||||
|
UOJEOF
|
||||||
}
|
}
|
||||||
|
|
||||||
setSVNServe(){
|
setSVNServe(){
|
||||||
@ -228,18 +237,7 @@ endUpProgress(){
|
|||||||
echo -e "\n\n***Installation complete. Enjoy!***"
|
echo -e "\n\n***Installation complete. Enjoy!***"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" == "-e" ] ;then
|
if [ $# -le 0 ] ;then
|
||||||
echo 'Setting UOJ System bundle environment...'
|
|
||||||
getAptPackage
|
|
||||||
getOracleJDK
|
|
||||||
setLAMPConf
|
|
||||||
elif [ "$1" == "-c" ] ;then
|
|
||||||
echo 'Configuring UOJ System bundle...'
|
|
||||||
setSVNServe
|
|
||||||
setWebConf
|
|
||||||
setJudgeConf
|
|
||||||
endUpProgress
|
|
||||||
else
|
|
||||||
echo 'Installing UOJ System bundle...'
|
echo 'Installing UOJ System bundle...'
|
||||||
getAptPackage
|
getAptPackage
|
||||||
getOracleJDK
|
getOracleJDK
|
||||||
@ -249,3 +247,30 @@ else
|
|||||||
setJudgeConf
|
setJudgeConf
|
||||||
endUpProgress
|
endUpProgress
|
||||||
fi
|
fi
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-e)
|
||||||
|
;&
|
||||||
|
--environment)
|
||||||
|
echo 'Setting UOJ System bundle environment...'
|
||||||
|
getAptPackage
|
||||||
|
getOracleJDK
|
||||||
|
setLAMPConf
|
||||||
|
;;
|
||||||
|
-c)
|
||||||
|
;&
|
||||||
|
--config)
|
||||||
|
echo 'Configuring UOJ System bundle...'
|
||||||
|
setSVNServe
|
||||||
|
setWebConf
|
||||||
|
setJudgeConf
|
||||||
|
endUpProgress
|
||||||
|
;;
|
||||||
|
-?)
|
||||||
|
;&
|
||||||
|
--*)
|
||||||
|
echo "Illegal option $1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift $(( $#>0?1:0 ))
|
||||||
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user