diff --git a/build-aux/setup-Linux-debian-10.sh b/build-aux/setup-Linux-debian-10.sh index 1475011e5..c3aed698c 100755 --- a/build-aux/setup-Linux-debian-10.sh +++ b/build-aux/setup-Linux-debian-10.sh @@ -3,10 +3,35 @@ # Install needed system tools # update first apt-get -q update -apt-get -q install tzdata -y + + +apt-get install tzdata -y +apt-get install curl -y +apt-get install apt-utils -y + +# "Etc" will cause installation error +if [ ! -f /etc/timezone -o "$(cat /etc/timezone | cut -f1 -d'/')" == "Etc" ]; then + # get time zone from URL + URL="https://ipapi.co/timezone" + response=$(curl -s -w "%{http_code}" $URL) + http_code=$(tail -n1 <<< "${response: -3}") # get the last 3 digits + if [ $http_code == "200" ]; then + time_zone=$(sed 's/.\{3\}$//' <<< "${response}") # remove the last 3 digits + echo "successful get timezone from $URL , Set time zone as $time_zone" + ln -fs /usr/share/zoneinfo/$time_zone /etc/localtime + else + echo "Can not get timezone from $URL , http_code is $http_code " + echo "Set default time zone as UTC/GMT. " + ln -fs /usr/share/zoneinfo/UTC/GMT /etc/localtime + fi + + export DEBIAN_FRONTEND=noninteractive + apt-get install -y tzdata + dpkg-reconfigure --frontend noninteractive tzdata +fi apt-get -q install software-properties-common -y -apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl -y +apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y # install system build tools needed by gridlabd @@ -28,7 +53,7 @@ apt-get install xz-utils -y # Install python 3.9.6 # python3 support needed as of 4.2 -if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version)" != "Python 3.9.6" ]; then +if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version | cut -f2 -d.)" != "Python 3.9" ]; then echo "install python 3.9.6" cd /usr/local/src @@ -46,11 +71,13 @@ if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version)" != "Py ln -sf /usr/local/bin/pydoc3.9 /usr/local/bin/pydoc ln -sf /usr/local/bin/idle3.9 /usr/local/bin/idle ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip3 + /usr/local/bin/python3 -m pip install --upgrade pip /usr/local/bin/python3 -m pip install matplotlib Pillow pandas numpy networkx pytz pysolar PyGithub scikit-learn xlrd boto3 /usr/local/bin/python3 -m pip install IPython censusdata fi - +# install latex +apt-get install texlive -y # doxgygen apt-get -q install gawk -y diff --git a/build-aux/setup-Linux-debian-9.sh b/build-aux/setup-Linux-debian-9.sh index 79dfb3fb8..40557d93e 100755 --- a/build-aux/setup-Linux-debian-9.sh +++ b/build-aux/setup-Linux-debian-9.sh @@ -3,27 +3,38 @@ # Install needed system tools # update first apt-get -q update -apt-get -q install tzdata -y -# install python 3.7 +apt-get install tzdata -y +apt-get install curl -y +apt-get install apt-utils -y + + +# "Etc" will cause installation error +if [ ! -f /etc/timezone -o "$(cat /etc/timezone | cut -f1 -d'/')" == "Etc" ]; then + # get time zone from URL + URL="https://ipapi.co/timezone" + response=$(curl -s -w "%{http_code}" $URL) + http_code=$(tail -n1 <<< "${response: -3}") # get the last 3 digits + if [ $http_code == "200" ]; then + time_zone=$(sed 's/.\{3\}$//' <<< "${response}") # remove the last 3 digits + echo "successful get timezone from $URL , Set time zone as $time_zone" + ln -fs /usr/share/zoneinfo/$time_zone /etc/localtime + else + echo "Can not get timezone from $URL , http_code is $http_code " + echo "Set default time zone as UTC/GMT. " + ln -fs /usr/share/zoneinfo/UTC/GMT /etc/localtime + fi + + export DEBIAN_FRONTEND=noninteractive + apt-get install -y tzdata + dpkg-reconfigure --frontend noninteractive tzdata +fi + apt-get -q install software-properties-common -y -apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev curl -y -cd /tmp -curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz -tar -xf Python-3.7.3.tar.xz -cd Python-3.7.3 -./configure --enable-optimizations --enable-shared CXXFLAGS="-fPIC" -make -j10 altinstall -cd /usr/local/bin -ln -s python3.7 python3 -ln -s python3.7m-config python3-config -ln -s pip3.7 pip3 - -# install python libraries by validation -pip3 -q install --upgrade pip -pip -q install pandas matplotlib mysql-client Pillow +apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev -y # install system build tools needed by gridlabd + apt-get -q install git -y apt-get -q install unzip -y apt-get -q install autoconf -y @@ -33,8 +44,40 @@ apt-get -q install cmake -y apt-get -q install flex -y apt-get -q install bison -y apt-get -q install libcurl4-gnutls-dev -y -apt-get -q install libncurses5-dev -y apt-get -q install subversion -y +apt-get -q install util-linux -y +apt-get install liblzma-dev -y +apt-get install libbz2-dev -y +apt-get install libncursesw5-dev -y +apt-get install xz-utils -y + +# Install python 3.9.6 +# python3 support needed as of 4.2 +if [ ! -x /usr/local/bin/python3 -o "$(/usr/local/bin/python3 --version | cut -f2 -d.)" != "Python 3.9" ]; then + echo "install python 3.9.6" + cd /usr/local/src + + curl https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz | tar xz + # tar xzf Python-3.9.6.tgz + cd Python-3.9.6 + + ./configure --prefix=/usr/local --enable-optimizations --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions CFLAGS="-fPIC" + + make -j $(nproc) + make altinstall + /sbin/ldconfig /usr/local/lib + ln -sf /usr/local/bin/python3.9 /usr/local/bin/python3 + ln -sf /usr/local/bin/python3.9-config /usr/local/bin/python3-config + ln -sf /usr/local/bin/pydoc3.9 /usr/local/bin/pydoc + ln -sf /usr/local/bin/idle3.9 /usr/local/bin/idle + ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip3 + /usr/local/bin/python3 -m pip install --upgrade pip + /usr/local/bin/python3 -m pip install matplotlib Pillow pandas numpy networkx pytz pysolar PyGithub scikit-learn xlrd boto3 + /usr/local/bin/python3 -m pip install IPython censusdata +fi + +# # install latex +apt-get install texlive -y # doxgygen apt-get -q install gawk -y @@ -51,12 +94,13 @@ if [ ! -x /usr/bin/doxygen ]; then make install fi -# mono -apt-get -q install curl -y +# # mono + if [ ! -f /usr/bin/mono ]; then cd /tmp + apt install apt-transport-https dirmngr gnupg ca-certificates -y apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo "deb http://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.8.0 main" | tee /etc/apt/sources.list.d/mono-official.list + echo "deb https://download.mono-project.com/repo/debian stable-bustergrid main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list apt-get -q update -y apt-get -q install mono-devel -y fi