version 1.51, 2019/02/19 19:14:54
|
version 1.67, 2020/07/08 17:19:10
|
Line 166 sub get_user_selection {
|
Line 166 sub get_user_selection {
|
sub get_distro { |
sub get_distro { |
my ($distro,$gotprereqs,$updatecmd,$packagecmd,$installnow,$unknown); |
my ($distro,$gotprereqs,$updatecmd,$packagecmd,$installnow,$unknown); |
$packagecmd = '/bin/rpm -q LONCAPA-prerequisites '; |
$packagecmd = '/bin/rpm -q LONCAPA-prerequisites '; |
if (-e '/etc/redhat-release') { |
if (-e '/etc/oracle-release') { |
|
open(IN,'</etc/oracle-release'); |
|
my $versionstring=<IN>; |
|
chomp($versionstring); |
|
close(IN); |
|
if ($versionstring =~ /^Oracle Linux Server release (\d+)/) { |
|
my $version = $1; |
|
$distro = 'oracle'.$1; |
|
$updatecmd = 'yum install LONCAPA-prerequisites'; |
|
$installnow = 'yum -y install LONCAPA-prerequisites'; |
|
} |
|
} elsif (-e '/etc/redhat-release') { |
open(IN,'</etc/redhat-release'); |
open(IN,'</etc/redhat-release'); |
my $versionstring=<IN>; |
my $versionstring=<IN>; |
chomp($versionstring); |
chomp($versionstring); |
Line 196 sub get_distro {
|
Line 207 sub get_distro {
|
$distro = 'rhes'.$1; |
$distro = 'rhes'.$1; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$installnow = 'yum -y install LONCAPA-prerequisites'; |
$installnow = 'yum -y install LONCAPA-prerequisites'; |
|
} elsif ($versionstring =~ /Red Hat Enterprise Linux release (\d+)/) { |
|
$distro = 'rhes'.$1; |
|
$updatecmd = 'dnf install LONCAPA-prerequisites'; |
|
$installnow = 'dnf -y install LONCAPA-prerequisites'; |
} elsif ($versionstring =~ /CentOS(?:| Linux) release (\d+)/) { |
} elsif ($versionstring =~ /CentOS(?:| Linux) release (\d+)/) { |
$distro = 'centos'.$1; |
$distro = 'centos'.$1; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
$updatecmd = 'yum install LONCAPA-prerequisites'; |
Line 308 sub get_distro {
|
Line 323 sub get_distro {
|
$unknown = 1; |
$unknown = 1; |
} |
} |
} else { |
} else { |
print &mt('Unknown installation: expecting a debian, ubuntu, suse, sles, redhat, fedora or scientific linux system.')."\n"; |
print &mt('Unknown installation: expecting a debian, ubuntu, suse, sles, redhat, fedora, scientific linux, or oracle linux system.')."\n"; |
} |
} |
} |
} |
return ($distro,$packagecmd,$updatecmd,$installnow); |
return ($distro,$packagecmd,$updatecmd,$installnow); |
Line 342 sub get_hostname {
|
Line 357 sub get_hostname {
|
} |
} |
|
|
# |
# |
# get_hostname() prompts the user to provide the server's IPv4 IP address |
# get_hostip() prompts the user to provide the server's IPv4 IP address |
# |
# |
# If invalid input is provided, the routine is called recursively |
# If invalid input is provided, the routine is called recursively |
# until, a valid IPv4 address is provided. |
# until, a valid IPv4 address is provided. |
Line 406 sub check_prerequisites {
|
Line 421 sub check_prerequisites {
|
|
|
sub check_locale { |
sub check_locale { |
my ($distro) = @_; |
my ($distro) = @_; |
my ($fh,$langvar,$command); |
my ($fh,$langvar,$command,$earlyout); |
$langvar = 'LANG'; |
$langvar = 'LANG'; |
if ($distro =~ /^(ubuntu|debian)/) { |
if ($distro =~ /^(ubuntu|debian)/) { |
if (!open($fh,"</etc/default/locale")) { |
if (!open($fh,"</etc/default/locale")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/default/locale'); |
'/etc/default/locale'); |
|
$earlyout = 1; |
} |
} |
} elsif ($distro =~ /^(suse|sles)(\d+)/) { |
} elsif ($distro =~ /^(suse|sles)(\d+)/) { |
if (($1 eq 'sles') && ($2 >= 15)) { |
if (($1 eq 'sles') && ($2 >= 15)) { |
if (!open($fh,"</etc/locale.conf")) { |
if (!open($fh,"</etc/locale.conf")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/locale.conf'); |
'/etc/locale.conf'); |
|
$earlyout = 1; |
} |
} |
} else { |
} else { |
if (!open($fh,"</etc/sysconfig/language")) { |
if (!open($fh,"</etc/sysconfig/language")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/sysconfig/language'); |
'/etc/sysconfig/language'); |
|
$earlyout = 1; |
} |
} |
$langvar = 'RC_LANG'; |
$langvar = 'RC_LANG'; |
} |
} |
Line 431 sub check_locale {
|
Line 449 sub check_locale {
|
if (!open($fh,"</etc/locale.conf")) { |
if (!open($fh,"</etc/locale.conf")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/locale.conf'); |
'/etc/locale.conf'); |
|
$earlyout = 1; |
} |
} |
} elsif (!open($fh,"</etc/sysconfig/i18n")) { |
} elsif (!open($fh,"</etc/sysconfig/i18n")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/sysconfig/i18n'); |
'/etc/sysconfig/i18n'); |
|
$earlyout = 1; |
} |
} |
} elsif ($distro =~ /^(?:rhes|centos|scientific)(\d+)/) { |
} elsif ($distro =~ /^(?:rhes|centos|scientific|oracle)(\d+)/) { |
if ($1 >= 7) { |
if ($1 >= 7) { |
if (!open($fh,"</etc/locale.conf")) { |
if (!open($fh,"</etc/locale.conf")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/locale.conf'); |
'/etc/locale.conf'); |
|
$earlyout = 1; |
} |
} |
} elsif (!open($fh,"</etc/sysconfig/i18n")) { |
} elsif (!open($fh,"</etc/sysconfig/i18n")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/sysconfig/i18n'); |
'/etc/sysconfig/i18n'); |
|
$earlyout = 1; |
} |
} |
} else { |
} else { |
if (!open($fh,"</etc/sysconfig/i18n")) { |
if (!open($fh,"</etc/sysconfig/i18n")) { |
print &mt('Failed to open: [_1], default locale not checked.', |
print &mt('Failed to open: [_1], default locale not checked.', |
'/etc/sysconfig/i18n'); |
'/etc/sysconfig/i18n'); |
|
$earlyout = 1; |
} |
} |
} |
} |
|
return if ($earlyout); |
my @data = <$fh>; |
my @data = <$fh>; |
chomp(@data); |
chomp(@data); |
foreach my $item (@data) { |
foreach my $item (@data) { |
Line 465 sub check_locale {
|
Line 489 sub check_locale {
|
$command = 'sudo locale-gen en_US.UTF-8'."\n". |
$command = 'sudo locale-gen en_US.UTF-8'."\n". |
'sudo update-locale LANG=en_US.UTF-8'; |
'sudo update-locale LANG=en_US.UTF-8'; |
} elsif ($distro =~ /^(suse|sles)/) { |
} elsif ($distro =~ /^(suse|sles)/) { |
$command = 'yast language'; |
$command = 'yast language'; |
} else { |
} elsif (-e '/usr/bin/system-config-language') { |
$command = 'system-config-language'; |
$command = 'system-config-language'; |
|
} elsif (-e '/usr/bin/localectl') { |
|
$command = '/usr/bin/localectl set-locale LANG=en_US.UTF-8'; |
|
} else { |
|
$command = 'No standard command found'; |
} |
} |
} |
} |
last; |
last; |
Line 588 sub check_mysql_running {
|
Line 616 sub check_mysql_running {
|
if ($1 >= 19) { |
if ($1 >= 19) { |
$mysqldaemon ='mariadb'; |
$mysqldaemon ='mariadb'; |
} |
} |
} elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) { |
} elsif ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)/) { |
if ($1 >= 7) { |
if ($1 >= 7) { |
$mysqldaemon ='mariadb'; |
$mysqldaemon ='mariadb'; |
$process = 'mysqld'; |
$process = 'mysqld'; |
Line 715 sub chkconfig {
|
Line 743 sub chkconfig {
|
if (($distro =~ /^ubuntu/) && ($version <= 8)) { |
if (($distro =~ /^ubuntu/) && ($version <= 8)) { |
$daemon{'cups'} = 'cupsys'; |
$daemon{'cups'} = 'cupsys'; |
} |
} |
|
if (($distro =~ /^ubuntu/) && ($version >= 18)) { |
|
$daemon{'ntp'} = 'chrony'; |
|
} |
} elsif ($distro =~ /^fedora(\d+)/) { |
} elsif ($distro =~ /^fedora(\d+)/) { |
my $version = $1; |
my $version = $1; |
if ($version >= 15) { |
if ($version >= 15) { |
Line 729 sub chkconfig {
|
Line 760 sub chkconfig {
|
if ($version >= 19) { |
if ($version >= 19) { |
$daemon{'mysql'} = 'mariadb'; |
$daemon{'mysql'} = 'mariadb'; |
} |
} |
} elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) { |
if ($version >= 26) { |
|
$daemon{'ntp'} = 'chronyd'; |
|
} |
|
} elsif ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)/) { |
my $version = $1; |
my $version = $1; |
if ($version >= 7) { |
if ($version >= 7) { |
$uses_systemctl{'ntp'} = 1; |
$uses_systemctl{'ntp'} = 1; |
Line 739 sub chkconfig {
|
Line 773 sub chkconfig {
|
$uses_systemctl{'cups'} = 1; |
$uses_systemctl{'cups'} = 1; |
$daemon{'mysql'} = 'mariadb'; |
$daemon{'mysql'} = 'mariadb'; |
} |
} |
|
if (($version >= 8) || ($distro eq 'oracle7')) { |
|
$daemon{'ntp'} = 'chronyd'; |
|
} |
} |
} |
my $nocheck; |
my $nocheck; |
if (! -x $checker_bin) { |
if (! -x $checker_bin) { |
Line 833 sub chkconfig {
|
Line 870 sub chkconfig {
|
|
|
sub uses_firewalld { |
sub uses_firewalld { |
my ($distro) = @_; |
my ($distro) = @_; |
my ($inuse, $checkfirewalld); |
my ($inuse,$checkfirewalld,$zone); |
if ($distro =~ /^(suse|sles)([\d\.]+)$/) { |
if ($distro =~ /^(suse|sles)([\d\.]+)$/) { |
if (($1 eq 'sles') && ($2 >= 15)) { |
if (($1 eq 'sles') && ($2 >= 15)) { |
$checkfirewalld = 1; |
$checkfirewalld = 1; |
Line 842 sub uses_firewalld {
|
Line 879 sub uses_firewalld {
|
if ($1 >= 18) { |
if ($1 >= 18) { |
$checkfirewalld = 1; |
$checkfirewalld = 1; |
} |
} |
} elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) { |
} elsif ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)/) { |
if ($1 >= 7) { |
if ($1 >= 7) { |
$checkfirewalld = 1; |
$checkfirewalld = 1; |
} |
} |
Line 863 sub uses_firewalld {
|
Line 900 sub uses_firewalld {
|
} |
} |
if (($loaded eq 'loaded') || ($active eq 'active')) { |
if (($loaded eq 'loaded') || ($active eq 'active')) { |
$inuse = 1; |
$inuse = 1; |
|
my $cmd = 'firewall-cmd --get-default-zone'; |
|
if (open(PIPE,"$cmd |")) { |
|
my $result = <PIPE>; |
|
chomp($result); |
|
close(PIPE); |
|
if ($result =~ /^\w+$/) { |
|
$zone = $result; |
|
} |
|
} |
} |
} |
} |
} |
return $inuse; |
return ($inuse,$zone); |
} |
} |
|
|
sub chkfirewall { |
sub chkfirewall { |
Line 876 sub chkfirewall {
|
Line 922 sub chkfirewall {
|
https => 443, |
https => 443, |
); |
); |
my %activefw; |
my %activefw; |
if (&firewall_is_active()) { |
my ($firewalld,$zone) = &uses_firewalld($distro); |
if (&uses_firewalld($distro)) { |
if ($firewalld) { |
my %current; |
my %current; |
if (open(PIPE,'firewall-cmd --permanent --zone=public --list-services |')) { |
if (open(PIPE,'firewall-cmd --permanent --zone='.$zone.' --list-services |')) { |
my $svc = <PIPE>; |
my $svc = <PIPE>; |
close(PIPE); |
close(PIPE); |
chomp($svc); |
chomp($svc); |
map { $current{$_} = 1; } (split(/\s+/,$svc)); |
map { $current{$_} = 1; } (split(/\s+/,$svc)); |
} |
} |
if ($current{'http'} && $current{'https'}) { |
if ($current{'http'} && $current{'https'}) { |
$configfirewall = 0; |
$configfirewall = 0; |
} |
} |
} else { |
} else { |
|
if (&firewall_is_active()) { |
my $iptables = &get_pathto_iptables(); |
my $iptables = &get_pathto_iptables(); |
if ($iptables eq '') { |
if ($iptables eq '') { |
print &mt('Firewall not checked as path to iptables not determined.')."\n"; |
print &mt('Firewall not checked as path to iptables not determined.')."\n"; |
Line 910 sub chkfirewall {
|
Line 957 sub chkfirewall {
|
print &mt('Firewall not checked as iptables Chains not identified.')."\n"; |
print &mt('Firewall not checked as iptables Chains not identified.')."\n"; |
} |
} |
} |
} |
|
} else { |
|
print &mt('Firewall not enabled.')."\n"; |
} |
} |
} else { |
|
print &mt('Firewall not enabled.')."\n"; |
|
} |
} |
return ($configfirewall,\%activefw); |
return ($configfirewall,\%activefw); |
} |
} |
Line 971 sub chkapache {
|
Line 1018 sub chkapache {
|
} |
} |
} |
} |
} |
} |
|
if ((!$fixapache) && ($distname eq 'ubuntu')) { |
|
my $sitestatus = "/etc/apache2/mods-available/status.conf"; |
|
my $stdstatus = "$instdir/debian-ubuntu/status.conf"; |
|
if ((-e $stdstatus) && (-e $sitestatus)) { |
|
if (open(PIPE, "diff --brief $stdstatus $sitestatus |")) { |
|
my $diffres = <PIPE>; |
|
close(PIPE); |
|
chomp($diffres); |
|
if ($diffres) { |
|
$fixapache = 1; |
|
} |
|
} |
|
} |
|
} |
} elsif ($distro =~ /^(suse|sles)([\d\.]+)$/) { |
} elsif ($distro =~ /^(suse|sles)([\d\.]+)$/) { |
my ($name,$version) = ($1,$2); |
my ($name,$version) = ($1,$2); |
my $apache = 'apache'; |
my $apache = 'apache'; |
my $conf_file = "$instdir/sles-suse/default-server.conf"; |
my $conf_file = "$instdir/sles-suse/default-server.conf"; |
if ($version >= 10) { |
if ($version >= 10) { |
$apache = 'apache2'; |
$apache = 'apache2'; |
} |
} |
if (($name eq 'sles') && ($version >= 12)) { |
if (($name eq 'sles') && ($version >= 12)) { |
$conf_file = "$instdir/sles-suse/apache2.4/default-server.conf"; |
$conf_file = "$instdir/sles-suse/apache2.4/default-server.conf"; |
} |
} |
if (!-e "$conf_file") { |
if (!-e $conf_file) { |
$fixapache = 0; |
$fixapache = 0; |
print &mt('Warning: No LON-CAPA Apache configuration file found for installation check.')."\n"; |
print &mt('Warning: No LON-CAPA Apache configuration file found for installation check.')."\n"; |
} elsif (-e "/etc/$apache/default-server.conf") { |
} elsif (-e "/etc/$apache/default-server.conf") { |
Line 1010 sub chkapache {
|
Line 1071 sub chkapache {
|
} |
} |
} else { |
} else { |
my $configfile = 'httpd.conf'; |
my $configfile = 'httpd.conf'; |
if ($distro =~ /^(?:centos|rhes|scientific)(\d+)$/) { |
my $mpmfile = 'mpm.conf'; |
|
if ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)$/) { |
if ($1 >= 7) { |
if ($1 >= 7) { |
$configfile = 'apache2.4/httpd.conf'; |
$configfile = 'apache2.4/httpd.conf'; |
} elsif ($1 > 5) { |
} elsif ($1 > 5) { |
Line 1018 sub chkapache {
|
Line 1080 sub chkapache {
|
} |
} |
} elsif ($distro =~ /^fedora(\d+)$/) { |
} elsif ($distro =~ /^fedora(\d+)$/) { |
if ($1 > 17) { |
if ($1 > 17) { |
$configfile = 'apache2.4/httpd.conf'; |
$configfile = 'apache2.4/httpd.conf'; |
} elsif ($1 > 10) { |
} elsif ($1 > 10) { |
$configfile = 'new/httpd.conf'; |
$configfile = 'new/httpd.conf'; |
} |
} |
Line 1036 sub chkapache {
|
Line 1098 sub chkapache {
|
} |
} |
} |
} |
} |
} |
|
if (-e "/etc/httpd/conf.modules.d/00-mpm.conf") { |
|
if (!-e "$instdir/centos-rhes-fedora-sl/$mpmfile") { |
|
print &mt('Warning: No LON-CAPA Apache MPM configuration file found for installation check.')."\n"; |
|
} elsif ((-e "/etc/httpd/conf.modules.d/00-mpm.conf") && (-e "$instdir/centos-rhes-fedora-sl/$mpmfile")) { |
|
if (open(PIPE, "diff --brief $instdir/centos-rhes-fedora-sl/$mpmfile /etc/httpd/conf.modules.d/00-mpm.conf |")) { |
|
my $diffres = <PIPE>; |
|
close(PIPE); |
|
chomp($diffres); |
|
if ($diffres) { |
|
$fixapache = 1; |
|
} |
|
} |
|
} |
|
} |
} |
} |
return $fixapache; |
return $fixapache; |
} |
} |
Line 1787 if ($distro eq '') {
|
Line 1863 if ($distro eq '') {
|
print "\n".&mt('Linux distribution could not be verified as a supported distribution.')."\n". |
print "\n".&mt('Linux distribution could not be verified as a supported distribution.')."\n". |
&mt('The following are supported: [_1].', |
&mt('The following are supported: [_1].', |
'CentOS, RedHat Enterprise, Fedora, Scientific Linux, '. |
'CentOS, RedHat Enterprise, Fedora, Scientific Linux, '. |
'openSuSE, SLES, Ubuntu LTS, Debian')."\n\n". |
'Oracle Linux, openSuSE, SLES, Ubuntu LTS, Debian')."\n\n". |
&mt('Stopping execution.')."\n"; |
&mt('Stopping execution.')."\n"; |
exit; |
exit; |
} |
} |
Line 1954 if ($callsub{'apache'}) {
|
Line 2030 if ($callsub{'apache'}) {
|
©_apache2_debconf($instdir,$distro,$hostname); |
©_apache2_debconf($instdir,$distro,$hostname); |
} else { |
} else { |
©_httpd_conf($instdir,$distro,$hostname); |
©_httpd_conf($instdir,$distro,$hostname); |
|
©_mpm_conf($instdir,$distro); |
} |
} |
} else { |
} else { |
print_and_log(&mt('Skipping configuration of Apache web server.')."\n"); |
print_and_log(&mt('Skipping configuration of Apache web server.')."\n"); |
Line 2023 if ($callsub{'runlevels'}) {
|
Line 2100 if ($callsub{'runlevels'}) {
|
} |
} |
|
|
if ($callsub{'firewall'}) { |
if ($callsub{'firewall'}) { |
if (&uses_firewalld($distro)) { |
my ($firewalld,$zone) = &uses_firewalld($distro); |
|
if ($firewalld) { |
my (%current,%added); |
my (%current,%added); |
if (open(PIPE,'firewall-cmd --permanent --zone=public --list-services |')) { |
if (open(PIPE,"firewall-cmd --permanent --zone=$zone --list-services |")) { |
my $svc = <PIPE>; |
my $svc = <PIPE>; |
close(PIPE); |
close(PIPE); |
chomp($svc); |
chomp($svc); |
Line 2033 if ($callsub{'firewall'}) {
|
Line 2111 if ($callsub{'firewall'}) {
|
} |
} |
foreach my $service ('http','https') { |
foreach my $service ('http','https') { |
unless ($current{$service}) { |
unless ($current{$service}) { |
if (open(PIPE,"firewall-cmd --permanent --zone=public --add-service=$service |")) { |
if (open(PIPE,"firewall-cmd --permanent --zone=$zone --add-service=$service |")) { |
my $result = <PIPE>; |
my $result = <PIPE>; |
if ($result =~ /^success/) { |
if ($result =~ /^success/) { |
$added{$service} = 1; |
$added{$service} = 1; |
Line 2051 if ($callsub{'firewall'}) {
|
Line 2129 if ($callsub{'firewall'}) {
|
} |
} |
unless ($current{'ssh'}) { |
unless ($current{'ssh'}) { |
print &mt('If you would the like to allow access to ssh from outside, use the command[_1].', |
print &mt('If you would the like to allow access to ssh from outside, use the command[_1].', |
'firewall-cmd --permanent --zone=public --add-service=ssh')."\n"; |
"firewall-cmd --permanent --zone=$zone --add-service=ssh")."\n"; |
} |
} |
} elsif ($distro =~ /^(suse|sles)/) { |
} elsif ($distro =~ /^(suse|sles)/) { |
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
Line 2073 if ($callsub{'firewall'}) {
|
Line 2151 if ($callsub{'firewall'}) {
|
} |
} |
} |
} |
} |
} |
} elsif ($distro =~ /^scientific/) { |
} elsif ($distro =~ /^(scientific|oracle)/) { |
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
'system-config-firewall-tui -- Customize', |
'system-config-firewall-tui -- Customize', |
'ssh, http')."\n"; |
'ssh, http')."\n"; |
} else { |
} else { |
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
my $version; |
'setup -- Firewall configuration -> Customize', |
if ($distro =~ /^(redhat|centos)(\d+)$/) { |
'ssh, http, https')."\n"; |
$version = $1; |
|
} |
|
if ($version > 5) { |
|
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
|
'system-config-firewall-tui -- Customize', |
|
'ssh, http')."\n"; |
|
} else { |
|
print &mt('Use [_1] to configure the firewall to allow access for [_2].', |
|
'setup -- Firewall configuration -> Customize', |
|
'ssh, http, https')."\n"; |
|
} |
} |
} |
} else { |
} else { |
&print_and_log(&mt('Skipping Firewall configuration.')."\n"); |
&print_and_log(&mt('Skipping Firewall configuration.')."\n"); |
Line 2386 sub setup_mysql_permissions {
|
Line 2474 sub setup_mysql_permissions {
|
if ($usesauth) { |
if ($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','','','','')"); |
if ($is_mariadb) { |
if ($is_mariadb) { |
push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); |
push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED BY 'localhostkey'"); |
} else { |
} else { |
push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); |
push(@mysql_commands,"ALTER USER 'www'\@'localhost' IDENTIFIED WITH mysql_native_password BY 'localhostkey'"); |
} |
} |
} elsif ($hasauthcol) { |
} elsif ($hasauthcol) { |
@mysql_commands = ("INSERT user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www',password('localhostkey'),'','','','');"); |
@mysql_commands = ("INSERT user (Host, User, Password, ssl_cipher, x509_issuer, x509_subject, authentication_string) VALUES('localhost','www',password('localhostkey'),'','','','');"); |
Line 2495 sub get_mysql_version {
|
Line 2583 sub get_mysql_version {
|
my $info = <PIPE>; |
my $info = <PIPE>; |
chomp($info); |
chomp($info); |
close(PIPE); |
close(PIPE); |
($version,$subversion,$name) = ($info =~ /(\d+\.\d+)\.(\d+)\-?(\w*),/); |
($version,$subversion,$name) = ($info =~ /(\d+\.\d+)\.(\d+)(?:\-?(\w*),|)/); |
} else { |
} else { |
print &mt('Could not determine which version of MySQL is installed.'). |
print &mt('Could not determine which version of MySQL is installed.'). |
"\n"; |
"\n"; |
Line 2513 sub get_mysql_version {
|
Line 2601 sub get_mysql_version {
|
sub copy_httpd_conf { |
sub copy_httpd_conf { |
my ($instdir,$distro,$hostname) = @_; |
my ($instdir,$distro,$hostname) = @_; |
my $configfile = 'httpd.conf'; |
my $configfile = 'httpd.conf'; |
if ($distro =~ /^(?:centos|rhes|scientific)(\d+)$/) { |
if ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)$/) { |
if ($1 >= 7) { |
if ($1 >= 7) { |
$configfile = 'apache2.4/httpd.conf'; |
$configfile = 'apache2.4/httpd.conf'; |
} elsif ($1 > 5) { |
} elsif ($1 > 5) { |
Line 2534 sub copy_httpd_conf {
|
Line 2622 sub copy_httpd_conf {
|
print_and_log("\n"); |
print_and_log("\n"); |
} |
} |
|
|
|
########################################################### |
|
## |
|
## RHEL/CentOS/Fedora/Scientific Linux |
|
## Copy LON-CAPA mpm.conf to /etc/httpd/conf.modules.d/00-mpm.conf |
|
## |
|
## The LON-CAPA mpm.conf enables the prefork MPM module in |
|
## Apache. This is also the default for RHEL/CentOS/Oracle |
|
## Linux 7 and earlier, and Fedora 26 and earlier. For more |
|
## recent versions of those distros, the event MPM is enabled |
|
## by default. After ©_mpm_conf() is run, the prefork MPM |
|
## module will be enabled instead of the event MPM module. |
|
## |
|
########################################################### |
|
|
|
sub copy_mpm_conf { |
|
my ($instdir,$distro) = @_; |
|
my $mpmfile = 'mpm.conf'; |
|
if ((-e "/etc/httpd/conf.modules.d/00-mpm.conf") && |
|
(-e "$instdir/centos-rhes-fedora-sl/$mpmfile")) { |
|
print_and_log(&mt('Copying the LON-CAPA [_1] to [_2].',"'mpm.conf'", |
|
"'/etc/httpd/conf.modules.d/00-mpm.conf'")."\n"); |
|
copy "$instdir/centos-rhes-fedora-sl/$mpmfile","/etc/httpd/conf.modules.d/00-mpm.conf"; |
|
chmod(0644,"/etc/httpd/conf.modules.d/00-mpm.conf"); |
|
print_and_log("\n"); |
|
} else { |
|
my $logfail; |
|
if ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)$/) { |
|
if ($1 > 7) { |
|
$logfail = 1; |
|
} |
|
} elsif ($distro =~ /^fedora(\d+)$/) { |
|
if ($1 > 26) { |
|
$logfail = 1; |
|
} |
|
} |
|
if ($logfail) { |
|
print_and_log(&mt('Warning: copying the LON-CAPA [_1] failed because [_2] and/or [_3] are missing.', |
|
$mpmfile,"'$instdir/centos-rhes-fedora-sl/$mpmfile'", |
|
"'/etc/httpd/conf.modules.d/00-mpm.conf'")); |
|
print_and_log("\n"); |
|
} |
|
} |
|
} |
|
|
############################################### |
############################################### |
## |
## |
## Copy loncapassl.conf and sslrewrite.conf |
## Copy loncapassl.conf and sslrewrite.conf |
Line 3039 sub copy_apache2_debconf {
|
Line 3171 sub copy_apache2_debconf {
|
if (($distname eq 'ubuntu') && ($version > 12)) { |
if (($distname eq 'ubuntu') && ($version > 12)) { |
$defaultconfig = "$apache2_sites_enabled_dir/000-default.conf"; |
$defaultconfig = "$apache2_sites_enabled_dir/000-default.conf"; |
} |
} |
if (-l $defaultconfig) { |
my ($skipconf,$skipsite,$skipstatus); |
unlink($defaultconfig); |
|
} |
|
if (($distname eq 'ubuntu') && ($version > 12)) { |
if (($distname eq 'ubuntu') && ($version > 12)) { |
print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from conf-enabled.',"'apache2'","'/etc/apache2/conf-available'","'loncapa.conf symlink'")."\n"); |
|
my $apache2_conf_enabled_dir = '/etc/apache2/conf-enabled'; |
my $apache2_conf_enabled_dir = '/etc/apache2/conf-enabled'; |
my $apache2_conf_available_dir = '/etc/apache2/conf-available'; |
my $apache2_conf_available_dir = '/etc/apache2/conf-available'; |
if (-e "$apache2_conf_available_dir/loncapa") { |
|
copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.original"); |
|
} |
|
my $defaultconf = $apache2_conf_enabled_dir.'/loncapa.conf'; |
my $defaultconf = $apache2_conf_enabled_dir.'/loncapa.conf'; |
copy("$instdir/debian-ubuntu/ubuntu14/loncapa_conf","$apache2_conf_available_dir/loncapa"); |
if ((-e "$apache2_conf_available_dir/loncapa") && (-e "$instdir/debian-ubuntu/ubuntu14/loncapa_conf")) { |
chmod(0444,"$apache2_conf_available_dir/loncapa"); |
if (open(PIPE, "diff --brief $apache2_conf_available_dir/loncapa $instdir/debian-ubuntu/ubuntu14/loncapa_conf |")) { |
if (-l $defaultconf) { |
my $diffres = <PIPE>; |
unlink($defaultconf); |
close(PIPE); |
} |
chomp($diffres); |
symlink("$apache2_conf_available_dir/loncapa","$defaultconf"); |
if ($diffres) { |
print_and_log(&mt('Copying loncapa [_1] site file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default.conf symlink'")."\n"); |
copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.original"); |
copy("$instdir/debian-ubuntu/ubuntu14/loncapa_site","$apache2_sites_available_dir/loncapa"); |
} |
chmod(0444,"$apache2_sites_available_dir/loncapa"); |
if (-l $defaultconf) { |
symlink("$apache2_sites_available_dir/loncapa","$defaultconfig"); |
my $linkfname = readlink($defaultconf); |
} else { |
if ($linkfname eq "$apache2_conf_available_dir/loncapa") { |
print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default symlink'")."\n"); |
unless ($diffres) { |
if (-e "$apache2_sites_available_dir/loncapa") { |
$skipconf = 1; |
copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original"); |
} |
} |
} |
copy("$instdir/debian-ubuntu/loncapa","$apache2_sites_available_dir/loncapa"); |
} |
chmod(0444,"$apache2_sites_available_dir/loncapa"); |
} |
symlink("$apache2_sites_available_dir/loncapa","$apache2_sites_enabled_dir/000-default"); |
} |
|
unless ($skipconf) { |
|
print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from conf-enabled.',"'apache2'","'/etc/apache2/conf-available'","'loncapa.conf symlink'")."\n"); |
|
copy("$instdir/debian-ubuntu/ubuntu14/loncapa_conf","$apache2_conf_available_dir/loncapa"); |
|
chmod(0444,"$apache2_conf_available_dir/loncapa"); |
|
if (-l $defaultconf) { |
|
unlink($defaultconf); |
|
} |
|
symlink("$apache2_conf_available_dir/loncapa","$defaultconf"); |
|
} |
|
my $stdsite = "$instdir/debian-ubuntu/ubuntu14/loncapa_site"; |
|
if ((-e $stdsite) && (-e "$apache2_sites_available_dir/loncapa")) { |
|
if (open(PIPE, "diff --brief $stdsite $apache2_sites_available_dir/loncapa |")) { |
|
my $diffres = <PIPE>; |
|
close(PIPE); |
|
chomp($diffres); |
|
if ($diffres) { |
|
copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original"); |
|
} |
|
if (-l $defaultconfig) { |
|
my $linkfname = readlink($defaultconfig); |
|
if ($linkfname eq "$apache2_sites_available_dir/loncapa") { |
|
unless ($diffres) { |
|
$skipsite = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
unless ($skipsite) { |
|
print_and_log(&mt('Copying loncapa [_1] site file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default.conf symlink'")."\n"); |
|
copy("$instdir/debian-ubuntu/ubuntu14/loncapa_site","$apache2_sites_available_dir/loncapa"); |
|
chmod(0444,"$apache2_sites_available_dir/loncapa"); |
|
symlink("$apache2_sites_available_dir/loncapa","$defaultconfig"); |
|
} |
|
} else { |
|
if ((-e "$instdir/debian-ubuntu/loncapa") && (-e "$apache2_sites_available_dir/loncapa")) { |
|
if (open(PIPE, "diff --brief $instdir/debian-ubuntu/loncapa $apache2_sites_available_dir/loncapa |")) { |
|
my $diffres = <PIPE>; |
|
close(PIPE); |
|
chomp($diffres); |
|
if ($diffres) { |
|
copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original"); |
|
} |
|
if (-l $defaultconfig) { |
|
my $linkfname = readlink($defaultconfig); |
|
if ($linkfname eq "$apache2_sites_available_dir/loncapa") { |
|
unless ($diffres) { |
|
$skipsite = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
unless ($skipsite) { |
|
if (-l $defaultconfig) { |
|
unlink($defaultconfig); |
|
} |
|
print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default symlink'")."\n"); |
|
if (-e "$instdir/debian-ubuntu/loncapa") { |
|
copy("$instdir/debian-ubuntu/loncapa","$apache2_sites_available_dir/loncapa"); |
|
chmod(0444,"$apache2_sites_available_dir/loncapa"); |
|
symlink("$apache2_sites_available_dir/loncapa","$apache2_sites_enabled_dir/000-default"); |
|
} |
|
} |
|
} |
|
if ($distname eq 'ubuntu') { |
|
my $sitestatus = "$apache2_mods_available_dir/status.conf"; |
|
my $stdstatus = "$instdir/debian-ubuntu/status.conf"; |
|
if ((-e $sitestatus) && (-e $stdstatus)) { |
|
if (open(PIPE, "diff --brief $stdstatus $sitestatus |")) { |
|
my $diffres = <PIPE>; |
|
close(PIPE); |
|
chomp($diffres); |
|
if ($diffres) { |
|
copy("$apache2_mods_available_dir/status.conf","$apache2_mods_available_dir/status.conf.original"); |
|
} else { |
|
$skipstatus = 1; |
|
} |
|
} |
|
} |
|
unless ($skipstatus) { |
|
if (-e $stdstatus) { |
|
print_and_log(&mt('Copying loncapa [_1] file to [_2],',"'status.conf'","'/etc/apache2/mods-available/status.conf'")."\n"); |
|
copy($stdstatus,$sitestatus); |
|
chmod(0644,$sitestatus); |
|
} |
|
} |
} |
} |
print_and_log("\n"); |
print_and_log("\n"); |
} |
} |
Line 3139 sub copy_sysconfig_apache2_file {
|
Line 3352 sub copy_sysconfig_apache2_file {
|
if (($name eq 'sles') && ($version >= 12)) { |
if (($name eq 'sles') && ($version >= 12)) { |
$sysconf_file = "$instdir/sles-suse/apache2.4/sysconfig_apache2"; |
$sysconf_file = "$instdir/sles-suse/apache2.4/sysconfig_apache2"; |
} |
} |
copy "$sysconf_file","/etc/sysconfig/apache2"; |
copy $sysconf_file,"/etc/sysconfig/apache2"; |
chmod(0444,"/etc/sysconfig/apache2"); |
chmod(0444,"/etc/sysconfig/apache2"); |
} |
} |
|
|
Line 3267 wget http://install.loncapa.org/versions
|
Line 3480 wget http://install.loncapa.org/versions
|
print &mt('LON-CAPA source files extracted.')."\n". |
print &mt('LON-CAPA source files extracted.')."\n". |
&mt('It remains for you to execute the following commands:')." |
&mt('It remains for you to execute the following commands:')." |
|
|
cd /root/loncapa-N.N (N.N should correspond to a version number like '0.4') |
cd /root/loncapa-X.Y.Z (X.Y.Z should correspond to a version number like '2.11.3') |
./UPDATE |
./UPDATE |
|
|
".&mt('If you have any trouble, please see [_1] and [_2]', |
".&mt('If you have any trouble, please see [_1] and [_2]', |