--- doc/install/linux/install.pl 2021/03/18 22:00:54 1.45.2.13 +++ doc/install/linux/install.pl 2021/03/28 22:10:35 1.45.2.15 @@ -76,7 +76,7 @@ if (!open(LOG,">>loncapa_install.log")) &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.45.2.13 2021/03/18 22:00:54 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.45.2.15 2021/03/28 22:10:35 raeburn Exp $'."\n"; } # @@ -469,7 +469,7 @@ sub check_required { } $mysqlon = &check_mysql_running($distro); if ($mysqlon) { - ($mysqlsetup,$has_pass,$dbh,$mysql_has_wwwuser,$mysql_unix_socket) = + ($mysqlsetup,$has_pass,$dbh,$mysql_has_wwwuser,$mysql_unix_socket) = &check_mysql_setup($instdir,$dsn,$distro); if ($mysqlsetup eq 'needsrestart') { $mysqlrestart = ''; @@ -799,13 +799,13 @@ sub uses_firewalld { } if ($checkfirewalld) { my ($loaded,$active); - if (open(PIPE,"systemctl status firewalld |")) { + if (open(PIPE,"systemctl status firewalld 2>/dev/null |")) { while () { chomp(); if (/^\s*Loaded:\s+(\w+)/) { $loaded = $1; } - if (/^\s*Active\s+(\w+)/) { + if (/^\s*Active:\s+(\w+)/) { $active = $1; } } @@ -1163,7 +1163,7 @@ sub check_mysql_setup { my $sth = $dbh->prepare("SELECT Priv FROM mysql.global_priv WHERE (User = 'root' AND Host ='localhost')"); $sth->execute(); while (my $priv = $sth->fetchrow_array) { - if ($priv =~ /unix_socket/) { + if ($priv =~ /unix_socket/) { $mysql_unix_socket = 1; last; } @@ -1195,7 +1195,7 @@ sub check_mysql_setup { $mysql_has_wwwuser = &check_mysql_wwwuser($dbh); return ($mysqlsetup,$has_pass,$dbh,$mysql_has_wwwuser,$mysql_unix_socket); } - } + } } elsif ($DBI::err =~ /1045/) { $has_pass = 1; } elsif ($distro =~ /^ubuntu(\d+)$/) { @@ -1668,7 +1668,7 @@ if ($callsub{'pwauth'}) { if ($callsub{'mysql'}) { if ($dbh) { &setup_mysql($callsub{'mysqlperms'},$dbh,$has_pass, - $mysql_unix_socket,$has_lcdb); + $mysql_unix_socket,$has_lcdb,$distro); } else { print &mt('Unable to configure MySQL because access is denied.')."\n"; } @@ -1855,7 +1855,7 @@ if ($callsub{'download'}) { print "\n".&mt('Requested configuration complete.')."\n\n"; if ($have_tarball && !$updateshown) { my ($lcdir) = ($sourcetarball =~ /^([\w.\-]+)\.tar.gz$/); - my ($apachename,$lc_uses_systemctl,$uses_sudo); + my ($apachename,$lc_uses_systemctl,$uses_sudo); if ($distro =~ /^(suse|sles|debian|ubuntu)([\d.]+)/) { if (($1 eq 'suse') && ($2 < 10)) { $apachename = 'apache'; @@ -2103,10 +2103,20 @@ sub kill_extra_services { } sub setup_mysql { - my ($setup_mysql_permissions,$dbh,$has_pass,$mysql_unix_socket,$has_lcdb) = @_; + my ($setup_mysql_permissions,$dbh,$has_pass,$mysql_unix_socket,$has_lcdb,$distro) = @_; my @mysql_lc_commands; unless ($has_lcdb) { - push(@mysql_lc_commands,"CREATE DATABASE loncapa"); + my $createcmd = 'CREATE DATABASE loncapa'; + if ($distro =~ /^sles(\d+)/) { + if ($1 > 11) { + $createcmd .= ' CHARACTER SET utf8 COLLATE utf8_general_ci'; + } + } elsif ($distro =~ /^ubuntu(\d+)/) { + if ($1 > 16) { + $createcmd .= ' CHARACTER SET latin1 COLLATE latin1_swedish_ci'; + } + } + push(@mysql_lc_commands,$createcmd); } push(@mysql_lc_commands,"USE loncapa"); push(@mysql_lc_commands,qq{ @@ -2152,7 +2162,8 @@ sub setup_mysql_permissions { if ($usescreate) { @mysql_commands = ("CREATE USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); } elsif ($usesauth) { - @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')"); + @mysql_commands = ("INSERT user (Host, User, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www','','','','')", + "FLUSH PRIVILEGES"); if ($is_mariadb) { push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); } else {