added scripts for using compass offline_repo

-added template conf file for pip&easy_install
-remove installation of epel and remi-safe repo, related pakcages
are moved to compass_install repo

Change-Id: Idded23eb60783e78763aa52d2801ee6052abeb7c
This commit is contained in:
qingyu 2017-01-13 18:17:18 -05:00
parent 83de2eca82
commit bbdd8ce3b0
10 changed files with 220 additions and 85 deletions

2
.gitignore vendored
View File

@ -11,7 +11,7 @@
# temp files # temp files
install/env.sh install/env.sh
install/env.conf
# Packages # Packages
*.egg *.egg
*.egg-info *.egg-info

View File

@ -1,4 +1,4 @@
NIC=${NIC:-eth1} NIC=${NIC:-ens224}
IPADDR=${IPADDR:-10.1.10.15} IPADDR=${IPADDR:-10.1.10.15}
NETMASK=${NETMASK:-255.255.255.0} NETMASK=${NETMASK:-255.255.255.0}
WEB_SOURCE=${WEB_SOURCE:-http://git.openstack.org/openstack/compass-web} WEB_SOURCE=${WEB_SOURCE:-http://git.openstack.org/openstack/compass-web}

View File

@ -2,32 +2,35 @@
# Config File for Compass Installer # # Config File for Compass Installer #
##################################### #####################################
# Agent or Fullserver # Agent or Fullserver
export FULL_COMPASS_SERVER="true" export FULL_COMPASS_SERVER="false"
#url of compass offline repo
#export REPO="http://10.145.250.80:9999"
# User Email # User Email
export USER_EMAIL="test@huawei.com" export USER_EMAIL="test@huawei.com"
# User Password # User Password
export USER_PASSWORD= export USER_PASSWORD=
# Compass Server Address, required if installing agent # Compass Server Address, required if installing agent
export COMPASS_API_SERVER="c.stack360.io" export COMPASS_API_SERVER="10.145.250.32"
# Release tag # Release tag
export RELEASE_TAG="colorado.3.0" export RELEASE_TAG="colorado.3.0"
# OS_INSTALLER indicates the tool for OS provisioning, default is 'cobbler'. # OS_INSTALLER indicates the tool for OS provisioning, default is 'cobbler'.
export OS_INSTALLER="cobbler" export OS_INSTALLER="cobbler"
export tempest="false"
# PACKAGE_INSTALLER indicates the tool for Package provisioning, default is 'chef'. # PACKAGE_INSTALLER indicates the tool for Package provisioning, default is 'chef'.
export PACKAGE_INSTALLER="package" export PACKAGE_INSTALLER="package"
# set remi release url # set remi release url
# export ATOMIC=${ATOMIC:-http://www6.atomicorp.com/channels/atomic/${IMAGE_TYPE,,}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/RPMS/atomic-release-1.0-19.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.art.noarch.rpm} # export ATOMIC=${ATOMIC:-http://www6.atomicorp.com/channels/atomic/${IMAGE_TYPE,,}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/RPMS/atomic-release-1.0-19.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.art.noarch.rpm}
# export REMI=${REMI:-http://rpms.famillecollet.com/enterprise/remi-release-6.rpm} # export REMI=${REMI:-http://rpms.famillecollet.com/enterprise/remi-release-6.rpm}
export REMI="http://rpms.famillecollet.com/enterprise/remi-release-7.rpm" #export REMI="http://rpms.famillecollet.com/enterprise/remi-release-7.rpm"
export EPEL="https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" #export EPEL="https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
#export MYSQL="mysql-community-release-el7-5.noarch.rpm"
export MYSQL="http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm"
export OPENSTACK_ANSIBLE_MODULE="https://github.com/openstack-ansible/openstack-ansible-modules.git" export OPENSTACK_ANSIBLE_MODULE="https://github.com/openstack-ansible/openstack-ansible-modules.git"
#export OPENSTACK_ANSIBLE_MODULE="${REPO}/openstack-ansible-modules"
# External network config for access remote compass server # External network config for access remote compass server
# External network NIC # External network NIC
export PUBLIC_NIC="eth0" export PUBLIC_NIC="eth0"
@ -80,16 +83,25 @@ export IMAGE_VERSION="${IMAGE_VERSION_MAJOR}.${IMAGE_VERSION_MINOR}"
export IMAGE_NAME="${IMAGE_TYPE}-${IMAGE_VERSION}" export IMAGE_NAME="${IMAGE_TYPE}-${IMAGE_VERSION}"
export IMAGE_ARCH="x86_64" export IMAGE_ARCH="x86_64"
export CENTOS_7_2_IMAGE_SOURCE="http://205.177.226.237:9999/CentOS-7-x86_64-Minimal-1511.iso" export CENTOS_7_2_IMAGE_SOURCE="http://205.177.226.237:9999/CentOS-7-x86_64-Minimal-1511.iso"
export UBUNTU_14_04_03_IMAGE_SOURCE="http://205.177.226.237:9999/ubuntu-14.04.3-server-amd64.iso" export UBUNTU_14_04_03_IMAGE_SOURCE="http://205.177.226.237:9999/ubuntu-14.04.3-server-amd64.iso"
export CENTOS_7_2_PPA_REPO_SOURCE="http://205.177.226.237:9999/centos7-juno-ppa.tar.gz" export CENTOS_7_2_PPA_REPO_SOURCE="http://205.177.226.237:9999/centos7-juno-ppa.tar.gz"
export UBUNTU_14_04_03_PPA_REPO_SOURCE="http://205.177.226.237:9999/trusty-mitaka-ppa.tar.gz" export UBUNTU_14_04_03_PPA_REPO_SOURCE="http://205.177.226.237:9999/trusty-mitaka-ppa.tar.gz"
export PIP_PACKAGES="http://205.177.226.237:9999/pip.tar.gz" export PIP_PACKAGES="http://205.177.226.237:9999/pip.tar.gz"
export EXTRA_PACKAGES="http://205.177.226.237:9999/packages.tar.gz"
#offline repo for iso and ppa
#export CENTOS_7_2_IMAGE_SOURCE="${REPO}/CentOS-7-x86_64-Minimal-1511.iso"
#export UBUNTU_14_04_03_IMAGE_SOURCE="${REPO}/ubuntu-14.04.3-server-amd64.iso"
#export CENTOS_7_2_PPA_REPO_SOURCE="${REPO}/centos7-juno-ppa.tar.gz"
#export UBUNTU_14_04_03_PPA_REPO_SOURCE="${REPO}/trusty-mitaka-ppa.tar.gz"
#export PIP_PACKAGES="${REPO}/pip.tar.gz"
#export EXTRA_PACKAGES="${REPO}/packages.tar.gz"
export COBBLER_PASSWORD="cobbler" export COBBLER_PASSWORD="cobbler"
export COBBLER_LOADERS_SOURCE="https://s3-us-west-1.amazonaws.com/compass-local-repo/loaders.tar.gz" export COBBLER_LOADERS_SOURCE="http://205.177.226.237:9999/loaders.tar.gz"
#export COBBLER_LOADERS_SOURCE="${REPO}/loaders.tar.gz"
export COBBLER_LOADERS_SOURCE_ASIA="http://huawei-repo.uubright.com/repos/compass/loaders.tar.gz" export COBBLER_LOADERS_SOURCE_ASIA="http://huawei-repo.uubright.com/repos/compass/loaders.tar.gz"
# Currently the use of Javascript MVC is set to version 3.2.4 # Currently the use of Javascript MVC is set to version 3.2.4
@ -108,8 +120,8 @@ export CHEF_PASSWD="root1234"
export WEB_HOME="/tmp/web" export WEB_HOME="/tmp/web"
export ADAPTERS_HOME="/tmp/adapter/deploy/adapters" export ADAPTERS_HOME="/tmp/adapter/deploy/adapters"
export ADAPTERS_DEST="/tmp/adapter" export ADAPTERS_DEST="/tmp/adapter"
export WEB_SOURCE= #export WEB_SOURCE="${REPO}/compass-web"
export ADAPTERS_SOURCE= #export ADAPTERS_SOURCE="${REPO}/compass4nfv"
# Set compass environment # Set compass environment
export SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) export SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

