Skip to content

Instantly share code, notes, and snippets.

@npeters
Last active June 16, 2020 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save npeters/10784956 to your computer and use it in GitHub Desktop.
Save npeters/10784956 to your computer and use it in GitHub Desktop.
Setup Yum Repo
# script instance
echo 172.23.113.5 vod-rpm >> /etc/hosts
sed -i 's/name=/enabled=0\nname=/g' /etc/yum.repos.d/*.repo
#add repo
cat << EOF > /etc/yum.repos.d/vod-centos6.repo
[VodCentos6-Repository]
name=Vod Centos6 - Local
baseurl=http://vod-rpm/centos6/Packages
enabled=1
gpgcheck=0
EOF
yum makecache
yum install -y screen htop bash-completion mutt git dstat ngrep iostat sysstat lynx vim
echo CheckHostIP no >> /etc/ssh/ssh_config
ForwardAgent yes >> /etc/ssh/ssh_config
ForwardX11 yes >> /etc/ssh/ssh_config
#python
yum -y install python-pip.noarch gcc make autoconf python-devel
pip install ansible
sed -i "s/keepcache=0/keepcache=1/g" /etc/yum.conf
yum install -y yum-utils yum-plugin-security.noarch createrepo httpd
mkdir -p /var/www/html/centos6/Packages
yum update -y
yum update --security -y
rpm -qa --qf '%{name}-%{version} \n' | sort > /tmp/rpm-install
cat /tmp/rpm-install | xargs -n20 yumdownloader -C --resolve --archlist noarch,x86_64 -C --destdir /var/www/html/centos6/Packages
createrepo --update /var/www/html/centos6/Packages
/etc/init.d/iptables stop
/etc/init.d/httpd start
yum -y install python-pip.noarch gcc make autoconf python-devel python-setuptools
yumdownloader --resolve --destdir /var/www/html/centos6/Packages/ python-pip.noarch gcc make autoconf python-devel python-setuptools
createrepo --update /var/www/html/centos6/Packages
pip install pip2pi
rm -fr /tmp/pip-build-root/
pip2tgz /var/www/html/python awscli==1.3.6 ansible==1.5.4
dir2pi /var/www/html/python
PACKAGE=$1
declare -A depSet
dep=( $PACKAGE )
depSet[$PACKAGE]=1
for(( i=0; i < ${#dep[@]}; i++ ))
do
for r in `repoquery --requires --recursive --resolve ${dep[$i]}`
do
add=true
for(( j=0; j < ${#dep[@]}; j++ ))
do
if [[ "${dep[$j]}" == $r ]]
then
add=false
break
fi
done
if [ "$add" == "true" ]
then
dep=( "${dep[@]}" $r )
fi
done
done
echo ${dep[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment