#!/bin/bash # bash_functions_c7.sh and framework.conf already included in files bellow . /usr/src/mor/framework/mor_install_functions_c7.sh . /usr/src/mor/framework/settings.sh VERSION="1.1.4" k_kolmisoft_logo _centos_version if (( centos_version != 7 )); then report "This script can only be executed on Centos 7" 6 report "Aborting..." 6 exit 1 fi if ! grep -F '127.0.0.1' /etc/hosts | grep -E '^localhost[[:space:]]?|[[:space:]]localhost$|[[:space:]]localhost[[:space:]]'; then report "localhost is not defined in /etc/hosts. This might cause issues later." 6 echo "Press any key to Continue or CRTL+C to Cancel Installation" read user_input fi exec > >(tee -a install.log) exec 2> >(tee -a install.log >&2) kf="/usr/src/k_framework" src="/usr/src/mor/x16" echo "Starting MOR X16 installation on Centos 7.x ..." echo `date` $src/maintenance/set_server_timezone_to_utc.sh echo `date` skip() { echo } # check for rvm presence to determine if server is empty or not if [ -f '/usr/local/rvm/bin/rvm' ]; then . /usr/src/mor/framework/bash_functions_c7.sh report "System is not empty, aborting installation" 6 exit 0 fi # moving this to beginning, so engineers installing system won't need to wait # before selecting configuration options # If FREE option is added, standard configuration file is used # without any asking (not to confuse clients, who install themselves) $src/maintenance/configuration_prepare_c7.sh "$@" # system update #yum -y update # need reboot after that # checking if apache user exist. Related TRAC #10975 grep apache /etc/passwd &>/dev/null if [ "$?" == "0" ]; then grep apache /etc/passwd | grep 1000 &>/dev/null if [ "$?" == "0" ]; then echo "Apache user already exist with incorrect UID. Please report to TRAC #10975" else echo "Apache user already exist. This is not minimal clean Centos install" fi echo "Press any key to Continue or CRTL+C to Cancel" read user_input; fi # for DB/GUI/CORE servers # environment check $src/maintenance/vm_detection.sh $src/maintenance/dns_check.sh # todo: we should terminate if dns does not work # environment preparation $kf/maintenance/system_preparation/time_sync.sh echo `date` # after sync we will get better time $kf/maintenance/system_preparation/selinux_disable.sh $kf/maintenance/system_preparation/yum_updatesd_disable.sh $src/maintenance/iptables_clean_c7.sh # $src/maintenance/time_sync_c7.sh $kf/maintenance/security/ssl_heartbleed_fix.sh $src/maintenance/folders_permissions_prepare.sh $kf/maintenance/system_preparation/tmpwatch_cron_disable.sh $src/maintenance/fix_ast_log_to_messages_c7.sh $kf/maintenance/system_preparation/svn_store_plaintext_passwords_disable.sh $kf/helpers/tuned_install.sh #$src/maintenance/aliases_install_c7.sh $src/maintenance/packets_install_c7.sh $kf/checks/connections_check.sh if [ "$?" != "0" ]; then report "Connection limited. Fix your firewall. Aborting." 1 exit 1 fi #$kf/maintenance/network_tune.sh # necessary for DB/GUI servers $src/gui/rvm_install_c7.sh $src/gui/ruby_install_c7.sh # for DB server $src/mysql/mysql_install_c7.sh $src/db/db_create.sh NEW $src/db/init_archived_calls.sh $src/db/disable_mysql_secure_file_priv.sh INSTALL $src/maintenance/test_fix_scripts_c7/mysql/add_skip_name_resolve.sh INSTALL $src/db/percona_table_update.sh calls force $src/db/percona_table_update.sh calls_old force $src/db/percona_table_update.sh calls_local force $src/db/percona_table_update.sh rates force # for GUI server $src/gui/apache_install_c7.sh $src/gui/gui_install_c7.sh $src/gui/xsendfile_install_c7.sh $src/gui/passenger_install_c7.sh $src/gui/ssl_install.sh $kf/helpers/memcached/memcached_install.sh $src/gui/invoice_template_install.sh $src/mysql/phpmyadmin_install_c7.sh # disabling for now CRM 35018 #$src/gui/certificates_for_authorized_install_c7.sh # Install ES on main GUI server read_mor_gui_settings if [ "$MAIN_GUI" == "1" ]; then /usr/src/mor/sh_scripts/elasticsearch/elasticsearch_install.sh fi # create symlink to 'elasticsearch' command on all servers ln -fs /usr/src/mor/sh_scripts/elasticsearch/mor_elasticsearch.sh /usr/bin/elasticsearch &> /dev/null #enable addons for free version if [ "$1" = "FREE" ] || [ "$1" = "Free" ] || [ "$1" = "free" ]; then $src/gui/enable_addons_c7.sh fi #some scripts needs to use right version of ruby. Those will use following symlink which point to ruby-2.1.2@global ln -s $src/gui/misc/mor_ruby /usr/local/mor/mor_ruby chmod +x /usr/local/mor/mor_ruby # Asterisk read_asterisk_version_settings if [ "$ASTERISK_VERSION_C7" == "1.8" ]; then $src/asterisk/asterisk_install_c7.sh else $src/asterisk_15/asterisk_install.sh fi $src/asterisk/asterisk_logger_config.sh $src/asterisk/freeze_check/freeze_check_install.sh $src/db/queue_log_data_update.sh #Need updated version #$src/core/core_install_10cc.sh if [[ ! -e "/etc/asterisk/mor.conf" ]]; then cp -fr $src/core/mor.conf /etc/asterisk fi # Helper packages $src/helpers/lame_install.sh $src/helpers/fail2ban_install_c7.sh $src/helpers/iperf_install.sh $src/helpers/phpsysinfo_install_c7.sh $src/helpers/mor_ip_whitelist/install_mor_ip_whitelist.sh $src/helpers/mor_gui_iptables/mor_gui_iptables_install.sh #$src/helpers/smpp_install.sh $src/helpers/whatmask_install.sh $src/helpers/mor_blocked_countries/mor_blocked_countries_install.sh $src/helpers/mor_block_scanners/install_mor_block_scanners.sh # Update email2tariff scripts in GUI server if Automatic Tariff Import is activated # In the future maybe it will be active in DB. Currently this will never proceed in a fresh install if [[ $GUI_PRESENT == "1" ]]; then if [[ $(get_confline "show_tariff_import_menu") == 1 ]]; then $src/helpers/email2tariff/email2tariff_install.sh fi fi # Scripts $src/scripts/scripts_install.sh $src/scripts/services/services_install.sh cp -f $src/scripts/backups/make_restore.sh /usr/local/mor/ cp -f $src/scripts/backups/make_backup.sh /usr/local/mor/ read_mor_pcap_settings if [ $PCAP_ENABLED == "1" ]; then $src/helpers/mor_pcap_tshark/mor_pcap_tshark_install.sh fi # Final touches $src/maintenance/logrotates_enable.sh $src/maintenance/permissions_post_install_c7.sh $src/maintenance/alias_activate.sh $src/db/generate_uniquehash.sh $kf/maintenance/usage_monitoring/install.sh $kf/maintenance/security/log4j1.x_fix.sh # disable iax2, h323 and g723 (if not used) $src/asterisk/disable_iax2.sh $src/asterisk/disable_h323.sh $src/asterisk/disable_g723.sh # enable OPUS codec (if installed) $src/asterisk_15/enable_opus_codec.sh # fix safe_asterisk script /usr/src/mor/sh_scripts/asterisk/safe_asterisk_fix.sh mkdir -p /tmp/mor/invoices chmod 777 -R /tmp/mor/invoices # Update Destinations/Directions $src/db/fix_directions/fix_directions.sh UPDATE_ALL $kf/helpers/zabbix/zabbix_agent_install.sh $src/maintenance/post_install_actions.sh # core install - disabled, does not show any prompts # cd /usr/src/mor/mor_app/apps && ./core_gen # to avoid failed crond http://trac.kolmisoft.com/trac/ticket/16124 my_delay 10 report "Restarting crond" 3 service crond restart > /dev/null 2>&1 # major check/fix $src/info_c7.sh # light check only (no automatic fixes) $src/check.sh echo `date`