Example #1
0
function install_boot()
{
    session_start();
    include_once PRE_DEFINED_ROOT_PATH . 'include/tool/setini.tool.inc';
    setini();
    header('Content-Type: text/html; charset=UTF-8');
    install_check_setup();
    define('THEME_URI', ROOT_URI . 'theme/default/');
    install_set_path();
    install_main();
}
Example #2
0
    variable_set('site_mail', $form_state['values']['site_mail']);
    variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
    // Enable update.module if this option was selected.
    if ($form_state['values']['update_status_module'][1]) {
        drupal_install_modules(array('update'));
    }
    // Turn this off temporarily so that we can pass a password through.
    variable_set('user_email_verification', FALSE);
    $form_state['old_values'] = $form_state['values'];
    $form_state['values'] = $form_state['values']['account'];
    // We precreated user 1 with placeholder values. Let's save the real values.
    $account = user_load(1);
    $merge_data = array('init' => $form_state['values']['mail'], 'roles' => array(), 'status' => 1);
    user_save($account, array_merge($form_state['values'], $merge_data));
    // Log in the first user.
    user_authenticate($form_state['values']);
    $form_state['values'] = $form_state['old_values'];
    unset($form_state['old_values']);
    variable_set('user_email_verification', TRUE);
    if (isset($form_state['values']['clean_url'])) {
        variable_set('clean_url', $form_state['values']['clean_url']);
    }
    // The user is now logged in, but has no session ID yet, which
    // would be required later in the request, so remember it.
    $user->sid = session_id();
    // Record when this install ran.
    variable_set('install_time', time());
}
// Start the installer.
install_main();
Example #3
0
function lxins_main()
{
    global $argv, $downloadserver;
    $opt = parse_opt($argv);
    $dir_name = dirname(__FILE__);
    $installtype = $opt['install-type'];
    $installversion = isset($opt['version']) ? $opt['version'] : null;
    $dbroot = "root";
    $dbpass = "";
    $osversion = find_os_version();
    $arch = `arch`;
    $arch = trim($arch);
    //--- Create temporary flags for install
    system("mkdir -p /var/cache/kloxo/");
    system("echo 1 > /var/cache/kloxo/kloxo-install-firsttime.flg");
    if (!char_search_beg($osversion, "centos") && !char_search_beg($osversion, "rhel")) {
        print "Kloxo is only supported on CentOS 5 and RHEL 5\n";
        exit;
    }
    if (file_exists("/usr/local/lxlabs/kloxo")) {
        //--- Ask Reinstall
        if (get_yes_no("Kloxo seems already installed do you wish to continue?") == 'n') {
            print "Installation Aborted.\n";
            exit;
        }
    } else {
        //--- Ask License
        if (get_yes_no("Kloxo is using AGPL-V3.0 License, do you agree with the terms?") == 'n') {
            print "You did not agree to the AGPL-V3.0 license terms.\n";
            print "Installation aborted.\n\n";
            exit;
        } else {
            print "Installing Kloxo = YES\n\n";
        }
    }
    //--- Ask for InstallApp
    print "InstallApp: PHP Applications like PHPBB, WordPress, Joomla etc\n";
    print "When you choose Yes, be aware of downloading about 350Mb of data!\n";
    if (get_yes_no("Do you want to install the InstallAPP sotfware?") == 'n') {
        print "Installing InstallApp = NO\n";
        print "You can install it later with /script/installapp-update\n\n";
        $installappinst = false;
        //--- Temporary flag so InstallApp won't be installed
        system("echo 1 > /var/cache/kloxo/kloxo-install-disableinstallapp.flg");
    } else {
        print "Installing InstallApp = YES\n\n";
        $installappinst = true;
    }
    print "Adding System users and groups (nouser, nogroup and lxlabs, lxlabs)\n";
    system("groupadd nogroup");
    system("useradd nouser -g nogroup -s '/sbin/nologin'");
    system("groupadd lxlabs");
    system("useradd lxlabs -g lxlabs -s '/sbin/nologin'");
    print "Installing LxCenter yum repository for updates\n";
    install_yum_repo($osversion);
    $packages = array("sendmail", "sendmail-cf", "sendmail-doc", "sendmail-devel", "exim", "vsftpd", "postfix", "vpopmail", "qmail", "lxphp", "lxzend", "pure-ftpd", "imap");
    $list = implode(" ", $packages);
    print "Removing packages {$list}...\n";
    foreach ($packages as $package) {
        exec("rpm -e --nodeps {$package} > /dev/null 2>&1");
    }
    $packages = array("php-mbstring", "php-mysql", "which", "gcc-c++", "php-imap", "php-pear", "php-devel", "lxlighttpd", "httpd", "mod_ssl", "zip", "unzip", "lxphp", "lxzend", "mysql", "mysql-server", "curl", "autoconf", "automake", "libtool", "bogofilter", "gcc", "cpp", "openssl", "pure-ftpd", "yum-protectbase");
    $list = implode(" ", $packages);
    while (true) {
        print "Installing packages {$list}...\n";
        system("PATH=\$PATH:/usr/sbin yum -y install {$list}", $return_value);
        if (file_exists("/usr/local/lxlabs/ext/php/php")) {
            break;
        } else {
            print "YUM Gave Error... Trying Again...\n";
            if (get_yes_no("Try again?") == 'n') {
                print "- EXIT: Fix the problem and install Kloxo again.\n";
                exit;
            }
        }
    }
    print "Prepare installation directory\n";
    system("mkdir -p /usr/local/lxlabs/kloxo");
    if ($installversion) {
        if (substr($installversion, 0, 4) == '6.0.') {
            print "\n*** Need additional files installing {$installversion} (less then 6.1.0)***\n";
            print "      Run 'sh /script/kloxo-installer.sh' (without argument)\n\n";
            exit;
        }
        chdir("/usr/local/lxlabs/kloxo");
        system("mkdir -p /usr/local/lxlabs/kloxo/log");
        @unlink("/usr/local/lxlabs/kloxo/kloxo-current.zip");
        print "Downloading Kloxo {$installversion} release\n";
        system("wget {$downloadserver}download/kloxo/production/kloxo/kloxo-{$installversion}.zip");
        system("mv -f ./kloxo-{$installversion}.zip ./kloxo-current.zip");
    } else {
        if (file_exists("../kloxo-current.zip")) {
            //--- Install from local file if exists
            @unlink("/usr/local/lxlabs/kloxo/kloxo-current.zip");
            print "Local copying Kloxo release\n";
            system("mkdir -p /var/cache/kloxo");
            system("cp -rf ../kloxo-current.zip /usr/local/lxlabs/kloxo");
            //--- The first step - Remove packages
            system("rm -f /var/cache/kloxo/kloxo-thirdparty*.zip");
            system("rm -f /var/cache/kloxo/lxawstats*.tar.gz");
            system("rm -f /var/cache/kloxo/lxwebmail*.tar.gz");
            system("rm -f /var/cache/kloxo/kloxophpsixfour*.tar.gz");
            system("rm -f /var/cache/kloxo/kloxophp*.tar.gz");
            system("rm -f /var/cache/kloxo/*-version");
            //--- The second step - copy from packer script if exist
            system("cp -rf ../kloxo-thirdparty*.zip /var/cache/kloxo");
            system("cp -rf ../lxawstats*.tar.gz /var/cache/kloxo");
            system("cp -rf ../lxwebmail*.tar.gz /var/cache/kloxo");
            system("cp -rf ../kloxo-thirdparty-version /var/cache/kloxo");
            system("cp -rf ../lxawstats-version /var/cache/kloxo");
            system("cp -rf ../lxwebmail-version /var/cache/kloxo");
            if (file_exists("/usr/lib64")) {
                if (!is_link("/usr/lib/kloxophp")) {
                    system("rm -rf /usr/lib/kloxophp");
                }
                system("cp -rf ../kloxophpsixfour*.tar.gz /var/cache/kloxo");
                system("cp -rf ../kloxophpsixfour-version /var/cache/kloxo");
                system("mkdir -p /usr/lib64/kloxophp");
                system("ln -s /usr/lib64/kloxophp /usr/lib/kloxophp");
                system("mkdir -p /usr/lib64/php");
                system("ln -s /usr/lib64/php /usr/lib/php");
                system("mkdir -p /usr/lib64/httpd");
                system("ln -s /usr/lib64/httpd /usr/lib/httpd");
                system("mkdir -p /usr/lib64/lighttpd");
                system("ln -s /usr/lib64/lighttpd /usr/lib/lighttpd");
            } else {
                //--- Needs version checks in the future
                system("rename ../kloxophpsixfour ../_kloxophpsixfour ../kloxophpsixfour*");
                system("cp -rf ../kloxophp*.tar.gz /var/cache/kloxo");
                system("rename ../_kloxophpsixfour ../kloxophpsixfour ../_kloxophpsixfour*");
                system("cp -rf ../kloxophp-version /var/cache/kloxo");
            }
            chdir("/usr/local/lxlabs/kloxo");
            system("mkdir -p /usr/local/lxlabs/kloxo/log");
        } else {
            chdir("/usr/local/lxlabs/kloxo");
            system("mkdir -p /usr/local/lxlabs/kloxo/log");
            @unlink("/usr/local/lxlabs/kloxo/kloxo-current.zip");
            print "Downloading latest Kloxo release\n";
            system("wget {$downloadserver}download/kloxo/production/kloxo/kloxo-current.zip");
        }
    }
    print "\n\nInstalling Kloxo.....\n\n";
    system("unzip -oq kloxo-current.zip", $return);
    if ($return) {
        print "Unzipping the core Failed.. Most likely it is corrupted. Report it at http://forum.lxcenter.org/\n";
        exit;
    }
    unlink("kloxo-current.zip");
    system("chown -R lxlabs:lxlabs /usr/local/lxlabs/");
    chdir("/usr/local/lxlabs/kloxo/httpdocs/");
    system("service mysqld start");
    if ($installtype !== 'slave') {
        check_default_mysql($dbroot, $dbpass);
    }
    $mypass = password_gen();
    print "Prepare defaults and configurations...\n";
    install_main();
    file_put_contents("/etc/sysconfig/spamassassin", "SPAMDOPTIONS=\" -v -d -p 783 -u lxpopuser\"");
    print "\nCreating Vpopmail database...\n";
    system("sh {$dir_name}/kloxo-linux/vpop.sh {$dbroot} \"{$dbpass}\" lxpopuser {$mypass}");
    system("chmod -R 755 /var/log/httpd/");
    system("chmod -R 755 /var/log/httpd/fpcgisock >/dev/null 2>&1");
    system("mkdir -p /var/log/kloxo/");
    system("mkdir -p /var/log/news");
    system("ln -sf /var/qmail/bin/sendmail /usr/sbin/sendmail");
    system("ln -sf /var/qmail/bin/sendmail /usr/lib/sendmail");
    system("echo `hostname` > /var/qmail/control/me");
    system("service qmail restart >/dev/null 2>&1 &");
    system("service courier-imap restart >/dev/null 2>&1 &");
    print "Prepare /home/kloxo/httpd...\n";
    system("mkdir -p /home/kloxo/httpd");
    chdir("/home/kloxo/httpd");
    @unlink("skeleton-disable.zip");
    system("chown -R lxlabs:lxlabs /home/kloxo/httpd");
    system("/etc/init.d/kloxo restart >/dev/null 2>&1 &");
    chdir("/usr/local/lxlabs/kloxo/httpdocs/");
    system("/usr/local/lxlabs/ext/php/php /usr/local/lxlabs/kloxo/bin/install/create.php --install-type={$installtype} --db-rootuser={$dbroot} --db-rootpassword={$dbpass}");
    if ($installappinst) {
        print "Install InstallApp...\n";
        system("/script/installapp-update");
        // First run (gets installappdata)
        system("/script/installapp-update");
        // Second run (gets applications)
    }
    //--- Remove all temporary flags because the end of install
    print "\nRemove Kloxo install flags...\n";
    system("rm -rf /var/cache/kloxo/*-version");
    system("rm -rf /var/cache/kloxo/kloxo-install-*.flg");
    //--- Prevent mysql socket problem (especially on 64bit system)
    if (!file_exists("/var/lib/mysql/mysql.sock")) {
        print "Create mysql.sock...\n";
        system("/etc/init.d/mysqld stop");
        system("mksock /var/lib/mysql/mysql.sock");
        system("/etc/init.d/mysqld start");
    }
    //--- Prevent for Mysql not start after reboot for fresh kloxo slave install
    print "Setting Mysql for always running after reboot and restart now...\n";
    system("chkconfig mysqld on");
    system("service mysqld restart");
    //--- Fix for old thirdparty version
    if (!file_exists("/usr/local/lxlabs/kloxo/httpdocs/thirdparty")) {
        system("cp -rf /var/cache/kloxo/kloxo-thirdparty*.zip /usr/local/lxlabs/kloxo");
        system("cd /usr/local/lxlabs/kloxo; unzip -oq kloxo-thirdparty*.zip");
        system("chown -R lxlabs:lxlabs /usr/local/lxlabs/kloxo/httpdocs/thirdparty");
        system("chown -R lxlabs:lxlabs /usr/local/lxlabs/kloxo/httpdocs/htmllib");
        system("rm -f /usr/local/lxlabs/kloxo/kloxo-thirdparty*.zip");
    }
    //--- Set ownership for Kloxo httpdocs dir
    system("chown -R lxlabs:lxlabs /usr/local/lxlabs/kloxo/httpdocs");
    print "\nCongratulations. Kloxo has been installed succesfully on your server as {$installtype}\n\n";
    if ($installtype === 'master') {
        print "You can connect to the server at:\n";
        print "\thttps://<ip-address>:7777 - secure ssl connection, or\n";
        print "\thttp://<ip-address>:7778 - normal one.\n\n";
        print "The login and password are 'admin' 'admin'. After Logging in, you will have to\n";
        print "change your password to something more secure\n\n";
        print "We hope you will find managing your hosting with Kloxo\n";
        print "refreshingly pleasurable, and also we wish you all the success\n";
        print "on your hosting venture\n\n";
        print "Thanks for choosing Kloxo to manage your hosting, and allowing us to be of\n";
        print "service\n";
    } else {
        print "You should open the port 7779 on this server, since this is used for\n";
        print "the communication between master and slave\n\n";
        print "To access this slave, to go admin->servers->add server,\n";
        print "give the ip/machine name of this server. The password is 'admin'.\n\n";
        print "The slave will appear in the list of slaves, and you can access it\n";
        print "just like you access localhost\n\n";
    }
    print "\n";
    print "---------------------------------------------\n";
}