View File

@ -150,40 +150,47 @@ source $DIR/install.conf
### Change selinux security policy ### Change selinux security policy
sudo setenforce 0 sudo setenforce 0
sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config
###configure compass_install.repo
rm -rf /etc/yum.repos.d/compass_install.repo 2>/dev/null
cp ${COMPASSDIR}/misc/compass_install.repo /etc/yum.repos.d/
yum clean all
### Add epel repo ### Add epel repo
sudo rpm -q epel-release #sudo rpm -q epel-release
if [ "$?" != "0" ]; then #if [ "$?" != "0" ]; then
sudo rpm -Uvh $EPEL # sudo rpm -Uvh $EPEL
if [ "$?" != "0" ]; then # if [ "$?" != "0" ]; then
echo "failed to install epel-release" # echo "failed to install epel-release"
exit 1 # exit 1
else # else
echo "sucessfaully installed epel-release" # echo "sucessfaully installed epel-release"
fi # fi
else #else
echo "epel-release is already installed" # echo "epel-release is already installed"
fi #fi
sed -i 's/^mirrorlist=https/mirrorlist=http/g' /etc/yum.repos.d/epel.repo #sed -i 's/^mirrorlist=https/mirrorlist=http/g' /etc/yum.repos.d/epel.repo
sudo rpm -q atomic-release #sudo rpm -q atomic-release
if [ "$?" == "0" ]; then #if [ "$?" == "0" ]; then
sudo rpm -e atomic-release # sudo rpm -e atomic-release
fi #fi
### Add remi repo ### Add remi repo
sudo rpm -q remi-release #sudo rpm -q remi-release
if [ "$?" != "0" ]; then #if [ "$?" != "0" ]; then
sudo rpm -Uvh $REMI >& /dev/null # sudo rpm -Uvh $REMI >& /dev/null
if [ "$?" != "0" ]; then # if [ "$?" != "0" ]; then
echo "failed to install remi-release" # echo "failed to install remi-release"
exit 1 # exit 1
else # else
echo "successfully installed remi-release" # echo "successfully installed remi-release"
fi # fi
else #else
echo "remi-release is already installed" # echo "remi-release is already installed"
fi #fi
# sed -i 's/^mirrorlist=https/mirrorlist=http/g' /etc/yum.repos.d/atomic.repo # sed -i 's/^mirrorlist=https/mirrorlist=http/g' /etc/yum.repos.d/atomic.repo
@ -321,8 +328,8 @@ export ADAPTERS_SOURCE=${ADAPTERS_SOURCE:-"https://gerrit.opnfv.org/gerrit/compa
echo "set the iptables' rules so that the openstack hosts installed can access remote compass through agent server" echo "set the iptables' rules so that the openstack hosts installed can access remote compass through agent server"
set_iptables ${PUBLIC_IP} ${IPADDR} ${NETMASK} set_iptables ${PUBLIC_IP} ${IPADDR} ${NETMASK}
rm -rf /etc/yum.repos.d/compass_install.repo 2>/dev/nullcp #rm -rf /etc/yum.repos.d/compass_install.repo 2>/dev/nullcp
cp ${COMPASSDIR}/misc/compass_install.repo /etc/yum.repos.d/ #cp ${COMPASSDIR}/misc/compass_install.repo /etc/yum.repos.d/
echo "script dir: $SCRIPT_DIR" echo "script dir: $SCRIPT_DIR"
echo "compass dir is $COMPASSDIR" echo "compass dir is $COMPASSDIR"

61
install/offline_repo.sh Executable file
View File

@ -0,0 +1,61 @@
export SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export COMPASSDIR=${SCRIPT_DIR}/..
#disable yum base official repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
cat << 'EOF' > /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
enabled=0
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
enabled=0
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
enabled=0
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
EOF
yum clean all
#change pip repo
rm -rf /root/.pip
mkdir -p /root/.pip
rm -f /root/.pydistutils.cfg
cp ${COMPASSDIR}/misc/pip_localrepo.conf /root/.pip/pip.conf
cp ${COMPASSDIR}/misc/pydistutils_localrepo.conf /root/.pydistutils.cfg

View File

@ -168,11 +168,13 @@ if [[ "$?" != "0" ]]; then
fi fi
local_branch=$(echo ${remote_branch} | sed -e 's/origin\///g') local_branch=$(echo ${remote_branch} | sed -e 's/origin\///g')
if [ -z $WEB_SOURCE ]; then if [ "FULL_COMPASS_SERVER" == "true" ]; then
echo "web source $WEB_SOURCE is not set" if [ -z $WEB_SOURCE ]; then
exit 1 echo "web source $WEB_SOURCE is not set"
exit 1
fi
copy2dir "$WEB_SOURCE" "$WEB_HOME" || exit $?
fi fi
copy2dir "$WEB_SOURCE" "$WEB_HOME" || exit $?
if [ -z $ADAPTERS_SOURCE ]; then if [ -z $ADAPTERS_SOURCE ]; then
echo "adpaters source $ADAPTERS_SOURCE is not set" echo "adpaters source $ADAPTERS_SOURCE is not set"

View File

@ -1,15 +1,18 @@
############################################# #############################################
# Config File for Standalone Compass Server # # Config File for Standalone Compass Server #
############################################# #############################################
export REMI="http://rpms.famillecollet.com/enterprise/remi-release-7.rpm" #export REPO=http://127.0.0.1:9999
#export REMI="http://rpms.famillecollet.com/enterprise/remi-release-7.rpm"
export EPEL="https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm" #export EPEL="https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
export MYSQL="mysql-community-release-el7-5.noarch.rpm" #export MYSQL="mysql-community-release-el7-5.noarch.rpm"
# Compass web related variables # Compass web related variables
export WEB_HOME="/tmp/web" export WEB_HOME="/tmp/web"
export WEB_SOURCE= #uncomment this field if using compass-web repo in offline repo
#export WEB_SOURCE="${REPO}/compass-web"
#set compass environment #set compass environment
export SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) export SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
@ -17,9 +20,49 @@ export COMPASSDIR=${SCRIPT_DIR}/..
export TESTMODE="False" export TESTMODE="False"
# Set Local Repo sources # Set Local Repo sources
#export LOCAL_REPO_US="https://s3-us-west-1.amazonaws.com/compass-local-repo"
export LOCAL_REPO_US="https://s3-us-west-1.amazonaws.com/compass-local-repo" export LOCAL_REPO_US="https://s3-us-west-1.amazonaws.com/compass-local-repo"
export LOCAL_REPO_HUAWEI="http://huawei-repo.uubright.com/repos/compass" export LOCAL_REPO_HUAWEI="http://huawei-repo.uubright.com/repos/compass"
# package hosting sources # package hosting sources
export PIP_PACKAGES="http://205.177.226.237:9999/pip.tar.gz" export PIP_PACKAGES="http://205.177.226.237:9999/pip.tar.gz"
#export PIP_PACKAGES="${REPO}/pip.tar.gz"
export EXTRA_PACKAGES="http://205.177.226.237:9999/packages.tar.gz" export EXTRA_PACKAGES="http://205.177.226.237:9999/packages.tar.gz"
#export EXTRA_PACKAGES="${REPO}/packages.tar.gz"

