因为是腾讯做了安全设置,很多东西都无法直接换,腾讯有个内网更新源,贴出做个笔记
正好帮娃娃MJJ配置腾讯云的VPS环境,在配置环境前先下载内网更新源,更新一下(这个是要登录腾讯云在可以下载的因为是腾讯内网)
wget -c http://mirrors.tencentyun.com/install/softinst.sh sh softinst.sh
内网软件更新源代码:
#!/bin/sh PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/user_00/bin dir=$(dirname $(which $0)) #default eth0 interface=eth1 tmpfile=/tmp/tmp`date +'%Y%m%d%H%M%S'` /sbin/ifconfig > ${tmpfile} 2>&1 grep ^eth0 ${tmpfile}>/dev/null [ $? -eq 0 ] && interface=eth0 grep ^eth1 ${tmpfile}>/dev/null [ $? -eq 0 ] && interface=eth1 [ -f ${tmpfile} ] && rm -f ${tmpfile} [ -z "${interface}" ] && echo "warn: interface not confirm" eth1=`/sbin/ifconfig ${interface}|grep addr:|head -n 1|awk '{print $2}'|sed 's/addr://'` script=`basename $0` day=`date +%Y%m%d` check_os() { # check which OS and ver if [ -f /etc/SuSE-release ];then echo suse elif [ -f /etc/tlinux-release ];then echo tlinux elif [ -f /etc/centos-release ];then echo centos elif [ -f /etc/redhat-release ];then echo redhat elif [ -f /etc/os-release ];then grep Ubuntu /etc/os-release > /dev/null [ $? -eq 0 ] && echo ubuntu fi } os=`check_os` if [ -z "$os" ] then echo "ERROR: unknown OS type" exit 1 fi setup_tlinux() { rm *.repo 2>/dev/null for file in RPM-GPG-KEY-EPEL-6 RPM-GPG-KEY-rpmforge-dag epel.repo tlinux.repo;do wget -q http://mirrors.tencentyun.com/install/tlinux/$file if [ $? -ne 0 ];then echo "ERROR: download ${file} fail" exit 1 fi done rm /etc/yum.repos.d/*.repo 2>/dev/null cp RPM-GPG-KEY-* /etc/pki/rpm-gpg/ cp *.repo /etc/yum.repos.d yum clean all >/dev/null echo "Setup ok" } setup_centos() { rm *.repo 2>/dev/null for file in RPM-GPG-KEY-EPEL-6 RPM-GPG-KEY-rpmforge-dag epel.repo rpmforge.repo centos.repo;do wget -q http://mirrors.tencentyun.com/install/centos/$file if [ $? -ne 0 ];then echo "Setup error, download fail" exit 1 fi done #rm /etc/yum.repos.d/*.repo 2>/dev/null cp RPM-GPG-KEY-* /etc/pki/rpm-gpg/ cp *.repo /etc/yum.repos.d yum clean all >/dev/null echo "Setup ok" } setup_redhat5() { rm *.repo 2>/dev/null for file in epel.repo centos.repo;do wget -q http://mirrors.tencentyun.com/install/redhat5/$file if [ $? -ne 0 ];then echo "Setup error, download fail" exit 1 fi done rm /etc/yum.repos.d/*.repo 2>/dev/null cp *.repo /etc/yum.repos.d yum clean all >/dev/null echo "Setup ok" } setup_ubuntu() { rm *.repo 2>/dev/null for file in sources.list;do wget -q http://mirrors.tencentyun.com/install/ubuntu/$file if [ $? -ne 0 ];then echo "Setup error, download fail" exit 1 fi done cp /etc/apt/sources.list /etc/apt/sources.list.`date +%F` cp sources.list /etc/apt/ apt-get update } setup_suse() { echo "SuSE10 do nothing" #do nothing } mkdir -p /tmp/softinst cd /tmp/softinst rm /tmp/softinst/* 2>/dev/null echo "$os software install..." if [ $os = "tlinux" ];then setup_tlinux elif [ $os = "redhat" ];then setup_redhat5 elif [ $os = "centos" ];then setup_centos elif [ $os = "ubuntu" ];then setup_ubuntu elif [ $os = "SuSE" ];then setup_suse else echo "ERROR: unsupprt OS type" exit 1 fi [ -d /tmp/softinst ] && rm -rf /tmp/softinst*
文章评论