- #start services. By default CentOS does not start services
- service mariadb start
- service httpd start
- systemctl enable mariadb
- systemctl enable httpd
- read -e -p "Do you want to configure mariadb (recommended if not done before) (Y/n)" KK
- [ "$KK" != "n" -a "$KK" != "no" ] && mysql_secure_installation
-
- read -e -p "Do you want to set firewall to grant web access port 80,443 (Y/n)" KK
- [ "$KK" != "n" -a "$KK" != "no" ] &&
- firewall-cmd --permanent --zone=public --add-service=http &&
- firewall-cmd --permanent --zone=public --add-service=https &&
- firewall-cmd --reload
-fi
-
-#check and ask for database user password. Must be done after database installation
-if [[ -n $QUIET_MODE ]]
-then
- echo -e "\nCheking database connection and ask for credentials"
- while ! mysqladmin -s -u$DBUSER $DBPASSWD_PARAM ping
- do
- [ -n "$logintry" ] && echo -e "\nInvalid database credentials!!!. Try again (Ctrl+c to abort)"
- [ -z "$logintry" ] && echo -e "\nProvide database credentials"
- read -e -p "database user? ($DBUSER) " DBUSER_
- [ -n "$DBUSER_" ] && DBUSER=$DBUSER_
- read -e -s -p "database password? (Enter for not using password) " DBPASSWD_
- [ -n "$DBPASSWD_" ] && DBPASSWD="$DBPASSWD_" && DBPASSWD_PARAM="-p$DBPASSWD_"
- [ -z "$DBPASSWD_" ] && DBPASSWD="" && DBPASSWD_PARAM=""
- logintry="yes"
- done
+ echo -e "\n"\
+ "#################################################################\n"\
+ "##### UPDATE REPOSITORIES #####\n"\
+ "#################################################################"
+ [ "$_DISTRO" == "Ubuntu" ] && apt-get update -y &&
+ add-apt-repository -y cloud-archive:queens && apt-get update -y
+
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && yum check-update -y
+ [ "$_DISTRO" == "CentOS" ] && yum install -y epel-release
+ [ "$_DISTRO" == "Red" ] && wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm \
+ && rpm -ivh epel-release-7-5.noarch.rpm && yum install -y epel-release && rm -f epel-release-7-5.noarch.rpm
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && yum repolist
+
+ echo -e "\n"\
+ "#################################################################\n"\
+ "##### INSTALL REQUIRED PACKAGES #####\n"\
+ "#################################################################"
+ [ "$_DISTRO" == "Ubuntu" ] && install_packages "git make screen wget mysql-client"
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "git make screen wget mariadb-client"
+
+ echo -e "\n"\
+ "#################################################################\n"\
+ "##### INSTALL PYTHON PACKAGES #####\n"\
+ "#################################################################"
+ [ "$_DISTRO" == "Ubuntu" ] && install_packages "python-yaml python-bottle python-mysqldb python-jsonschema "\
+ "python-paramiko python-argcomplete python-requests python-logutils libxml2-dev libxslt-dev python-dev "\
+ "python-pip python-crypto python-networkx"
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "PyYAML MySQL-python python-jsonschema "\
+ "python-paramiko python-argcomplete python-requests python-logutils libxslt-devel libxml2-devel python-devel "\
+ "python-pip python-crypto python-networkx"
+ # The only way to install python-bottle on Centos7 is with easy_install or pip
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && easy_install -U bottle
+
+ # required for vmware connector TODO move that to separete opt in install script
+ pip2 install pip==9.0.3 || exit 1 # --upgrade pip install pip 10 that does not work
+ pip2 install pyvcloud==19.1.1 || exit 1
+ pip2 install progressbar || exit 1
+ pip2 install prettytable || exit 1
+ pip2 install pyvmomi || exit 1
+ [ "$_DISTRO" == "Ubuntu" ] && install_packages "genisoimage"
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "genisoimage"
+
+ # required for fog connector
+ pip2 install fog05rest || exit 1
+
+ # required for OpenNebula connector
+ pip2 install untangle || exit 1
+ pip2 install -e git+https://github.com/python-oca/python-oca#egg=oca || exit 1
+
+ # required for AWS connector
+ [ "$_DISTRO" == "Ubuntu" ] && install_packages "python-boto"
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "python-boto" #TODO check if at Centos it exists with this name, or PIP should be used
+
+ # install openstack client needed for using openstack as a VIM
+ [ "$_DISTRO" == "Ubuntu" ] && install_packages "python-novaclient python-keystoneclient python-glanceclient "\
+ "python-neutronclient python-cinderclient python-openstackclient "\
+ "python-networking-l2gw"
+ [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && install_packages "python-devel" && easy_install \
+ python-novaclient python-keystoneclient python-glanceclient python-neutronclient python-cinderclient \
+ python-openstackclient python-networking-l2gw #TODO revise if gcc python-pip is needed
+
+ # required for Azure
+ pip2 install azure
+
+fi # [[ -z "$NO_PACKAGES" ]]
+
+if [[ -z $NOCLONE ]]; then
+ echo -e "\n"\
+ "#################################################################\n"\
+ "##### DOWNLOAD SOURCE #####\n"\
+ "#################################################################"
+ if [[ -d "${BASEFOLDER}" ]] ; then
+ if [[ -n "$FORCE" ]] ; then
+ echo "deleting '${BASEFOLDER}' folder"
+ rm -rf "$BASEFOLDER" #make idempotent
+ elif [[ -z "$QUIET_MODE" ]] ; then
+ ! ask_user "folder '${BASEFOLDER}' exists, overwrite (y/N)? " n && echo "Cancelled!" && exit 1
+ rm -rf "$BASEFOLDER"
+ else
+ echo "'${BASEFOLDER}' folder exists. Use "--force" to overwrite" >&2 && exit 1
+ fi
+ fi
+ su $SUDO_USER -c "git clone ${GIT_URL} ${BASEFOLDER}" || ! echo "Error cannot clone from '$GIT_URL'" >&2 || exit 1
+ if [[ -n $COMMIT_ID ]] ; then
+ echo -e "Installing osm-RO from refspec: $COMMIT_ID"
+ su $SUDO_USER -c "git -C ${BASEFOLDER} checkout $COMMIT_ID" ||
+ ! echo "Error cannot checkout '$COMMIT_ID' from '$GIT_URL'" >&2 || exit 1
+ elif [[ -z $DEVELOP ]]; then
+ LATEST_STABLE_TAG=`git -C "${BASEFOLDER}" tag -l "v[0-9]*" | sort -V | tail -n1`
+ echo -e "Installing osm-RO from refspec: tags/${LATEST_STABLE_TAG}"
+ su $SUDO_USER -c "git -C ${BASEFOLDER} checkout tags/${LATEST_STABLE_TAG}" ||
+ ! echo "Error cannot checkout 'tags/${LATEST_STABLE_TAG}' from '$GIT_URL'" >&2 || exit 1
+ else
+ echo -e "Installing osm-RO from refspec: master"
+ fi
+ su $SUDO_USER -c "cp ${BASEFOLDER}/.gitignore-common ${BASEFOLDER}/.gitignore"