View File

@ -73,40 +73,46 @@ source $DIR/install_func.sh
sudo setenforce 0 sudo setenforce 0
sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config
###configure compass_install repo
rm -rf /etc/yum.repos.d/compass_install.repo 2>/dev/null
cp ${COMPASSDIR}/misc/compass_install.repo /etc/yum.repos.d/
yum clean all
### Add epel repo ### Add epel repo
sudo rpm -q epel-release #sudo rpm -q epel-release
if [ "$?" != "0" ]; then #if [ "$?" != "0" ]; then
sudo rpm -Uvh $EPEL # sudo rpm -Uvh $EPEL
if [ "$?" != "0" ]; then # if [ "$?" != "0" ]; then
echo "failed to install epel-release" # echo "failed to install epel-release"
exit 1 # exit 1
else # else
echo "sucessfaully installed epel-release" # echo "sucessfaully installed epel-release"
fi # fi
else #else
echo "epel-release is already installed" # echo "epel-release is already installed"
fi #fi
sed -i 's/^mirrorlist=https/mirrorlist=http/g' /etc/yum.repos.d/epel.repo #sed -i 's/^mirrorlist=https/mirrorlist=http/g' /etc/yum.repos.d/epel.repo
sudo rpm -q atomic-release #sudo rpm -q atomic-release
if [ "$?" == "0" ]; then #if [ "$?" == "0" ]; then
sudo rpm -e atomic-release # sudo rpm -e atomic-release
fi #fi
### Add remi repo ### Add remi repo
sudo rpm -q remi-release #sudo rpm -q remi-release
if [ "$?" != "0" ]; then #if [ "$?" != "0" ]; then
sudo rpm -Uvh $REMI >& /dev/null # sudo rpm -Uvh $REMI >& /dev/null
if [ "$?" != "0" ]; then # if [ "$?" != "0" ]; then
echo "failed to install remi-release" # echo "failed to install remi-release"
exit 1 # exit 1
else # else
echo "successfully installed remi-release" # echo "successfully installed remi-release"
fi # fi
else #else
echo "remi-release is already installed" # echo "remi-release is already installed"
fi #fi
### Trap any error code with related filename and line. ### Trap any error code with related filename and line.
errtrap() errtrap()
@ -127,11 +133,9 @@ sudo yum update -y
# assign all necessary values. # assign all necessary values.
export WEB_SOURCE=${WEB_SOURCE:-"http://git.openstack.org/openstack/compass-web"} export WEB_SOURCE=${WEB_SOURCE:-"http://git.openstack.org/openstack/compass-web"}
rm -rf /etc/yum.repos.d/compass_install.repo 2>/dev/nullcp
cp ${COMPASSDIR}/misc/compass_install.repo /etc/yum.repos.d/
# Start: install required packages and dependencies # Start: install required packages and dependencies
sudo yum --enablerepo=compass_install install -y $MYSQL #sudo yum --enablerepo=compass_install install -y $MYSQL
sudo yum --enablerepo=compass_install --nogpgcheck install -y rsyslog logrotate ntp python python-devel git wget syslinux amqp mod_wsgi httpd bind rsync yum-utils gcc unzip openssl openssl098e ca-certificates mysql-devel mysql-server mysql MySQL-python python-virtualenv python-setuptools python-pip bc libselinux-python libffi-devel openssl-devel rabbitmq-server sudo yum --enablerepo=compass_install --nogpgcheck install -y rsyslog logrotate ntp python python-devel git wget syslinux amqp mod_wsgi httpd bind rsync yum-utils gcc unzip openssl openssl098e ca-certificates mysql-devel mysql-server mysql MySQL-python python-virtualenv python-setuptools python-pip bc libselinux-python libffi-devel openssl-devel rabbitmq-server
sudo yum --setopt=tsflags=noscripts -y remove redis sudo yum --setopt=tsflags=noscripts -y remove redis
sudo yum --enablerepo=compass_install --nogpgcheck install -y redis sudo yum --enablerepo=compass_install --nogpgcheck install -y redis
@ -391,7 +395,7 @@ else
echo "compass package is installed in virtualenv under current dir" echo "compass package is installed in virtualenv under current dir"
fi fi
udo sed -i "s/\$ipaddr/$IPADDR/g" /etc/compass/setting sudo sed -i "s/\$ipaddr/$IPADDR/g" /etc/compass/setting
sudo sed -i "s/\$hostname/$HOSTNAME/g" /etc/compass/setting sudo sed -i "s/\$hostname/$HOSTNAME/g" /etc/compass/setting
sudo sed -i "s/\$gateway/$OPTION_ROUTER/g" /etc/compass/setting sudo sed -i "s/\$gateway/$OPTION_ROUTER/g" /etc/compass/setting
domains=$(echo $NAMESERVER_DOMAINS | sed "s/,/','/g") domains=$(echo $NAMESERVER_DOMAINS | sed "s/,/','/g")

3
misc/pip_localrepo.conf Normal file
View File

@ -0,0 +1,3 @@
[global]
index-url=http://127.0.0.1:9999/pip/simple
trusted-host=127.0.0.1

View File

@ -0,0 +1,3 @@
[easy_install]
index-url=http://127.0.0.1:9999/pip/simple